diff options
author | Hyunyoung Song <hyunyoungs@google.com> | 2018-10-04 16:32:23 -0700 |
---|---|---|
committer | Hyunyoung Song <hyunyoungs@google.com> | 2018-10-04 16:44:42 -0700 |
commit | 547e11e85faebd52c768f5b4c6f8579b6d2db8dd (patch) | |
tree | 9084681f451184c20ac95bcfa14a7f47b319d4a8 /packages/SystemUI/src/com/android/systemui/OverviewProxyService.java | |
parent | 8ad9ef4aa9ac29823b17c67b343da4e96efcbb1a (diff) |
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
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/OverviewProxyService.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/OverviewProxyService.java | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java index 1af2156c4bbe..d351c4f3e3e6 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 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis private boolean mIsEnabled; private int mCurrentBoundedUserId = -1; private float mBackButtonAlpha; + private MotionEvent mStatusBarGestureDownEvent; private ISystemUiProxy mSysUiProxy = new ISystemUiProxy.Stub() { @@ -108,6 +113,9 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis } 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 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis 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 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis // 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 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis 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); |