Merge "Remove shade peek" into sc-dev am: e7f4edff9a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14414876 Change-Id: I520f2f5ba5974588fcda8f7f30d71523beb6a168
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -1061,10 +1061,6 @@ public class NotificationStackScrollLayoutController {
|
||||
mView.setUnlockHintRunning(running);
|
||||
}
|
||||
|
||||
public float getPeekHeight() {
|
||||
return mView.getPeekHeight();
|
||||
}
|
||||
|
||||
public boolean isFooterViewNotGone() {
|
||||
return mView.isFooterViewNotGone();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -2830,15 +2830,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()
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
@@ -724,10 +664,6 @@ public abstract class PanelViewController {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mPeekAnimator != null || mPeekTouching) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mTracking && !isTrackingBlocked()) {
|
||||
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) {
|
||||
if (!isFullyCollapsed() && !isCollapsing()) {
|
||||
return;
|
||||
@@ -913,7 +835,6 @@ public abstract class PanelViewController {
|
||||
mAnimateAfterExpanding = animate;
|
||||
mUpdateFlingOnLayout = false;
|
||||
abortAnimations();
|
||||
cancelPeek();
|
||||
if (mTracking) {
|
||||
onTrackingStopped(true /* expands */); // The panel is expanded after this call.
|
||||
}
|
||||
@@ -964,7 +885,6 @@ public abstract class PanelViewController {
|
||||
}
|
||||
|
||||
private void abortAnimations() {
|
||||
cancelPeek();
|
||||
cancelHeightAnimator();
|
||||
mView.removeCallbacks(mPostCollapseRunnable);
|
||||
mView.removeCallbacks(mFlingCollapseRunnable);
|
||||
@@ -982,7 +902,6 @@ public abstract class PanelViewController {
|
||||
if (mHeightAnimator != null || mTracking) {
|
||||
return;
|
||||
}
|
||||
cancelPeek();
|
||||
notifyExpandingStarted();
|
||||
startUnlockHintAnimationPhase1(() -> {
|
||||
notifyExpandingFinished();
|
||||
@@ -1085,7 +1004,7 @@ public abstract class PanelViewController {
|
||||
if (mBar != null) {
|
||||
mBar.panelExpansionChanged(
|
||||
mExpandedFraction,
|
||||
mExpandedFraction > 0f || mPeekAnimator != null || mInstantExpanding
|
||||
mExpandedFraction > 0f || mInstantExpanding
|
||||
|| isPanelVisibleBecauseOfHeadsUp() || mTracking
|
||||
|| mHeightAnimator != null);
|
||||
}
|
||||
@@ -1125,19 +1044,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
|
||||
@@ -1212,10 +1128,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;
|
||||
}
|
||||
@@ -1223,7 +1137,6 @@ public abstract class PanelViewController {
|
||||
mInitialTouchX = x;
|
||||
mTouchStartedInEmptyArea = !isInContentBounds(x, y);
|
||||
mTouchSlopExceeded = mTouchSlopExceededBeforeDown;
|
||||
mJustPeeked = false;
|
||||
mMotionAborted = false;
|
||||
mPanelClosedOnDown = isFullyCollapsed();
|
||||
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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -1323,25 +1234,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()
|
||||
@@ -1381,7 +1289,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;
|
||||
}
|
||||
@@ -1390,26 +1298,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;
|
||||
|
||||
@@ -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
|
||||
|
||||
void handleVisibleToUserChangedImpl(boolean visibleToUser) {
|
||||
if (visibleToUser) {
|
||||
/* The LEDs are turned off when the notification panel is shown, even just a little bit.
|
||||
|
||||
Reference in New Issue
Block a user