Fix Panel View not being able to handle touch when NexusLauncher dies
Bug: 116744159
Test: builds
Also verified by executing following while touching on the device
$ adb shell am force-stop com.google.android.apps.nexuslauncher
Change-Id: I075dc05fbda2cc99573a78fcc239355a59e3a8ac
diff --git a/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java
index 1af2156..d351c4f3 100644
--- a/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java
@@ -17,6 +17,10 @@
package com.android.systemui;
import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
+import static android.view.MotionEvent.ACTION_DOWN;
+import static android.view.MotionEvent.ACTION_UP;
+import static android.view.MotionEvent.ACTION_CANCEL;
+
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_SWIPE_UP;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_SHOW_OVERVIEW_BUTTON;
import static com.android.systemui.shared.system.NavigationBarCompat.InteractionType;
@@ -86,6 +90,7 @@
private boolean mIsEnabled;
private int mCurrentBoundedUserId = -1;
private float mBackButtonAlpha;
+ private MotionEvent mStatusBarGestureDownEvent;
private ISystemUiProxy mSysUiProxy = new ISystemUiProxy.Stub() {
@@ -108,6 +113,9 @@
}
public void onStatusBarMotionEvent(MotionEvent event) {
+ if (!verifyCaller("onStatusBarMotionEvent")) {
+ return;
+ }
long token = Binder.clearCallingIdentity();
try {
// TODO move this logic to message queue
@@ -115,6 +123,16 @@
StatusBar bar = SysUiServiceProvider.getComponent(mContext, StatusBar.class);
if (bar != null) {
bar.dispatchNotificationsPanelTouchEvent(event);
+
+ int action = event.getActionMasked();
+ if (action == ACTION_DOWN) {
+ mStatusBarGestureDownEvent = MotionEvent.obtain(event);
+ }
+ if (action == ACTION_UP || action == ACTION_CANCEL) {
+ mStatusBarGestureDownEvent.recycle();
+ mStatusBarGestureDownEvent = null;
+ }
+ event.recycle();
}
});
} finally {
@@ -298,7 +316,7 @@
// This is the death handler for the binder from the launcher service
private final IBinder.DeathRecipient mOverviewServiceDeathRcpt
- = this::startConnectionToCurrentUser;
+ = this::cleanupAfterDeath;
public OverviewProxyService(Context context) {
mContext = context;
@@ -328,6 +346,22 @@
return mBackButtonAlpha;
}
+ public void cleanupAfterDeath() {
+ if (mStatusBarGestureDownEvent != null) {
+ mHandler.post(()-> {
+ StatusBar bar = SysUiServiceProvider.getComponent(mContext, StatusBar.class);
+ if (bar != null) {
+ System.out.println("MERONG dispatchNotificationPanelTouchEvent");
+ mStatusBarGestureDownEvent.setAction(MotionEvent.ACTION_CANCEL);
+ bar.dispatchNotificationsPanelTouchEvent(mStatusBarGestureDownEvent);
+ mStatusBarGestureDownEvent.recycle();
+ mStatusBarGestureDownEvent = null;
+ }
+ });
+ }
+ startConnectionToCurrentUser();
+ }
+
public void startConnectionToCurrentUser() {
if (mHandler.getLooper() != Looper.myLooper()) {
mHandler.post(mConnectionRunnable);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index c3b87af..90ed97f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -2852,6 +2852,7 @@
}
}
else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
+ mStatusBarWindowController.setNotTouchable(false);
finishBarAnimations();
resetUserExpandedStates();
}