From e53315ec9cece18880f1a7fbc39acdabb83c7618 Mon Sep 17 00:00:00 2001 From: Shawn Lee Date: Tue, 7 Mar 2023 17:25:46 -0800 Subject: Prevent flings after motion gestures on fully expanded keyguard Any up-down gesture on keyguard would trigger a fling that visibly jumped the keyguard up due to the different height calculation for shade vs keyguard. If the gesture was quick enough, we were stuck with this incorrect expansion fraction until the next touch. This change simply blocks flings on keyguard off guestures that end at full expansion. Test: manual Bug: 259023628 Change-Id: Id67c0e38cc28a13fd19d23bdd0b6bff31cf1fe30 --- .../systemui/shade/NotificationPanelViewController.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 6b2d7443392d..fdaeeee26812 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -3508,12 +3508,15 @@ public final class NotificationPanelViewController implements Dumpable { } private void endMotionEvent(MotionEvent event, float x, float y, boolean forceCancel) { + // don't fling while in keyguard to avoid jump in shade expand animation + boolean fullyExpandedInKeyguard = mBarState == KEYGUARD && mExpandedFraction >= 1.0; mTrackingPointer = -1; mAmbientState.setSwipingUp(false); - if ((mTracking && mTouchSlopExceeded) || Math.abs(x - mInitialExpandX) > mTouchSlop + if (!fullyExpandedInKeyguard && ((mTracking && mTouchSlopExceeded) + || Math.abs(x - mInitialExpandX) > mTouchSlop || Math.abs(y - mInitialExpandY) > mTouchSlop || (!isFullyExpanded() && !isFullyCollapsed()) - || event.getActionMasked() == MotionEvent.ACTION_CANCEL || forceCancel) { + || event.getActionMasked() == MotionEvent.ACTION_CANCEL || forceCancel)) { mVelocityTracker.computeCurrentVelocity(1000); float vel = mVelocityTracker.getYVelocity(); float vectorVel = (float) Math.hypot( @@ -3561,9 +3564,9 @@ public final class NotificationPanelViewController implements Dumpable { if (mUpdateFlingOnLayout) { mUpdateFlingVelocity = vel; } - } else if (!mCentralSurfaces.isBouncerShowing() + } else if (fullyExpandedInKeyguard || (!mCentralSurfaces.isBouncerShowing() && !mAlternateBouncerInteractor.isVisibleState() - && !mKeyguardStateController.isKeyguardGoingAway()) { + && !mKeyguardStateController.isKeyguardGoingAway())) { onEmptySpaceClick(); onTrackingStopped(true); } -- cgit v1.2.3-59-g8ed1b