From 16dc6c68f791aa966fe66d13a8b5fbbe9308b876 Mon Sep 17 00:00:00 2001 From: Shawn Lee Date: Mon, 21 Nov 2022 12:33:39 -0800 Subject: [PATCH] Fixed animation breakage when QS area tapped during expand/collapse - shade would instantly expand when QQS area was tapped while shade collapsing; now the touch interrupts the collapse and the user can move shade around, and shade will close/expand on release as normal - same problem fixed for collapsing shade from full QS - fixed QS flickering then instantly expanding when tapped while collapsing to QQS - new behavior is the same as above - fixed choppiness when swiping to expand QS while it is collapsing to QQS Bug: 258327447 Test: manual Change-Id: Iab34b807685bab6a4206708f0e75aa05a3ab36f3 --- .../shade/NotificationPanelViewController.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index e68182ef85c9c..629d3d4d50ba8 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -2072,6 +2072,13 @@ public final class NotificationPanelViewController implements Dumpable { mInitialTouchX = x; initVelocityTracker(); trackMovement(event); + float qsExpansionFraction = computeQsExpansionFraction(); + // Intercept the touch if QS is between fully collapsed and fully expanded state + if (qsExpansionFraction > 0.0 && qsExpansionFraction < 1.0) { + mShadeLog.logMotionEvent(event, + "onQsIntercept: down action, QS partially expanded/collapsed"); + return true; + } if (mKeyguardShowing && shouldQuickSettingsIntercept(mInitialTouchX, mInitialTouchY, 0)) { // Dragging down on the lockscreen statusbar should prohibit other interactions @@ -2324,6 +2331,13 @@ public final class NotificationPanelViewController implements Dumpable { if (!isFullyCollapsed()) { handleQsDown(event); } + // defer touches on QQS to shade while shade is collapsing. Added margin for error + // as sometimes the qsExpansionFraction can be a tiny value instead of 0 when in QQS. + if (computeQsExpansionFraction() <= 0.01 && getExpandedFraction() < 1.0) { + mShadeLog.logMotionEvent(event, + "handleQsTouch: QQS touched while shade collapsing"); + mQsTracking = false; + } if (!mQsExpandImmediate && mQsTracking) { onQsTouch(event); if (!mConflictingQsExpansionGesture && !mSplitShadeEnabled) { @@ -2564,7 +2578,6 @@ public final class NotificationPanelViewController implements Dumpable { // Reset scroll position and apply that position to the expanded height. float height = mQsExpansionHeight; setQsExpansionHeight(height); - updateExpandedHeightToMaxHeight(); mNotificationStackScrollLayoutController.checkSnoozeLeavebehind(); // When expanding QS, let's authenticate the user if possible,