From f84a7285b75ba5b26ef9cac33475a4c680060ab3 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Mon, 3 May 2021 17:31:40 -0500 Subject: [PATCH] Remove shade peek Fixes: 186877166 Test: tap status bar, swipe down - no shade peek Change-Id: Iecf085f085e0d3e08c23ea3a49f4940c7a2f3af9 --- .../stack/NotificationStackScrollLayout.java | 12 -- ...tificationStackScrollLayoutController.java | 4 - .../statusbar/phone/HeadsUpTouchHelper.java | 1 - .../NotificationPanelViewController.java | 9 -- .../systemui/statusbar/phone/PanelBar.java | 1 - .../statusbar/phone/PanelViewController.java | 122 ++---------------- .../systemui/statusbar/phone/StatusBar.java | 12 -- 7 files changed, 8 insertions(+), 153 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index b81619317b95c..c9b05695337c5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -2438,18 +2438,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable return mTopPaddingOverflow; } - @ShadeViewRefactor(RefactorComponent.COORDINATOR) - public int getPeekHeight() { - final ExpandableView firstChild = getFirstChildNotGone(); - final int firstChildMinHeight = firstChild != null ? firstChild.getCollapsedHeight() - : mCollapsedSize; - int shelfHeight = 0; - if (getLastVisibleSection() != null && mShelf.getVisibility() != GONE) { - shelfHeight = mShelf.getIntrinsicHeight(); - } - return mIntrinsicPadding + firstChildMinHeight + shelfHeight; - } - @ShadeViewRefactor(RefactorComponent.COORDINATOR) private int clampPadding(int desiredPadding) { return Math.max(desiredPadding, mIntrinsicPadding); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index b039df3f32af3..f7eb574feac32 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -1061,10 +1061,6 @@ public class NotificationStackScrollLayoutController { mView.setUnlockHintRunning(running); } - public float getPeekHeight() { - return mView.getPeekHeight(); - } - public boolean isFooterViewNotGone() { return mView.isFooterViewNotGone(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java index 0b747f94e935a..42f301d2f2227 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java @@ -118,7 +118,6 @@ public class HeadsUpTouchHelper implements Gefingerpoken { mPanel.setPanelScrimMinFraction(maxPanelHeight > 0f ? (float) startHeight / maxPanelHeight : 0f); mPanel.startExpandMotion(x, y, true /* startTracking */, startHeight); - mPanel.startExpandingFromPeek(); // This call needs to be after the expansion start otherwise we will get a // flicker of one frame as it's not expanded yet. mHeadsUpManager.unpinAll(true); 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 c79e503379bda..9776db3854c4a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -2833,15 +2833,6 @@ public class NotificationPanelViewController extends PanelViewController { mNotificationStackScrollLayoutController.setUnlockHintRunning(true); } - @Override - protected float getPeekHeight() { - if (mNotificationStackScrollLayoutController.getNotGoneChildCount() > 0) { - return mNotificationStackScrollLayoutController.getPeekHeight(); - } else { - return mQsMinExpansionHeight; - } - } - @Override protected boolean shouldUseDismissingAnimation() { return mBarState != StatusBarState.SHADE && (mKeyguardStateController.canDismissLockScreen() diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java index 28cfe214dd3ad..64e2c1c5d268b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java @@ -212,7 +212,6 @@ public abstract class PanelBar extends FrameLayout { } else { pv.resetViews(false /* animate */); pv.setExpandedFraction(0); // just in case - pv.cancelPeek(); } if (DEBUG) LOG("collapsePanel: animate=%s waiting=%s", animate, waiting); if (!waiting && mState != STATE_CLOSED) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java index d0bdf40d1f0b2..de61fa29a29eb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java @@ -68,8 +68,6 @@ import java.util.ArrayList; public abstract class PanelViewController { public static final boolean DEBUG = PanelBar.DEBUG; public static final String TAG = PanelView.class.getSimpleName(); - private static final int INITIAL_OPENING_PEEK_DURATION = 200; - private static final int PEEK_ANIMATION_DURATION = 360; private static final int NO_FIXED_DURATION = -1; private static final long SHADE_OPEN_SPRING_OUT_DURATION = 350L; private static final long SHADE_OPEN_SPRING_BACK_DURATION = 200L; @@ -96,7 +94,6 @@ public abstract class PanelViewController { protected HeadsUpManagerPhone mHeadsUpManager; protected final StatusBarTouchableRegionManager mStatusBarTouchableRegionManager; - private float mPeekHeight; private float mHintDistance; private float mInitialOffsetOnTouch; private boolean mCollapsedAndHeadsUpOnDown; @@ -106,8 +103,6 @@ public abstract class PanelViewController { private boolean mHasLayoutedSinceDown; private float mUpdateFlingVelocity; private boolean mUpdateFlingOnLayout; - private boolean mPeekTouching; - private boolean mJustPeeked; private boolean mClosing; protected boolean mTracking; private boolean mTouchSlopExceeded; @@ -125,7 +120,6 @@ public abstract class PanelViewController { private boolean mHandlingPointerUp; private ValueAnimator mHeightAnimator; - private ObjectAnimator mPeekAnimator; private final VelocityTracker mVelocityTracker = VelocityTracker.obtain(); private FlingAnimationUtils mFlingAnimationUtils; private FlingAnimationUtils mFlingAnimationUtilsClosing; @@ -195,40 +189,6 @@ public abstract class PanelViewController { } } - private void runPeekAnimation(long duration, float peekHeight, boolean collapseWhenFinished) { - mPeekHeight = peekHeight; - if (DEBUG) logf("peek to height=%.1f", mPeekHeight); - if (mHeightAnimator != null) { - return; - } - if (mPeekAnimator != null) { - mPeekAnimator.cancel(); - } - mPeekAnimator = ObjectAnimator.ofFloat(this, "expandedHeight", mPeekHeight).setDuration( - duration); - mPeekAnimator.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN); - mPeekAnimator.addListener(new AnimatorListenerAdapter() { - private boolean mCancelled; - - @Override - public void onAnimationCancel(Animator animation) { - mCancelled = true; - } - - @Override - public void onAnimationEnd(Animator animation) { - mPeekAnimator = null; - if (!mCancelled && collapseWhenFinished) { - mView.postOnAnimation(mPostCollapseRunnable); - } - - } - }); - notifyExpandingStarted(); - mPeekAnimator.start(); - mJustPeeked = true; - } - protected AmbientState getAmbientState() { return mAmbientState; } @@ -336,8 +296,6 @@ public abstract class PanelViewController { } private void startOpening(MotionEvent event) { - runPeekAnimation(INITIAL_OPENING_PEEK_DURATION, getOpeningHeight(), - false /* collapseWhenFinished */); notifyBarPanelExpansionChanged(); maybeVibrateOnOpening(); @@ -375,10 +333,6 @@ public abstract class PanelViewController { return Math.abs(yDiff) >= Math.abs(xDiff); } - protected void startExpandingFromPeek() { - mStatusBar.handlePeekToExpandTransistion(); - } - protected void startExpandMotion(float newX, float newY, boolean startTracking, float expandedHeight) { if (!mHandlingPointerUp) { @@ -442,18 +396,6 @@ public abstract class PanelViewController { if (mUpdateFlingOnLayout) { mUpdateFlingVelocity = vel; } - } else if (mPanelClosedOnDown && !mHeadsUpManager.hasPinnedHeadsUp() && !mTracking - && !mStatusBar.isBouncerShowing() - && !mKeyguardStateController.isKeyguardFadingAway()) { - long timePassed = SystemClock.uptimeMillis() - mDownTime; - if (timePassed < ViewConfiguration.getLongPressTimeout()) { - // Let's show the user that they can actually expand the panel - runPeekAnimation( - PEEK_ANIMATION_DURATION, getPeekHeight(), true /* collapseWhenFinished */); - } else { - // We need to collapse the panel since we peeked to the small height. - mView.postOnAnimation(mPostCollapseRunnable); - } } else if (!mStatusBar.isBouncerShowing() && !mStatusBarKeyguardViewManager.isShowingAlternateAuthOrAnimating()) { boolean expands = onEmptySpaceClick(mInitialTouchX); @@ -461,7 +403,6 @@ public abstract class PanelViewController { } mVelocityTracker.clear(); - mPeekTouching = false; } protected float getCurrentExpandVelocity() { @@ -582,7 +523,6 @@ public abstract class PanelViewController { protected void fling(float vel, boolean expand, float collapseSpeedUpFactor, boolean expandBecauseOfFalsing) { - cancelPeek(); float target = expand ? getMaxPanelHeight() : 0; if (!expand) { mClosing = true; @@ -718,10 +658,6 @@ public abstract class PanelViewController { return; } - if (mPeekAnimator != null || mPeekTouching) { - return; - } - if (mTracking && !isTrackingBlocked()) { return; } @@ -884,20 +820,6 @@ public abstract class PanelViewController { } }; - public void cancelPeek() { - boolean cancelled = false; - if (mPeekAnimator != null) { - cancelled = true; - mPeekAnimator.cancel(); - } - - if (cancelled) { - // When peeking, we already tell mBar that we expanded ourselves. Make sure that we also - // notify mBar that we might have closed ourselves. - notifyBarPanelExpansionChanged(); - } - } - public void expand(final boolean animate) { if (!isFullyCollapsed() && !isCollapsing()) { return; @@ -907,7 +829,6 @@ public abstract class PanelViewController { mAnimateAfterExpanding = animate; mUpdateFlingOnLayout = false; abortAnimations(); - cancelPeek(); if (mTracking) { onTrackingStopped(true /* expands */); // The panel is expanded after this call. } @@ -958,7 +879,6 @@ public abstract class PanelViewController { } private void abortAnimations() { - cancelPeek(); cancelHeightAnimator(); mView.removeCallbacks(mPostCollapseRunnable); mView.removeCallbacks(mFlingCollapseRunnable); @@ -976,7 +896,6 @@ public abstract class PanelViewController { if (mHeightAnimator != null || mTracking) { return; } - cancelPeek(); notifyExpandingStarted(); startUnlockHintAnimationPhase1(() -> { notifyExpandingFinished(); @@ -1079,7 +998,7 @@ public abstract class PanelViewController { if (mBar != null) { mBar.panelExpansionChanged( mExpandedFraction, - mExpandedFraction > 0f || mPeekAnimator != null || mInstantExpanding + mExpandedFraction > 0f || mInstantExpanding || isPanelVisibleBecauseOfHeadsUp() || mTracking || mHeightAnimator != null); } @@ -1119,19 +1038,16 @@ public abstract class PanelViewController { public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println(String.format("[PanelView(%s): expandedHeight=%f maxPanelHeight=%d closing=%s" - + " tracking=%s justPeeked=%s peekAnim=%s%s timeAnim=%s%s " + + " tracking=%s timeAnim=%s%s " + "touchDisabled=%s" + "]", this.getClass().getSimpleName(), getExpandedHeight(), getMaxPanelHeight(), - mClosing ? "T" : "f", mTracking ? "T" : "f", mJustPeeked ? "T" : "f", mPeekAnimator, - ((mPeekAnimator != null && mPeekAnimator.isStarted()) ? " (started)" : ""), - mHeightAnimator, + mClosing ? "T" : "f", mTracking ? "T" : "f", mHeightAnimator, ((mHeightAnimator != null && mHeightAnimator.isStarted()) ? " (started)" : ""), mTouchDisabled ? "T" : "f")); } public abstract void resetViews(boolean animate); - protected abstract float getPeekHeight(); /** * @return whether "Clear all" button will be visible when the panel is fully expanded @@ -1206,10 +1122,8 @@ public abstract class PanelViewController { mAnimatingOnDown = mHeightAnimator != null; mMinExpandHeight = 0.0f; mDownTime = SystemClock.uptimeMillis(); - if (mAnimatingOnDown && mClosing && !mHintAnimationRunning - || mPeekAnimator != null) { + if (mAnimatingOnDown && mClosing && !mHintAnimationRunning) { cancelHeightAnimator(); - cancelPeek(); mTouchSlopExceeded = true; return true; } @@ -1217,7 +1131,6 @@ public abstract class PanelViewController { mInitialTouchX = x; mTouchStartedInEmptyArea = !isInContentBounds(x, y); mTouchSlopExceeded = mTouchSlopExceededBeforeDown; - mJustPeeked = false; mMotionAborted = false; mPanelClosedOnDown = isFullyCollapsed(); mCollapsedAndHeadsUpOnDown = false; @@ -1296,8 +1209,6 @@ public abstract class PanelViewController { * We capture touch events here and update the expand height here in case according to * the users fingers. This also handles multi-touch. * - * If the user just clicks shortly, we show a quick peek of the shade. - * * Flinging is also enabled in order to open or close the shade. */ @@ -1317,25 +1228,22 @@ public abstract class PanelViewController { switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: startExpandMotion(x, y, false /* startTracking */, mExpandedHeight); - mJustPeeked = false; mMinExpandHeight = 0.0f; mPanelClosedOnDown = isFullyCollapsed(); mHasLayoutedSinceDown = false; mUpdateFlingOnLayout = false; mMotionAborted = false; - mPeekTouching = mPanelClosedOnDown; mDownTime = SystemClock.uptimeMillis(); mTouchAboveFalsingThreshold = false; mCollapsedAndHeadsUpOnDown = isFullyCollapsed() && mHeadsUpManager.hasPinnedHeadsUp(); addMovement(event); if (!mGestureWaitForTouchSlop || (mHeightAnimator != null - && !mHintAnimationRunning) || mPeekAnimator != null) { + && !mHintAnimationRunning)) { mTouchSlopExceeded = (mHeightAnimator != null && !mHintAnimationRunning) - || mPeekAnimator != null || mTouchSlopExceededBeforeDown; + || mTouchSlopExceededBeforeDown; cancelHeightAnimator(); - cancelPeek(); onTrackingStarted(); } if (isFullyCollapsed() && !mHeadsUpManager.hasPinnedHeadsUp() @@ -1375,7 +1283,7 @@ public abstract class PanelViewController { || mIgnoreXTouchSlop)) { mTouchSlopExceeded = true; if (mGestureWaitForTouchSlop && !mTracking && !mCollapsedAndHeadsUpOnDown) { - if (!mJustPeeked && mInitialOffsetOnTouch != 0f) { + if (mInitialOffsetOnTouch != 0f) { startExpandMotion(x, y, false /* startTracking */, mExpandedHeight); h = 0; } @@ -1384,26 +1292,12 @@ public abstract class PanelViewController { } } float newHeight = Math.max(0, h + mInitialOffsetOnTouch); - if (newHeight > mPeekHeight) { - if (mPeekAnimator != null) { - mPeekAnimator.cancel(); - } - mJustPeeked = false; - } else if (mPeekAnimator == null && mJustPeeked) { - // The initial peek has finished, but we haven't dragged as far yet, lets - // speed it up by starting at the peek height. - mInitialOffsetOnTouch = mExpandedHeight; - mInitialTouchY = y; - mMinExpandHeight = mExpandedHeight; - mJustPeeked = false; - } newHeight = Math.max(newHeight, mMinExpandHeight); if (-h >= getFalsingThreshold()) { mTouchAboveFalsingThreshold = true; mUpwardsWhenThresholdReached = isDirectionUpwards(x, y); } - if (!mJustPeeked && (!mGestureWaitForTouchSlop || mTracking) - && !isTrackingBlocked()) { + if ((!mGestureWaitForTouchSlop || mTracking) && !isTrackingBlocked()) { setExpandedHeightInternal(newHeight); } break; 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 aaef739af8c44..2d12881cf3b2b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -3095,19 +3095,7 @@ public class StatusBar extends SystemUI implements DemoMode, } } - void handlePeekToExpandTransistion() { - try { - // consider the transition from peek to expanded to be a panel open, - // but not one that clears notification effects. - int notificationLoad = mNotificationsController.getActiveNotificationsCount(); - mBarService.onPanelRevealed(false, notificationLoad); - } catch (RemoteException ex) { - // Won't fail unless the world has ended. - } - } - // Visibility reporting - void handleVisibleToUserChangedImpl(boolean visibleToUser) { if (visibleToUser) { /* The LEDs are turned off when the notification panel is shown, even just a little bit.