Merge "Ensure screenshot input monitor is always removed" into sc-v2-dev am: 8a9fb9c249

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16197503

Change-Id: I5ee59b6958f24cb55a7d0a94fb7410b87f0b4b6d
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java
index 4d364e1..44b4540 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java
@@ -780,6 +780,10 @@
             }
             mWindowManager.removeViewImmediate(decorView);
         }
+        // Ensure that we remove the input monitor
+        if (mScreenshotView != null) {
+            mScreenshotView.stopInputListening();
+        }
     }
 
     /**
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java
index a65f98a..ca63ec2 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotView.java
@@ -315,7 +315,7 @@
                 });
     }
 
-    private void stopInputListening() {
+    void stopInputListening() {
         if (mInputMonitor != null) {
             mInputMonitor.dispose();
             mInputMonitor = null;