summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiranda Kephart <mkephart@google.com>2021-11-17 13:32:42 -0500
committerXin Li <delphij@google.com>2022-03-02 18:17:54 -0800
commit12464ec4c1285054c5b48f850fde584cdb4fbcca (patch)
tree1882fdb6c1d020a466a47fe86dc261f163c85788
parent2592ea1fc8efc6ffebf9fe6e9eb67fd62fae1d4b (diff)
downloadbase-12464ec4c1285054c5b48f850fde584cdb4fbcca.tar.gz
Dispose of input event reciever along with monitor
Explicitly store a reference to the input event receiver so that we can dispose of it at the same time as the input monitor. Bug: 206809961 Fix: 206809961 Test: manual (cherry picked from commit 33f94a437587030bd0e84f78279fa7c6f71e2daf) (cherry picked from commit 7625c271931b8e7abe9b4b4e91592b5413bdd35f) Merged-In: Id201891ffd546119b18b18b692dd87008f6735c2 Change-Id: Id201891ffd546119b18b18b692dd87008f6735c2
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java
index ca63ec269bf4..0d11070fd220 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java
@@ -86,6 +86,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import com.android.internal.logging.UiEventLogger;
import com.android.systemui.R;
import com.android.systemui.screenshot.ScreenshotController.SavedImageData.ActionTransition;
+import com.android.systemui.shared.system.InputChannelCompat;
import com.android.systemui.shared.system.InputMonitorCompat;
import com.android.systemui.shared.system.QuickStepContract;
@@ -162,6 +163,7 @@ public class ScreenshotView extends FrameLayout implements
private GestureDetector mSwipeDetector;
private SwipeDismissHandler mSwipeDismissHandler;
private InputMonitorCompat mInputMonitor;
+ private InputChannelCompat.InputEventReceiver mInputEventReceiver;
private boolean mShowScrollablePreview;
private String mPackageName = "";
@@ -302,8 +304,8 @@ public class ScreenshotView extends FrameLayout implements
private void startInputListening() {
stopInputListening();
mInputMonitor = new InputMonitorCompat("Screenshot", Display.DEFAULT_DISPLAY);
- mInputMonitor.getInputReceiver(Looper.getMainLooper(), Choreographer.getInstance(),
- ev -> {
+ mInputEventReceiver = mInputMonitor.getInputReceiver(
+ Looper.getMainLooper(), Choreographer.getInstance(), ev -> {
if (ev instanceof MotionEvent) {
MotionEvent event = (MotionEvent) ev;
if (event.getActionMasked() == MotionEvent.ACTION_DOWN
@@ -320,6 +322,10 @@ public class ScreenshotView extends FrameLayout implements
mInputMonitor.dispose();
mInputMonitor = null;
}
+ if (mInputEventReceiver != null) {
+ mInputEventReceiver.dispose();
+ mInputEventReceiver = null;
+ }
}
@Override // ViewGroup