diff options
3 files changed, 35 insertions, 24 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java index 6a2c60276186..a16129b076f8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java @@ -511,10 +511,12 @@ public class AmbientState implements Dumpable { } public int getTopPadding() { + SceneContainerFlag.assertInLegacyMode(); return mTopPadding; } public void setTopPadding(int topPadding) { + SceneContainerFlag.assertInLegacyMode(); mTopPadding = topPadding; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index f26f8405e299..f464ef1df301 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -851,7 +851,7 @@ public class NotificationStackScrollLayout return; // the rest of the fields are not important in Flexiglass } - y = getTopPadding(); + y = mAmbientState.getTopPadding(); drawDebugInfo(canvas, y, Color.RED, /* label= */ "getTopPadding() = " + y); y = getLayoutHeight(); @@ -1231,9 +1231,11 @@ public class NotificationStackScrollLayout @Override public void setStackTop(float stackTop) { - mAmbientState.setStackTop(stackTop); - // TODO(b/332574413): replace the following with using stackTop - updateTopPadding(stackTop, isAddOrRemoveAnimationPending()); + if (mAmbientState.getStackTop() != stackTop) { + mAmbientState.setStackTop(stackTop); + onTopPaddingChanged(/* animate = */ isAddOrRemoveAnimationPending()); + setExpandedHeight(mExpandedHeight); + } } @Override @@ -1386,28 +1388,30 @@ public class NotificationStackScrollLayout } public int getTopPadding() { - return mAmbientState.getTopPadding(); + // TODO(b/332574413) replace all usages of getTopPadding() + if (SceneContainerFlag.isEnabled()) { + return (int) mAmbientState.getStackTop(); + } else { + return mAmbientState.getTopPadding(); + } } - private void setTopPadding(int topPadding, boolean animate) { - if (getTopPadding() != topPadding) { - mAmbientState.setTopPadding(topPadding); - boolean shouldAnimate = animate || mAnimateNextTopPaddingChange; - updateAlgorithmHeightAndPadding(); - updateContentHeight(); - if (mAmbientState.isOnKeyguard() - && !mShouldUseSplitNotificationShade - && mShouldSkipTopPaddingAnimationAfterFold) { - mShouldSkipTopPaddingAnimationAfterFold = false; - } else if (shouldAnimate && mAnimationsEnabled && mIsExpanded) { - mTopPaddingNeedsAnimation = true; - mNeedsAnimation = true; - } - updateStackPosition(); - requestChildrenUpdate(); - notifyHeightChangeListener(null, shouldAnimate); - mAnimateNextTopPaddingChange = false; + private void onTopPaddingChanged(boolean animate) { + boolean shouldAnimate = animate || mAnimateNextTopPaddingChange; + updateAlgorithmHeightAndPadding(); + updateContentHeight(); + if (mAmbientState.isOnKeyguard() + && !mShouldUseSplitNotificationShade + && mShouldSkipTopPaddingAnimationAfterFold) { + mShouldSkipTopPaddingAnimationAfterFold = false; + } else if (shouldAnimate && mAnimationsEnabled && mIsExpanded) { + mTopPaddingNeedsAnimation = true; + mNeedsAnimation = true; } + updateStackPosition(); + requestChildrenUpdate(); + notifyHeightChangeListener(null, shouldAnimate); + mAnimateNextTopPaddingChange = false; } /** @@ -2708,6 +2712,7 @@ public class NotificationStackScrollLayout * @param animate whether to animate the change */ public void updateTopPadding(float qsHeight, boolean animate) { + SceneContainerFlag.assertInLegacyMode(); int topPadding = (int) qsHeight; int minStackHeight = getLayoutMinHeightInternal(); if (topPadding + minStackHeight > getHeight()) { @@ -2715,7 +2720,10 @@ public class NotificationStackScrollLayout } else { mTopPaddingOverflow = 0; } - setTopPadding(topPadding, animate && !mKeyguardBypassEnabled); + if (mAmbientState.getTopPadding() != topPadding) { + mAmbientState.setTopPadding(topPadding); + onTopPaddingChanged(/* animate = */ animate && !mKeyguardBypassEnabled); + } setExpandedHeight(mExpandedHeight); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index 55f05662f0c6..bfffbeda2e7a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -1328,6 +1328,7 @@ public class NotificationStackScrollLayoutController implements Dumpable { } public int getTopPadding() { + SceneContainerFlag.assertInLegacyMode(); return mView.getTopPadding(); } |