From c113933b60cd2919cb1ad3340c303386dab31e9a Mon Sep 17 00:00:00 2001 From: MatFl Date: Sat, 28 Jul 2018 03:32:22 +0200 Subject: [PATCH] Prevent context leak through SystemSensorManager (#245) --- .../utils/com/otaliastudios/cameraview/OrientationHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cameraview/src/main/utils/com/otaliastudios/cameraview/OrientationHelper.java b/cameraview/src/main/utils/com/otaliastudios/cameraview/OrientationHelper.java index 99c2cb17..8006d095 100644 --- a/cameraview/src/main/utils/com/otaliastudios/cameraview/OrientationHelper.java +++ b/cameraview/src/main/utils/com/otaliastudios/cameraview/OrientationHelper.java @@ -22,7 +22,7 @@ class OrientationHelper { OrientationHelper(Context context, @NonNull Callback callback) { mCallback = callback; - mListener = new OrientationEventListener(context, SensorManager.SENSOR_DELAY_NORMAL) { + mListener = new OrientationEventListener(context.getApplicationContext(), SensorManager.SENSOR_DELAY_NORMAL) { @Override public void onOrientationChanged(int orientation) { @@ -72,4 +72,4 @@ class OrientationHelper { int getDisplayOffset() { return mDisplayOffset; } -} \ No newline at end of file +}