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