Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +20 −0 Original line number Diff line number Diff line Loading @@ -76,7 +76,10 @@ public class AmbientState { private float mHideAmount; private boolean mAppearing; private float mPulseHeight = MAX_PULSE_HEIGHT; /** How we much we are sleeping. 1f fully dozing (AOD), 0f fully awake (for all other states) */ private float mDozeAmount = 0.0f; private Runnable mOnPulseHeightChangedListener; private ExpandableNotificationRow mTrackedHeadsUpRow; private float mAppearFraction; Loading @@ -96,6 +99,9 @@ public class AmbientState { /** Height of the notifications panel without top padding when expansion completes. */ private float mStackEndHeight; /** Whether we are swiping up. */ private boolean mIsSwipingUp; /** * @return Height of the notifications panel without top padding when expansion completes. */ Loading Loading @@ -132,6 +138,20 @@ public class AmbientState { mExpansionFraction = expansionFraction; } /** * @param isSwipingUp Whether we are swiping up. */ public void setSwipingUp(boolean isSwipingUp) { mIsSwipingUp = isSwipingUp; } /** * @return Whether we are swiping up. */ public boolean isSwipingUp() { return mIsSwipingUp; } /** * @return Fraction of shade expansion. */ Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +42 −17 Original line number Diff line number Diff line Loading @@ -203,6 +203,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private float mQsExpansionFraction; private final int mSplitShadeMinContentHeight; /** Whether we are flinging the shade open or closed. */ private boolean mIsFlinging; /** * The algorithm which calculates the properties for our children */ Loading Loading @@ -1269,6 +1272,16 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable updateStackPosition(false /* listenerNeedsAnimation */); } /** * @return Whether we should skip stack height update for lockscreen swipe-up or unlock hint. */ private boolean shouldSkipHeightUpdate() { // After the user swipes up on lockscreen and lets go, // {@link PanelViewController) flings the shade back down. return mAmbientState.isOnKeyguard() && ( mAmbientState.isUnlockHintRunning() || mAmbientState.isSwipingUp() || mIsFlinging); } /** * Apply expansion fraction to the y position and height of the notifications panel. * @param listenerNeedsAnimation does the listener need to animate? Loading @@ -1283,7 +1296,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable if (mOnStackYChanged != null) { mOnStackYChanged.accept(listenerNeedsAnimation); } if (mQsExpansionFraction <= 0) { if (mQsExpansionFraction <= 0 && !shouldSkipHeightUpdate()) { final float endHeight = updateStackEndHeight( getHeight(), getEmptyBottomMargin(), mTopPadding); updateStackHeight(endHeight, fraction); Loading Loading @@ -1325,10 +1338,14 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable @ShadeViewRefactor(RefactorComponent.COORDINATOR) public void setExpandedHeight(float height) { final float shadeBottom = getHeight() - getEmptyBottomMargin(); final boolean skipHeightUpdate = shouldSkipHeightUpdate(); if (!skipHeightUpdate) { final float expansionFraction = MathUtils.saturate(height / shadeBottom); mAmbientState.setExpansionFraction(expansionFraction); } updateStackPosition(); if (!skipHeightUpdate) { mExpandedHeight = height; setIsExpanded(height > 0); int minExpansionHeight = getMinExpansionHeight(); Loading @@ -1342,6 +1359,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } else { setRequestedClipBounds(null); } } int stackHeight; float translationY; float appearEndPosition = getAppearEndPosition(); Loading @@ -1368,7 +1386,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } } } else { stackHeight = (int) height; stackHeight = (int) (skipHeightUpdate ? mExpandedHeight : height); } } else { appearFraction = calculateAppearFraction(height); Loading @@ -1386,7 +1404,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } } mAmbientState.setAppearFraction(appearFraction); if (stackHeight != mCurrentStackHeight) { if (stackHeight != mCurrentStackHeight && !skipHeightUpdate) { mCurrentStackHeight = stackHeight; updateAlgorithmHeightAndPadding(); requestChildrenUpdate(); Loading Loading @@ -5001,6 +5019,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mAmbientState.setUnlockHintRunning(running); } /** * @param isFlinging Whether we are flinging the shade open or closed. */ public void setIsFlinging(boolean isFlinging) { mIsFlinging = isFlinging; } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void setHeadsUpGoingAwayAnimationsAllowed(boolean headsUpGoingAwayAnimationsAllowed) { mHeadsUpGoingAwayAnimationsAllowed = headsUpGoingAwayAnimationsAllowed; Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +7 −0 Original line number Diff line number Diff line Loading @@ -1195,6 +1195,13 @@ public class NotificationStackScrollLayoutController { mView.setUnlockHintRunning(running); } /** * @param isFlinging Whether we are flinging the shade open or close. */ public void setIsFlinging(boolean isFlinging) { mView.setIsFlinging(isFlinging); } public boolean isFooterViewNotGone() { return mView.isFooterViewNotGone(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +7 −0 Original line number Diff line number Diff line Loading @@ -1885,9 +1885,16 @@ public class NotificationPanelViewController extends PanelViewController mHeadsUpTouchHelper.notifyFling(!expand); mKeyguardStateController.notifyPanelFlingStart(!expand /* flingingToDismiss */); setClosingWithAlphaFadeout(!expand && !isOnKeyguard() && getFadeoutAlpha() == 1.0f); mNotificationStackScrollLayoutController.setIsFlinging(true); super.flingToHeight(vel, expand, target, collapseSpeedUpFactor, expandBecauseOfFalsing); } @Override protected void onFlingEnd(boolean cancelled) { super.onFlingEnd(cancelled); mNotificationStackScrollLayoutController.setIsFlinging(false); } private boolean onQsIntercept(MotionEvent event) { int pointerIndex = event.findPointerIndex(mTrackingPointer); if (pointerIndex < 0) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java +6 −2 Original line number Diff line number Diff line Loading @@ -461,7 +461,7 @@ public abstract class PanelViewController { boolean expands = onEmptySpaceClick(mInitialTouchX); onTrackingStopped(expands); } mAmbientState.setSwipingUp(false); mVelocityTracker.clear(); } Loading Loading @@ -708,7 +708,7 @@ public abstract class PanelViewController { animator.start(); } private void onFlingEnd(boolean cancelled) { void onFlingEnd(boolean cancelled) { mIsFlinging = false; // No overshoot when the animation ends setOverExpansionInternal(0, false /* isFromGesture */); Loading Loading @@ -1393,6 +1393,10 @@ public abstract class PanelViewController { mUpwardsWhenThresholdReached = isDirectionUpwards(x, y); } if ((!mGestureWaitForTouchSlop || mTracking) && !isTrackingBlocked()) { // Count h==0 as part of swipe-up, // otherwise {@link NotificationStackScrollLayout} // wrongly enables stack height updates at the start of lockscreen swipe-up mAmbientState.setSwipingUp(h <= 0); setExpandedHeightInternal(newHeight); } break; Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +20 −0 Original line number Diff line number Diff line Loading @@ -76,7 +76,10 @@ public class AmbientState { private float mHideAmount; private boolean mAppearing; private float mPulseHeight = MAX_PULSE_HEIGHT; /** How we much we are sleeping. 1f fully dozing (AOD), 0f fully awake (for all other states) */ private float mDozeAmount = 0.0f; private Runnable mOnPulseHeightChangedListener; private ExpandableNotificationRow mTrackedHeadsUpRow; private float mAppearFraction; Loading @@ -96,6 +99,9 @@ public class AmbientState { /** Height of the notifications panel without top padding when expansion completes. */ private float mStackEndHeight; /** Whether we are swiping up. */ private boolean mIsSwipingUp; /** * @return Height of the notifications panel without top padding when expansion completes. */ Loading Loading @@ -132,6 +138,20 @@ public class AmbientState { mExpansionFraction = expansionFraction; } /** * @param isSwipingUp Whether we are swiping up. */ public void setSwipingUp(boolean isSwipingUp) { mIsSwipingUp = isSwipingUp; } /** * @return Whether we are swiping up. */ public boolean isSwipingUp() { return mIsSwipingUp; } /** * @return Fraction of shade expansion. */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +42 −17 Original line number Diff line number Diff line Loading @@ -203,6 +203,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private float mQsExpansionFraction; private final int mSplitShadeMinContentHeight; /** Whether we are flinging the shade open or closed. */ private boolean mIsFlinging; /** * The algorithm which calculates the properties for our children */ Loading Loading @@ -1269,6 +1272,16 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable updateStackPosition(false /* listenerNeedsAnimation */); } /** * @return Whether we should skip stack height update for lockscreen swipe-up or unlock hint. */ private boolean shouldSkipHeightUpdate() { // After the user swipes up on lockscreen and lets go, // {@link PanelViewController) flings the shade back down. return mAmbientState.isOnKeyguard() && ( mAmbientState.isUnlockHintRunning() || mAmbientState.isSwipingUp() || mIsFlinging); } /** * Apply expansion fraction to the y position and height of the notifications panel. * @param listenerNeedsAnimation does the listener need to animate? Loading @@ -1283,7 +1296,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable if (mOnStackYChanged != null) { mOnStackYChanged.accept(listenerNeedsAnimation); } if (mQsExpansionFraction <= 0) { if (mQsExpansionFraction <= 0 && !shouldSkipHeightUpdate()) { final float endHeight = updateStackEndHeight( getHeight(), getEmptyBottomMargin(), mTopPadding); updateStackHeight(endHeight, fraction); Loading Loading @@ -1325,10 +1338,14 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable @ShadeViewRefactor(RefactorComponent.COORDINATOR) public void setExpandedHeight(float height) { final float shadeBottom = getHeight() - getEmptyBottomMargin(); final boolean skipHeightUpdate = shouldSkipHeightUpdate(); if (!skipHeightUpdate) { final float expansionFraction = MathUtils.saturate(height / shadeBottom); mAmbientState.setExpansionFraction(expansionFraction); } updateStackPosition(); if (!skipHeightUpdate) { mExpandedHeight = height; setIsExpanded(height > 0); int minExpansionHeight = getMinExpansionHeight(); Loading @@ -1342,6 +1359,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } else { setRequestedClipBounds(null); } } int stackHeight; float translationY; float appearEndPosition = getAppearEndPosition(); Loading @@ -1368,7 +1386,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } } } else { stackHeight = (int) height; stackHeight = (int) (skipHeightUpdate ? mExpandedHeight : height); } } else { appearFraction = calculateAppearFraction(height); Loading @@ -1386,7 +1404,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } } mAmbientState.setAppearFraction(appearFraction); if (stackHeight != mCurrentStackHeight) { if (stackHeight != mCurrentStackHeight && !skipHeightUpdate) { mCurrentStackHeight = stackHeight; updateAlgorithmHeightAndPadding(); requestChildrenUpdate(); Loading Loading @@ -5001,6 +5019,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mAmbientState.setUnlockHintRunning(running); } /** * @param isFlinging Whether we are flinging the shade open or closed. */ public void setIsFlinging(boolean isFlinging) { mIsFlinging = isFlinging; } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void setHeadsUpGoingAwayAnimationsAllowed(boolean headsUpGoingAwayAnimationsAllowed) { mHeadsUpGoingAwayAnimationsAllowed = headsUpGoingAwayAnimationsAllowed; Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +7 −0 Original line number Diff line number Diff line Loading @@ -1195,6 +1195,13 @@ public class NotificationStackScrollLayoutController { mView.setUnlockHintRunning(running); } /** * @param isFlinging Whether we are flinging the shade open or close. */ public void setIsFlinging(boolean isFlinging) { mView.setIsFlinging(isFlinging); } public boolean isFooterViewNotGone() { return mView.isFooterViewNotGone(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +7 −0 Original line number Diff line number Diff line Loading @@ -1885,9 +1885,16 @@ public class NotificationPanelViewController extends PanelViewController mHeadsUpTouchHelper.notifyFling(!expand); mKeyguardStateController.notifyPanelFlingStart(!expand /* flingingToDismiss */); setClosingWithAlphaFadeout(!expand && !isOnKeyguard() && getFadeoutAlpha() == 1.0f); mNotificationStackScrollLayoutController.setIsFlinging(true); super.flingToHeight(vel, expand, target, collapseSpeedUpFactor, expandBecauseOfFalsing); } @Override protected void onFlingEnd(boolean cancelled) { super.onFlingEnd(cancelled); mNotificationStackScrollLayoutController.setIsFlinging(false); } private boolean onQsIntercept(MotionEvent event) { int pointerIndex = event.findPointerIndex(mTrackingPointer); if (pointerIndex < 0) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java +6 −2 Original line number Diff line number Diff line Loading @@ -461,7 +461,7 @@ public abstract class PanelViewController { boolean expands = onEmptySpaceClick(mInitialTouchX); onTrackingStopped(expands); } mAmbientState.setSwipingUp(false); mVelocityTracker.clear(); } Loading Loading @@ -708,7 +708,7 @@ public abstract class PanelViewController { animator.start(); } private void onFlingEnd(boolean cancelled) { void onFlingEnd(boolean cancelled) { mIsFlinging = false; // No overshoot when the animation ends setOverExpansionInternal(0, false /* isFromGesture */); Loading Loading @@ -1393,6 +1393,10 @@ public abstract class PanelViewController { mUpwardsWhenThresholdReached = isDirectionUpwards(x, y); } if ((!mGestureWaitForTouchSlop || mTracking) && !isTrackingBlocked()) { // Count h==0 as part of swipe-up, // otherwise {@link NotificationStackScrollLayout} // wrongly enables stack height updates at the start of lockscreen swipe-up mAmbientState.setSwipingUp(h <= 0); setExpandedHeightInternal(newHeight); } break; Loading