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 commit33f94a4375) (cherry picked from commit7625c27193) Merged-In: Id201891ffd546119b18b18b692dd87008f6735c2 Change-Id: Id201891ffd546119b18b18b692dd87008f6735c2
This commit is contained in:
@@ -86,6 +86,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
|||||||
import com.android.internal.logging.UiEventLogger;
|
import com.android.internal.logging.UiEventLogger;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.screenshot.ScreenshotController.SavedImageData.ActionTransition;
|
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.InputMonitorCompat;
|
||||||
import com.android.systemui.shared.system.QuickStepContract;
|
import com.android.systemui.shared.system.QuickStepContract;
|
||||||
|
|
||||||
@@ -162,6 +163,7 @@ public class ScreenshotView extends FrameLayout implements
|
|||||||
private GestureDetector mSwipeDetector;
|
private GestureDetector mSwipeDetector;
|
||||||
private SwipeDismissHandler mSwipeDismissHandler;
|
private SwipeDismissHandler mSwipeDismissHandler;
|
||||||
private InputMonitorCompat mInputMonitor;
|
private InputMonitorCompat mInputMonitor;
|
||||||
|
private InputChannelCompat.InputEventReceiver mInputEventReceiver;
|
||||||
private boolean mShowScrollablePreview;
|
private boolean mShowScrollablePreview;
|
||||||
private String mPackageName = "";
|
private String mPackageName = "";
|
||||||
|
|
||||||
@@ -302,8 +304,8 @@ public class ScreenshotView extends FrameLayout implements
|
|||||||
private void startInputListening() {
|
private void startInputListening() {
|
||||||
stopInputListening();
|
stopInputListening();
|
||||||
mInputMonitor = new InputMonitorCompat("Screenshot", Display.DEFAULT_DISPLAY);
|
mInputMonitor = new InputMonitorCompat("Screenshot", Display.DEFAULT_DISPLAY);
|
||||||
mInputMonitor.getInputReceiver(Looper.getMainLooper(), Choreographer.getInstance(),
|
mInputEventReceiver = mInputMonitor.getInputReceiver(
|
||||||
ev -> {
|
Looper.getMainLooper(), Choreographer.getInstance(), ev -> {
|
||||||
if (ev instanceof MotionEvent) {
|
if (ev instanceof MotionEvent) {
|
||||||
MotionEvent event = (MotionEvent) ev;
|
MotionEvent event = (MotionEvent) ev;
|
||||||
if (event.getActionMasked() == MotionEvent.ACTION_DOWN
|
if (event.getActionMasked() == MotionEvent.ACTION_DOWN
|
||||||
@@ -320,6 +322,10 @@ public class ScreenshotView extends FrameLayout implements
|
|||||||
mInputMonitor.dispose();
|
mInputMonitor.dispose();
|
||||||
mInputMonitor = null;
|
mInputMonitor = null;
|
||||||
}
|
}
|
||||||
|
if (mInputEventReceiver != null) {
|
||||||
|
mInputEventReceiver.dispose();
|
||||||
|
mInputEventReceiver = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // ViewGroup
|
@Override // ViewGroup
|
||||||
|
|||||||
Reference in New Issue
Block a user