Merge "Remove shade peek" into sc-dev am: e7f4edff9a am: a571fc08a4

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14414876

Change-Id: Ic44c4591ab65e922660c63791baa89f62c128b04
This commit is contained in:
Lyn Han
2021-05-04 20:03:13 +00:00
committed by Automerger Merge Worker
7 changed files with 8 additions and 153 deletions

View File

@@ -2438,18 +2438,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
return mTopPaddingOverflow; 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) @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private int clampPadding(int desiredPadding) { private int clampPadding(int desiredPadding) {
return Math.max(desiredPadding, mIntrinsicPadding); return Math.max(desiredPadding, mIntrinsicPadding);

View File

@@ -1061,10 +1061,6 @@ public class NotificationStackScrollLayoutController {
mView.setUnlockHintRunning(running); mView.setUnlockHintRunning(running);
} }
public float getPeekHeight() {
return mView.getPeekHeight();
}
public boolean isFooterViewNotGone() { public boolean isFooterViewNotGone() {
return mView.isFooterViewNotGone(); return mView.isFooterViewNotGone();
} }

View File

@@ -118,7 +118,6 @@ public class HeadsUpTouchHelper implements Gefingerpoken {
mPanel.setPanelScrimMinFraction(maxPanelHeight > 0f mPanel.setPanelScrimMinFraction(maxPanelHeight > 0f
? (float) startHeight / maxPanelHeight : 0f); ? (float) startHeight / maxPanelHeight : 0f);
mPanel.startExpandMotion(x, y, true /* startTracking */, startHeight); mPanel.startExpandMotion(x, y, true /* startTracking */, startHeight);
mPanel.startExpandingFromPeek();
// This call needs to be after the expansion start otherwise we will get a // This call needs to be after the expansion start otherwise we will get a
// flicker of one frame as it's not expanded yet. // flicker of one frame as it's not expanded yet.
mHeadsUpManager.unpinAll(true); mHeadsUpManager.unpinAll(true);

View File

@@ -2830,15 +2830,6 @@ public class NotificationPanelViewController extends PanelViewController {
mNotificationStackScrollLayoutController.setUnlockHintRunning(true); mNotificationStackScrollLayoutController.setUnlockHintRunning(true);
} }
@Override
protected float getPeekHeight() {
if (mNotificationStackScrollLayoutController.getNotGoneChildCount() > 0) {
return mNotificationStackScrollLayoutController.getPeekHeight();
} else {
return mQsMinExpansionHeight;
}
}
@Override @Override
protected boolean shouldUseDismissingAnimation() { protected boolean shouldUseDismissingAnimation() {
return mBarState != StatusBarState.SHADE && (mKeyguardStateController.canDismissLockScreen() return mBarState != StatusBarState.SHADE && (mKeyguardStateController.canDismissLockScreen()

View File

@@ -212,7 +212,6 @@ public abstract class PanelBar extends FrameLayout {
} else { } else {
pv.resetViews(false /* animate */); pv.resetViews(false /* animate */);
pv.setExpandedFraction(0); // just in case pv.setExpandedFraction(0); // just in case
pv.cancelPeek();
} }
if (DEBUG) LOG("collapsePanel: animate=%s waiting=%s", animate, waiting); if (DEBUG) LOG("collapsePanel: animate=%s waiting=%s", animate, waiting);
if (!waiting && mState != STATE_CLOSED) { if (!waiting && mState != STATE_CLOSED) {

View File

@@ -68,8 +68,6 @@ import java.util.ArrayList;
public abstract class PanelViewController { public abstract class PanelViewController {
public static final boolean DEBUG = PanelBar.DEBUG; public static final boolean DEBUG = PanelBar.DEBUG;
public static final String TAG = PanelView.class.getSimpleName(); 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 int NO_FIXED_DURATION = -1;
private static final long SHADE_OPEN_SPRING_OUT_DURATION = 350L; private static final long SHADE_OPEN_SPRING_OUT_DURATION = 350L;
private static final long SHADE_OPEN_SPRING_BACK_DURATION = 200L; private static final long SHADE_OPEN_SPRING_BACK_DURATION = 200L;
@@ -96,7 +94,6 @@ public abstract class PanelViewController {
protected HeadsUpManagerPhone mHeadsUpManager; protected HeadsUpManagerPhone mHeadsUpManager;
protected final StatusBarTouchableRegionManager mStatusBarTouchableRegionManager; protected final StatusBarTouchableRegionManager mStatusBarTouchableRegionManager;
private float mPeekHeight;
private float mHintDistance; private float mHintDistance;
private float mInitialOffsetOnTouch; private float mInitialOffsetOnTouch;
private boolean mCollapsedAndHeadsUpOnDown; private boolean mCollapsedAndHeadsUpOnDown;
@@ -106,8 +103,6 @@ public abstract class PanelViewController {
private boolean mHasLayoutedSinceDown; private boolean mHasLayoutedSinceDown;
private float mUpdateFlingVelocity; private float mUpdateFlingVelocity;
private boolean mUpdateFlingOnLayout; private boolean mUpdateFlingOnLayout;
private boolean mPeekTouching;
private boolean mJustPeeked;
private boolean mClosing; private boolean mClosing;
protected boolean mTracking; protected boolean mTracking;
private boolean mTouchSlopExceeded; private boolean mTouchSlopExceeded;
@@ -125,7 +120,6 @@ public abstract class PanelViewController {
private boolean mHandlingPointerUp; private boolean mHandlingPointerUp;
private ValueAnimator mHeightAnimator; private ValueAnimator mHeightAnimator;
private ObjectAnimator mPeekAnimator;
private final VelocityTracker mVelocityTracker = VelocityTracker.obtain(); private final VelocityTracker mVelocityTracker = VelocityTracker.obtain();
private FlingAnimationUtils mFlingAnimationUtils; private FlingAnimationUtils mFlingAnimationUtils;
private FlingAnimationUtils mFlingAnimationUtilsClosing; 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() { protected AmbientState getAmbientState() {
return mAmbientState; return mAmbientState;
} }
@@ -336,8 +296,6 @@ public abstract class PanelViewController {
} }
private void startOpening(MotionEvent event) { private void startOpening(MotionEvent event) {
runPeekAnimation(INITIAL_OPENING_PEEK_DURATION, getOpeningHeight(),
false /* collapseWhenFinished */);
notifyBarPanelExpansionChanged(); notifyBarPanelExpansionChanged();
maybeVibrateOnOpening(); maybeVibrateOnOpening();
@@ -375,10 +333,6 @@ public abstract class PanelViewController {
return Math.abs(yDiff) >= Math.abs(xDiff); return Math.abs(yDiff) >= Math.abs(xDiff);
} }
protected void startExpandingFromPeek() {
mStatusBar.handlePeekToExpandTransistion();
}
protected void startExpandMotion(float newX, float newY, boolean startTracking, protected void startExpandMotion(float newX, float newY, boolean startTracking,
float expandedHeight) { float expandedHeight) {
if (!mHandlingPointerUp) { if (!mHandlingPointerUp) {
@@ -442,18 +396,6 @@ public abstract class PanelViewController {
if (mUpdateFlingOnLayout) { if (mUpdateFlingOnLayout) {
mUpdateFlingVelocity = vel; 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() } else if (!mStatusBar.isBouncerShowing()
&& !mStatusBarKeyguardViewManager.isShowingAlternateAuthOrAnimating()) { && !mStatusBarKeyguardViewManager.isShowingAlternateAuthOrAnimating()) {
boolean expands = onEmptySpaceClick(mInitialTouchX); boolean expands = onEmptySpaceClick(mInitialTouchX);
@@ -461,7 +403,6 @@ public abstract class PanelViewController {
} }
mVelocityTracker.clear(); mVelocityTracker.clear();
mPeekTouching = false;
} }
protected float getCurrentExpandVelocity() { protected float getCurrentExpandVelocity() {
@@ -582,7 +523,6 @@ public abstract class PanelViewController {
protected void fling(float vel, boolean expand, float collapseSpeedUpFactor, protected void fling(float vel, boolean expand, float collapseSpeedUpFactor,
boolean expandBecauseOfFalsing) { boolean expandBecauseOfFalsing) {
cancelPeek();
float target = expand ? getMaxPanelHeight() : 0; float target = expand ? getMaxPanelHeight() : 0;
if (!expand) { if (!expand) {
mClosing = true; mClosing = true;
@@ -724,10 +664,6 @@ public abstract class PanelViewController {
return; return;
} }
if (mPeekAnimator != null || mPeekTouching) {
return;
}
if (mTracking && !isTrackingBlocked()) { if (mTracking && !isTrackingBlocked()) {
return; return;
} }
@@ -890,20 +826,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) { public void expand(final boolean animate) {
if (!isFullyCollapsed() && !isCollapsing()) { if (!isFullyCollapsed() && !isCollapsing()) {
return; return;
@@ -913,7 +835,6 @@ public abstract class PanelViewController {
mAnimateAfterExpanding = animate; mAnimateAfterExpanding = animate;
mUpdateFlingOnLayout = false; mUpdateFlingOnLayout = false;
abortAnimations(); abortAnimations();
cancelPeek();
if (mTracking) { if (mTracking) {
onTrackingStopped(true /* expands */); // The panel is expanded after this call. onTrackingStopped(true /* expands */); // The panel is expanded after this call.
} }
@@ -964,7 +885,6 @@ public abstract class PanelViewController {
} }
private void abortAnimations() { private void abortAnimations() {
cancelPeek();
cancelHeightAnimator(); cancelHeightAnimator();
mView.removeCallbacks(mPostCollapseRunnable); mView.removeCallbacks(mPostCollapseRunnable);
mView.removeCallbacks(mFlingCollapseRunnable); mView.removeCallbacks(mFlingCollapseRunnable);
@@ -982,7 +902,6 @@ public abstract class PanelViewController {
if (mHeightAnimator != null || mTracking) { if (mHeightAnimator != null || mTracking) {
return; return;
} }
cancelPeek();
notifyExpandingStarted(); notifyExpandingStarted();
startUnlockHintAnimationPhase1(() -> { startUnlockHintAnimationPhase1(() -> {
notifyExpandingFinished(); notifyExpandingFinished();
@@ -1085,7 +1004,7 @@ public abstract class PanelViewController {
if (mBar != null) { if (mBar != null) {
mBar.panelExpansionChanged( mBar.panelExpansionChanged(
mExpandedFraction, mExpandedFraction,
mExpandedFraction > 0f || mPeekAnimator != null || mInstantExpanding mExpandedFraction > 0f || mInstantExpanding
|| isPanelVisibleBecauseOfHeadsUp() || mTracking || isPanelVisibleBecauseOfHeadsUp() || mTracking
|| mHeightAnimator != null); || mHeightAnimator != null);
} }
@@ -1125,19 +1044,16 @@ public abstract class PanelViewController {
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println(String.format("[PanelView(%s): expandedHeight=%f maxPanelHeight=%d closing=%s" 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" + "]", + "touchDisabled=%s" + "]",
this.getClass().getSimpleName(), getExpandedHeight(), getMaxPanelHeight(), this.getClass().getSimpleName(), getExpandedHeight(), getMaxPanelHeight(),
mClosing ? "T" : "f", mTracking ? "T" : "f", mJustPeeked ? "T" : "f", mPeekAnimator, mClosing ? "T" : "f", mTracking ? "T" : "f", mHeightAnimator,
((mPeekAnimator != null && mPeekAnimator.isStarted()) ? " (started)" : ""),
mHeightAnimator,
((mHeightAnimator != null && mHeightAnimator.isStarted()) ? " (started)" : ""), ((mHeightAnimator != null && mHeightAnimator.isStarted()) ? " (started)" : ""),
mTouchDisabled ? "T" : "f")); mTouchDisabled ? "T" : "f"));
} }
public abstract void resetViews(boolean animate); public abstract void resetViews(boolean animate);
protected abstract float getPeekHeight();
/** /**
* @return whether "Clear all" button will be visible when the panel is fully expanded * @return whether "Clear all" button will be visible when the panel is fully expanded
@@ -1212,10 +1128,8 @@ public abstract class PanelViewController {
mAnimatingOnDown = mHeightAnimator != null; mAnimatingOnDown = mHeightAnimator != null;
mMinExpandHeight = 0.0f; mMinExpandHeight = 0.0f;
mDownTime = SystemClock.uptimeMillis(); mDownTime = SystemClock.uptimeMillis();
if (mAnimatingOnDown && mClosing && !mHintAnimationRunning if (mAnimatingOnDown && mClosing && !mHintAnimationRunning) {
|| mPeekAnimator != null) {
cancelHeightAnimator(); cancelHeightAnimator();
cancelPeek();
mTouchSlopExceeded = true; mTouchSlopExceeded = true;
return true; return true;
} }
@@ -1223,7 +1137,6 @@ public abstract class PanelViewController {
mInitialTouchX = x; mInitialTouchX = x;
mTouchStartedInEmptyArea = !isInContentBounds(x, y); mTouchStartedInEmptyArea = !isInContentBounds(x, y);
mTouchSlopExceeded = mTouchSlopExceededBeforeDown; mTouchSlopExceeded = mTouchSlopExceededBeforeDown;
mJustPeeked = false;
mMotionAborted = false; mMotionAborted = false;
mPanelClosedOnDown = isFullyCollapsed(); mPanelClosedOnDown = isFullyCollapsed();
mCollapsedAndHeadsUpOnDown = false; mCollapsedAndHeadsUpOnDown = false;
@@ -1302,8 +1215,6 @@ public abstract class PanelViewController {
* We capture touch events here and update the expand height here in case according to * We capture touch events here and update the expand height here in case according to
* the users fingers. This also handles multi-touch. * 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. * Flinging is also enabled in order to open or close the shade.
*/ */
@@ -1323,25 +1234,22 @@ public abstract class PanelViewController {
switch (event.getActionMasked()) { switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
startExpandMotion(x, y, false /* startTracking */, mExpandedHeight); startExpandMotion(x, y, false /* startTracking */, mExpandedHeight);
mJustPeeked = false;
mMinExpandHeight = 0.0f; mMinExpandHeight = 0.0f;
mPanelClosedOnDown = isFullyCollapsed(); mPanelClosedOnDown = isFullyCollapsed();
mHasLayoutedSinceDown = false; mHasLayoutedSinceDown = false;
mUpdateFlingOnLayout = false; mUpdateFlingOnLayout = false;
mMotionAborted = false; mMotionAborted = false;
mPeekTouching = mPanelClosedOnDown;
mDownTime = SystemClock.uptimeMillis(); mDownTime = SystemClock.uptimeMillis();
mTouchAboveFalsingThreshold = false; mTouchAboveFalsingThreshold = false;
mCollapsedAndHeadsUpOnDown = mCollapsedAndHeadsUpOnDown =
isFullyCollapsed() && mHeadsUpManager.hasPinnedHeadsUp(); isFullyCollapsed() && mHeadsUpManager.hasPinnedHeadsUp();
addMovement(event); addMovement(event);
if (!mGestureWaitForTouchSlop || (mHeightAnimator != null if (!mGestureWaitForTouchSlop || (mHeightAnimator != null
&& !mHintAnimationRunning) || mPeekAnimator != null) { && !mHintAnimationRunning)) {
mTouchSlopExceeded = mTouchSlopExceeded =
(mHeightAnimator != null && !mHintAnimationRunning) (mHeightAnimator != null && !mHintAnimationRunning)
|| mPeekAnimator != null || mTouchSlopExceededBeforeDown; || mTouchSlopExceededBeforeDown;
cancelHeightAnimator(); cancelHeightAnimator();
cancelPeek();
onTrackingStarted(); onTrackingStarted();
} }
if (isFullyCollapsed() && !mHeadsUpManager.hasPinnedHeadsUp() if (isFullyCollapsed() && !mHeadsUpManager.hasPinnedHeadsUp()
@@ -1381,7 +1289,7 @@ public abstract class PanelViewController {
|| mIgnoreXTouchSlop)) { || mIgnoreXTouchSlop)) {
mTouchSlopExceeded = true; mTouchSlopExceeded = true;
if (mGestureWaitForTouchSlop && !mTracking && !mCollapsedAndHeadsUpOnDown) { if (mGestureWaitForTouchSlop && !mTracking && !mCollapsedAndHeadsUpOnDown) {
if (!mJustPeeked && mInitialOffsetOnTouch != 0f) { if (mInitialOffsetOnTouch != 0f) {
startExpandMotion(x, y, false /* startTracking */, mExpandedHeight); startExpandMotion(x, y, false /* startTracking */, mExpandedHeight);
h = 0; h = 0;
} }
@@ -1390,26 +1298,12 @@ public abstract class PanelViewController {
} }
} }
float newHeight = Math.max(0, h + mInitialOffsetOnTouch); 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); newHeight = Math.max(newHeight, mMinExpandHeight);
if (-h >= getFalsingThreshold()) { if (-h >= getFalsingThreshold()) {
mTouchAboveFalsingThreshold = true; mTouchAboveFalsingThreshold = true;
mUpwardsWhenThresholdReached = isDirectionUpwards(x, y); mUpwardsWhenThresholdReached = isDirectionUpwards(x, y);
} }
if (!mJustPeeked && (!mGestureWaitForTouchSlop || mTracking) if ((!mGestureWaitForTouchSlop || mTracking) && !isTrackingBlocked()) {
&& !isTrackingBlocked()) {
setExpandedHeightInternal(newHeight); setExpandedHeightInternal(newHeight);
} }
break; break;

View File

@@ -3094,19 +3094,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 // Visibility reporting
void handleVisibleToUserChangedImpl(boolean visibleToUser) { void handleVisibleToUserChangedImpl(boolean visibleToUser) {
if (visibleToUser) { if (visibleToUser) {
/* The LEDs are turned off when the notification panel is shown, even just a little bit. /* The LEDs are turned off when the notification panel is shown, even just a little bit.