From dea4663fae4fb075c28877d186dc1a70f0569d7f Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Mon, 28 Jun 2021 20:07:33 +0200 Subject: [PATCH] Fixed an issue where the phone would be stuck pulseExpanding During long drags, in combination with face unlock / bypass the phone could get stuck pulseExpanding, especially when the screen was turned off. We now give the pulse expandhelper the touch if it is currently handling the pulse to gracefully reset. Test: expand with a long pulse with bypass, turn off screen, observe not stuck Fixes: 192239213 Change-Id: Ifcb6ce48f9d406843599cc7f8e7edc27f3ad0cd0 --- .../android/systemui/statusbar/PulseExpansionHandler.kt | 5 ++++- .../statusbar/phone/NotificationPanelViewController.java | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt b/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt index 9765ace7179fb..b34bfad499f87 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt @@ -179,7 +179,10 @@ constructor( } override fun onTouchEvent(event: MotionEvent): Boolean { - if (!canHandleMotionEvent()) { + val finishExpanding = (event.action == MotionEvent.ACTION_CANCEL || + event.action == MotionEvent.ACTION_UP) && isExpanding + if (!canHandleMotionEvent() && !finishExpanding) { + // We allow cancellations/finishing to still go through here to clean up the state return false } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index 5d31786dd6389..8c1d642a21cd7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -3821,8 +3821,13 @@ public class NotificationPanelViewController extends PanelViewController { expand(true /* animate */); } initDownStates(event); - if (!mIsExpanding && !shouldQuickSettingsIntercept(mDownX, mDownY, 0) - && mPulseExpansionHandler.onTouchEvent(event)) { + + // If pulse is expanding already, let's give it the touch. There are situations + // where the panel starts expanding even though we're also pulsing + boolean pulseShouldGetTouch = (!mIsExpanding + && !shouldQuickSettingsIntercept(mDownX, mDownY, 0)) + || mPulseExpansionHandler.isExpanding(); + if (pulseShouldGetTouch && mPulseExpansionHandler.onTouchEvent(event)) { // We're expanding all the other ones shouldn't get this anymore return true; }