Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +2 −2 Original line number Diff line number Diff line Loading @@ -255,8 +255,8 @@ public class NotificationShelf extends ActivatableNotificationView { } final float stackBottom = SceneContainerFlag.isEnabled() ? ambientState.getStackTop() + ambientState.getStackHeight() : ambientState.getStackY() + ambientState.getStackHeight(); ? ambientState.getStackTop() + ambientState.getInterpolatedStackHeight() : ambientState.getStackY() + ambientState.getInterpolatedStackHeight(); if (viewState.hidden) { // if the shelf is hidden, position it at the end of the stack (plus the clip Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +9 −7 Original line number Diff line number Diff line Loading @@ -173,7 +173,8 @@ public class AmbientState implements Dumpable { } /** * @return Height of the notifications panel without top padding when expansion completes. * @return Height of the available space for the notification content, when the shade * expansion completes. */ public float getStackEndHeight() { return mStackEndHeight; Loading Loading @@ -276,17 +277,18 @@ public class AmbientState implements Dumpable { } /** * @see #getStackHeight() * @return Height of the notification content returned by {@link #getStackEndHeight()}, but * interpolated by the shade expansion fraction. */ public void setStackHeight(float stackHeight) { mStackHeight = stackHeight; public float getInterpolatedStackHeight() { return mStackHeight; } /** * @return Height of notifications panel interpolated by the expansion fraction. * @see #getInterpolatedStackHeight() */ public float getStackHeight() { return mStackHeight; public void setInterpolatedStackHeight(float stackHeight) { mStackHeight = stackHeight; } @Inject Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +59 −19 Original line number Diff line number Diff line Loading @@ -874,7 +874,7 @@ public class NotificationStackScrollLayout y = (int) (mAmbientState.getStackY()); drawDebugInfo(canvas, y, Color.CYAN, /* label= */ "mAmbientState.getStackY() = " + y); y = (int) (mAmbientState.getStackY() + mAmbientState.getStackHeight()); y = (int) (mAmbientState.getStackY() + mAmbientState.getInterpolatedStackHeight()); drawDebugInfo(canvas, y, Color.LTGRAY, /* label= */ "mAmbientState.getStackY() + mAmbientState.getStackHeight() = " + y); Loading Loading @@ -1123,11 +1123,13 @@ public class NotificationStackScrollLayout @Override public void addStackHeightChangedListener(@NonNull Runnable runnable) { if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return; mStackHeightChangedListeners.addIfAbsent(runnable); } @Override public void removeStackHeightChangedListener(@NonNull Runnable runnable) { if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return; mStackHeightChangedListeners.remove(runnable); } Loading Loading @@ -1233,7 +1235,6 @@ public class NotificationStackScrollLayout if (mAmbientState.getStackTop() != stackTop) { mAmbientState.setStackTop(stackTop); onTopPaddingChanged(/* animate = */ isAddOrRemoveAnimationPending()); setExpandedHeight(mExpandedHeight); } } Loading Loading @@ -1476,7 +1477,7 @@ public class NotificationStackScrollLayout @VisibleForTesting public void updateStackEndHeightAndStackHeight(float fraction) { final float oldStackHeight = mAmbientState.getStackHeight(); final float oldStackHeight = mAmbientState.getInterpolatedStackHeight(); if (SceneContainerFlag.isEnabled()) { final float endHeight; if (!shouldSkipHeightUpdate()) { Loading @@ -1484,20 +1485,20 @@ public class NotificationStackScrollLayout } else { endHeight = mAmbientState.getStackEndHeight(); } updateStackHeight(endHeight, fraction); updateInterpolatedStackHeight(endHeight, fraction); } else { if (mQsExpansionFraction <= 0 && !shouldSkipHeightUpdate()) { final float endHeight = updateStackEndHeight( getHeight(), getEmptyBottomMarginInternal(), getTopPadding()); updateStackHeight(endHeight, fraction); updateInterpolatedStackHeight(endHeight, fraction); } else { // Always updateStackHeight to prevent jumps in the stack height when this fraction // suddenly reapplies after a freeze. final float endHeight = mAmbientState.getStackEndHeight(); updateStackHeight(endHeight, fraction); updateInterpolatedStackHeight(endHeight, fraction); } } if (oldStackHeight != mAmbientState.getStackHeight()) { if (oldStackHeight != mAmbientState.getInterpolatedStackHeight()) { requestChildrenUpdate(); } } Loading Loading @@ -1531,7 +1532,7 @@ public class NotificationStackScrollLayout } @VisibleForTesting public void updateStackHeight(float endHeight, float fraction) { public void updateInterpolatedStackHeight(float endHeight, float fraction) { if (!newAodTransition()) { // During the (AOD<=>LS) transition where dozeAmount is changing, // apply dozeAmount to stack height instead of expansionFraction Loading @@ -1541,7 +1542,7 @@ public class NotificationStackScrollLayout fraction = 1f - dozeAmount; } } mAmbientState.setStackHeight( mAmbientState.setInterpolatedStackHeight( MathUtils.lerp(endHeight * StackScrollAlgorithm.START_FRACTION, endHeight, fraction)); } Loading Loading @@ -1570,8 +1571,11 @@ public class NotificationStackScrollLayout // Update the expand progress between started/stopped events mAmbientState.setExpansionFraction(expandFraction); // TODO(b/332577544): don't convert to height which then converts to the fraction again setExpandedHeight(expandFraction * getHeight()); if (!shouldSkipHeightUpdate()) { updateStackEndHeightAndStackHeight(expandFraction); updateExpandedHeight(expandFraction); } // expansion stopped event requires that the expandFraction has already been updated if (!nowExpanding && wasExpanding) { Loading @@ -1580,6 +1584,19 @@ public class NotificationStackScrollLayout } } private void updateExpandedHeight(float expandFraction) { if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return; float expandedHeight = expandFraction * getHeight(); setIsExpanded(expandedHeight > 0); if (mExpandedHeight != expandedHeight) { mExpandedHeight = expandedHeight; updateAlgorithmHeightAndPadding(); requestChildrenUpdate(); notifyAppearChangedListeners(); } } @Override public void setQsExpandFraction(float expandFraction) { if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return; Loading @@ -1592,6 +1609,7 @@ public class NotificationStackScrollLayout * @param height the expanded height of the panel */ public void setExpandedHeight(float height) { SceneContainerFlag.assertInLegacyMode(); final boolean skipHeightUpdate = shouldSkipHeightUpdate(); updateStackPosition(); Loading Loading @@ -1723,6 +1741,7 @@ public class NotificationStackScrollLayout * Measured relative to the resting position. */ private float getExpandTranslationStart() { SceneContainerFlag.assertInLegacyMode(); return -getTopPadding() + getMinExpansionHeight() - mShelf.getIntrinsicHeight(); } Loading @@ -1731,6 +1750,7 @@ public class NotificationStackScrollLayout * Measured in absolute height. */ private float getAppearStartPosition() { SceneContainerFlag.assertInLegacyMode(); if (isHeadsUpTransition()) { final NotificationSection firstVisibleSection = getFirstVisibleSection(); final int pinnedHeight = firstVisibleSection != null Loading Loading @@ -1786,6 +1806,7 @@ public class NotificationStackScrollLayout * have the shelf on its own) */ private float getAppearEndPosition() { SceneContainerFlag.assertInLegacyMode(); if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { return getAppearEndPositionLegacy(); } Loading Loading @@ -1846,7 +1867,7 @@ public class NotificationStackScrollLayout */ @FloatRange(from = -1.0, to = 1.0) public float calculateAppearFraction(float height) { if (isHeadsUpTransition()) { if (isHeadsUpTransition() && !SceneContainerFlag.isEnabled()) { // HUN is a special case because fraction can go negative if swiping up. And for now // it must go negative as other pieces responsible for proper translation up assume // negative value for HUN going up. Loading Loading @@ -2522,10 +2543,33 @@ public class NotificationStackScrollLayout } @VisibleForTesting void updateContentHeight() { void updateStackHeight() { if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return; final int shelfIntrinsicHeight = mShelf != null ? mShelf.getIntrinsicHeight() : 0; final int footerIntrinsicHeight = mFooterView != null ? mFooterView.getIntrinsicHeight() : 0; final int notificationsHeight = (int) mNotificationStackSizeCalculator.computeHeight( /* notificationStackScrollLayout= */ this, mMaxDisplayedNotifications, shelfIntrinsicHeight ); mIntrinsicContentHeight = notificationsHeight; final int fullStackHeight = notificationsHeight + footerIntrinsicHeight + mBottomPadding; if (mScrollViewFields.getIntrinsicStackHeight() != fullStackHeight) { mScrollViewFields.setIntrinsicStackHeight(fullStackHeight); notifyStackHeightChangedListeners(); } } private void updateContentHeight() { if (SceneContainerFlag.isEnabled()) { updateStackHeight(); return; } final float scrimTopPadding = getScrimTopPaddingOrZero(); final int shelfIntrinsicHeight = mShelf != null ? mShelf.getIntrinsicHeight() : 0; final int footerIntrinsicHeight = mFooterView != null ? mFooterView.getIntrinsicHeight() : 0; final float height = (int) scrimTopPadding + (int) mNotificationStackSizeCalculator.computeHeight( /* notificationStackScrollLayout= */ this, mMaxDisplayedNotifications, Loading @@ -2536,19 +2580,15 @@ public class NotificationStackScrollLayout // state the maxPanelHeight and the contentHeight should be bigger mContentHeight = (int) (height + Math.max(getIntrinsicPadding(), getTopPadding()) + mBottomPadding); mScrollViewFields.setIntrinsicStackHeight( (int) (getIntrinsicPadding() + mIntrinsicContentHeight + footerIntrinsicHeight + mBottomPadding)); updateScrollability(); clampScrollPosition(); updateStackPosition(); mAmbientState.setContentHeight(mContentHeight); notifyStackHeightChangedListeners(); } @Override public int getIntrinsicStackHeight() { if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return 0; return mScrollViewFields.getIntrinsicStackHeight(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +1 −0 Original line number Diff line number Diff line Loading @@ -1408,6 +1408,7 @@ public class NotificationStackScrollLayoutController implements Dumpable { } public float calculateAppearFraction(float height) { SceneContainerFlag.assertInLegacyMode(); return mView.calculateAppearFraction(height); } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +3 −2 Original line number Diff line number Diff line Loading @@ -575,7 +575,8 @@ public class StackScrollAlgorithm { final float shelfHeight = showingShelf ? ambientState.getShelf().getIntrinsicHeight() : 0f; final float scrimPadding = getScrimTopPaddingOrZero(ambientState); final float stackHeight = ambientState.getStackHeight() - shelfHeight - scrimPadding; final float stackHeight = ambientState.getInterpolatedStackHeight() - shelfHeight - scrimPadding; final float stackEndHeight = ambientState.getStackEndHeight() - shelfHeight - scrimPadding; if (stackEndHeight == 0f) { // This should not happen, since even when the shade is empty we show EmptyShadeView Loading Loading @@ -734,7 +735,7 @@ public class StackScrollAlgorithm { || ambientState.getDozeAmount() == 1f || bypassPulseNotExpanding ? ambientState.getInnerHeight() : ambientState.getStackHeight(); : ambientState.getInterpolatedStackHeight(); final float shelfStart = stackBottom - ambientState.getShelf().getIntrinsicHeight() - mPaddingBetweenElements; Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +2 −2 Original line number Diff line number Diff line Loading @@ -255,8 +255,8 @@ public class NotificationShelf extends ActivatableNotificationView { } final float stackBottom = SceneContainerFlag.isEnabled() ? ambientState.getStackTop() + ambientState.getStackHeight() : ambientState.getStackY() + ambientState.getStackHeight(); ? ambientState.getStackTop() + ambientState.getInterpolatedStackHeight() : ambientState.getStackY() + ambientState.getInterpolatedStackHeight(); if (viewState.hidden) { // if the shelf is hidden, position it at the end of the stack (plus the clip Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +9 −7 Original line number Diff line number Diff line Loading @@ -173,7 +173,8 @@ public class AmbientState implements Dumpable { } /** * @return Height of the notifications panel without top padding when expansion completes. * @return Height of the available space for the notification content, when the shade * expansion completes. */ public float getStackEndHeight() { return mStackEndHeight; Loading Loading @@ -276,17 +277,18 @@ public class AmbientState implements Dumpable { } /** * @see #getStackHeight() * @return Height of the notification content returned by {@link #getStackEndHeight()}, but * interpolated by the shade expansion fraction. */ public void setStackHeight(float stackHeight) { mStackHeight = stackHeight; public float getInterpolatedStackHeight() { return mStackHeight; } /** * @return Height of notifications panel interpolated by the expansion fraction. * @see #getInterpolatedStackHeight() */ public float getStackHeight() { return mStackHeight; public void setInterpolatedStackHeight(float stackHeight) { mStackHeight = stackHeight; } @Inject Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +59 −19 Original line number Diff line number Diff line Loading @@ -874,7 +874,7 @@ public class NotificationStackScrollLayout y = (int) (mAmbientState.getStackY()); drawDebugInfo(canvas, y, Color.CYAN, /* label= */ "mAmbientState.getStackY() = " + y); y = (int) (mAmbientState.getStackY() + mAmbientState.getStackHeight()); y = (int) (mAmbientState.getStackY() + mAmbientState.getInterpolatedStackHeight()); drawDebugInfo(canvas, y, Color.LTGRAY, /* label= */ "mAmbientState.getStackY() + mAmbientState.getStackHeight() = " + y); Loading Loading @@ -1123,11 +1123,13 @@ public class NotificationStackScrollLayout @Override public void addStackHeightChangedListener(@NonNull Runnable runnable) { if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return; mStackHeightChangedListeners.addIfAbsent(runnable); } @Override public void removeStackHeightChangedListener(@NonNull Runnable runnable) { if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return; mStackHeightChangedListeners.remove(runnable); } Loading Loading @@ -1233,7 +1235,6 @@ public class NotificationStackScrollLayout if (mAmbientState.getStackTop() != stackTop) { mAmbientState.setStackTop(stackTop); onTopPaddingChanged(/* animate = */ isAddOrRemoveAnimationPending()); setExpandedHeight(mExpandedHeight); } } Loading Loading @@ -1476,7 +1477,7 @@ public class NotificationStackScrollLayout @VisibleForTesting public void updateStackEndHeightAndStackHeight(float fraction) { final float oldStackHeight = mAmbientState.getStackHeight(); final float oldStackHeight = mAmbientState.getInterpolatedStackHeight(); if (SceneContainerFlag.isEnabled()) { final float endHeight; if (!shouldSkipHeightUpdate()) { Loading @@ -1484,20 +1485,20 @@ public class NotificationStackScrollLayout } else { endHeight = mAmbientState.getStackEndHeight(); } updateStackHeight(endHeight, fraction); updateInterpolatedStackHeight(endHeight, fraction); } else { if (mQsExpansionFraction <= 0 && !shouldSkipHeightUpdate()) { final float endHeight = updateStackEndHeight( getHeight(), getEmptyBottomMarginInternal(), getTopPadding()); updateStackHeight(endHeight, fraction); updateInterpolatedStackHeight(endHeight, fraction); } else { // Always updateStackHeight to prevent jumps in the stack height when this fraction // suddenly reapplies after a freeze. final float endHeight = mAmbientState.getStackEndHeight(); updateStackHeight(endHeight, fraction); updateInterpolatedStackHeight(endHeight, fraction); } } if (oldStackHeight != mAmbientState.getStackHeight()) { if (oldStackHeight != mAmbientState.getInterpolatedStackHeight()) { requestChildrenUpdate(); } } Loading Loading @@ -1531,7 +1532,7 @@ public class NotificationStackScrollLayout } @VisibleForTesting public void updateStackHeight(float endHeight, float fraction) { public void updateInterpolatedStackHeight(float endHeight, float fraction) { if (!newAodTransition()) { // During the (AOD<=>LS) transition where dozeAmount is changing, // apply dozeAmount to stack height instead of expansionFraction Loading @@ -1541,7 +1542,7 @@ public class NotificationStackScrollLayout fraction = 1f - dozeAmount; } } mAmbientState.setStackHeight( mAmbientState.setInterpolatedStackHeight( MathUtils.lerp(endHeight * StackScrollAlgorithm.START_FRACTION, endHeight, fraction)); } Loading Loading @@ -1570,8 +1571,11 @@ public class NotificationStackScrollLayout // Update the expand progress between started/stopped events mAmbientState.setExpansionFraction(expandFraction); // TODO(b/332577544): don't convert to height which then converts to the fraction again setExpandedHeight(expandFraction * getHeight()); if (!shouldSkipHeightUpdate()) { updateStackEndHeightAndStackHeight(expandFraction); updateExpandedHeight(expandFraction); } // expansion stopped event requires that the expandFraction has already been updated if (!nowExpanding && wasExpanding) { Loading @@ -1580,6 +1584,19 @@ public class NotificationStackScrollLayout } } private void updateExpandedHeight(float expandFraction) { if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return; float expandedHeight = expandFraction * getHeight(); setIsExpanded(expandedHeight > 0); if (mExpandedHeight != expandedHeight) { mExpandedHeight = expandedHeight; updateAlgorithmHeightAndPadding(); requestChildrenUpdate(); notifyAppearChangedListeners(); } } @Override public void setQsExpandFraction(float expandFraction) { if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return; Loading @@ -1592,6 +1609,7 @@ public class NotificationStackScrollLayout * @param height the expanded height of the panel */ public void setExpandedHeight(float height) { SceneContainerFlag.assertInLegacyMode(); final boolean skipHeightUpdate = shouldSkipHeightUpdate(); updateStackPosition(); Loading Loading @@ -1723,6 +1741,7 @@ public class NotificationStackScrollLayout * Measured relative to the resting position. */ private float getExpandTranslationStart() { SceneContainerFlag.assertInLegacyMode(); return -getTopPadding() + getMinExpansionHeight() - mShelf.getIntrinsicHeight(); } Loading @@ -1731,6 +1750,7 @@ public class NotificationStackScrollLayout * Measured in absolute height. */ private float getAppearStartPosition() { SceneContainerFlag.assertInLegacyMode(); if (isHeadsUpTransition()) { final NotificationSection firstVisibleSection = getFirstVisibleSection(); final int pinnedHeight = firstVisibleSection != null Loading Loading @@ -1786,6 +1806,7 @@ public class NotificationStackScrollLayout * have the shelf on its own) */ private float getAppearEndPosition() { SceneContainerFlag.assertInLegacyMode(); if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { return getAppearEndPositionLegacy(); } Loading Loading @@ -1846,7 +1867,7 @@ public class NotificationStackScrollLayout */ @FloatRange(from = -1.0, to = 1.0) public float calculateAppearFraction(float height) { if (isHeadsUpTransition()) { if (isHeadsUpTransition() && !SceneContainerFlag.isEnabled()) { // HUN is a special case because fraction can go negative if swiping up. And for now // it must go negative as other pieces responsible for proper translation up assume // negative value for HUN going up. Loading Loading @@ -2522,10 +2543,33 @@ public class NotificationStackScrollLayout } @VisibleForTesting void updateContentHeight() { void updateStackHeight() { if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return; final int shelfIntrinsicHeight = mShelf != null ? mShelf.getIntrinsicHeight() : 0; final int footerIntrinsicHeight = mFooterView != null ? mFooterView.getIntrinsicHeight() : 0; final int notificationsHeight = (int) mNotificationStackSizeCalculator.computeHeight( /* notificationStackScrollLayout= */ this, mMaxDisplayedNotifications, shelfIntrinsicHeight ); mIntrinsicContentHeight = notificationsHeight; final int fullStackHeight = notificationsHeight + footerIntrinsicHeight + mBottomPadding; if (mScrollViewFields.getIntrinsicStackHeight() != fullStackHeight) { mScrollViewFields.setIntrinsicStackHeight(fullStackHeight); notifyStackHeightChangedListeners(); } } private void updateContentHeight() { if (SceneContainerFlag.isEnabled()) { updateStackHeight(); return; } final float scrimTopPadding = getScrimTopPaddingOrZero(); final int shelfIntrinsicHeight = mShelf != null ? mShelf.getIntrinsicHeight() : 0; final int footerIntrinsicHeight = mFooterView != null ? mFooterView.getIntrinsicHeight() : 0; final float height = (int) scrimTopPadding + (int) mNotificationStackSizeCalculator.computeHeight( /* notificationStackScrollLayout= */ this, mMaxDisplayedNotifications, Loading @@ -2536,19 +2580,15 @@ public class NotificationStackScrollLayout // state the maxPanelHeight and the contentHeight should be bigger mContentHeight = (int) (height + Math.max(getIntrinsicPadding(), getTopPadding()) + mBottomPadding); mScrollViewFields.setIntrinsicStackHeight( (int) (getIntrinsicPadding() + mIntrinsicContentHeight + footerIntrinsicHeight + mBottomPadding)); updateScrollability(); clampScrollPosition(); updateStackPosition(); mAmbientState.setContentHeight(mContentHeight); notifyStackHeightChangedListeners(); } @Override public int getIntrinsicStackHeight() { if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return 0; return mScrollViewFields.getIntrinsicStackHeight(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +1 −0 Original line number Diff line number Diff line Loading @@ -1408,6 +1408,7 @@ public class NotificationStackScrollLayoutController implements Dumpable { } public float calculateAppearFraction(float height) { SceneContainerFlag.assertInLegacyMode(); return mView.calculateAppearFraction(height); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +3 −2 Original line number Diff line number Diff line Loading @@ -575,7 +575,8 @@ public class StackScrollAlgorithm { final float shelfHeight = showingShelf ? ambientState.getShelf().getIntrinsicHeight() : 0f; final float scrimPadding = getScrimTopPaddingOrZero(ambientState); final float stackHeight = ambientState.getStackHeight() - shelfHeight - scrimPadding; final float stackHeight = ambientState.getInterpolatedStackHeight() - shelfHeight - scrimPadding; final float stackEndHeight = ambientState.getStackEndHeight() - shelfHeight - scrimPadding; if (stackEndHeight == 0f) { // This should not happen, since even when the shade is empty we show EmptyShadeView Loading Loading @@ -734,7 +735,7 @@ public class StackScrollAlgorithm { || ambientState.getDozeAmount() == 1f || bypassPulseNotExpanding ? ambientState.getInnerHeight() : ambientState.getStackHeight(); : ambientState.getInterpolatedStackHeight(); final float shelfStart = stackBottom - ambientState.getShelf().getIntrinsicHeight() - mPaddingBetweenElements; Loading