Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt +22 −0 Original line number Diff line number Diff line Loading @@ -1763,6 +1763,28 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { // endregion @Test @EnableSceneContainer fun resetViewStates_hunOverQsOverlay_yTranslationIsHeadsUpTop() { // GIVEN a HUN is visible on the lockscreen and QS is expanded val headsUpTop = 200f fakeHunInShade( headsUpTop = headsUpTop, stackTop = 100f, collapsedHeight = 100, intrinsicHeight = 300, ) ambientState.fakeShowingStackOnLockscreen() ambientState.setApplyHunTranslation(true) ambientState.trackedHeadsUpRow = null // WHEN the view states are reset stackScrollAlgorithm.resetViewStates(ambientState, 0) // THEN the HUN's yTranslation is exactly headsUpTop assertThat(notificationRow.viewState.yTranslation).isEqualTo(headsUpTop) } private fun createHunViewMock( isShadeOpen: Boolean, fullyVisible: Boolean, Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +15 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,21 @@ public class AmbientState implements Dumpable { private boolean mPulsing; private float mHideAmount; private float mPulseHeight = MAX_PULSE_HEIGHT; private boolean mApplyHunTranslation; /** * Sets whether HUN translation should be applied to viewState.yTranslation */ public void setApplyHunTranslation(boolean apply) { mApplyHunTranslation = apply; } /** * @return {@code true} if HUN translation should be applied to viewState.yTranslation */ public boolean shouldApplyHunTranslation() { return mApplyHunTranslation; } /** * The ExpandableNotificationRow that is pulsing, or the one that was pulsing Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +4 −0 Original line number Diff line number Diff line Loading @@ -1687,6 +1687,10 @@ public class NotificationStackScrollLayout clampScrollPosition(); } public void setApplyHunTranslation(boolean apply) { mAmbientState.setApplyHunTranslation(apply); } private void updateForcedScroll() { if (mForcedScroll != null && (!mForcedScroll.hasFocus() || !mForcedScroll.isAttachedToWindow())) { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +4 −0 Original line number Diff line number Diff line Loading @@ -1028,6 +1028,10 @@ public class NotificationStackScrollLayoutController implements Dumpable { mViewBinder.bindWhileAttached(mView, this); } public void setApplyHunTranslation(boolean apply) { mView.setApplyHunTranslation(apply); } private boolean isInVisibleLocation(NotificationEntry entry) { ExpandableNotificationRow row = entry.getRow(); if (row == null) { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +7 −0 Original line number Diff line number Diff line Loading @@ -964,6 +964,13 @@ public class StackScrollAlgorithm { : row.getEntryLegacy().isStickyAndNotDemoted())) { // the height of this child before clamping it to the top float unmodifiedChildHeight = childState.height; // When HUN first shows above QS overlay in dual shade, we need to snap the // HUN to the correct Y position from the placeholder. boolean isHunToShadeTransition = ambientState.getTrackedHeadsUpRow() == row; if (ambientState.shouldApplyHunTranslation() && !isHunToShadeTransition) { childState.setYTranslation(headsUpTranslation); } clampHunToTop( /* headsUpTop = */ headsUpTranslation, /* collapsedHeight = */ row.getCollapsedHeight(), Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt +22 −0 Original line number Diff line number Diff line Loading @@ -1763,6 +1763,28 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { // endregion @Test @EnableSceneContainer fun resetViewStates_hunOverQsOverlay_yTranslationIsHeadsUpTop() { // GIVEN a HUN is visible on the lockscreen and QS is expanded val headsUpTop = 200f fakeHunInShade( headsUpTop = headsUpTop, stackTop = 100f, collapsedHeight = 100, intrinsicHeight = 300, ) ambientState.fakeShowingStackOnLockscreen() ambientState.setApplyHunTranslation(true) ambientState.trackedHeadsUpRow = null // WHEN the view states are reset stackScrollAlgorithm.resetViewStates(ambientState, 0) // THEN the HUN's yTranslation is exactly headsUpTop assertThat(notificationRow.viewState.yTranslation).isEqualTo(headsUpTop) } private fun createHunViewMock( isShadeOpen: Boolean, fullyVisible: Boolean, Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +15 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,21 @@ public class AmbientState implements Dumpable { private boolean mPulsing; private float mHideAmount; private float mPulseHeight = MAX_PULSE_HEIGHT; private boolean mApplyHunTranslation; /** * Sets whether HUN translation should be applied to viewState.yTranslation */ public void setApplyHunTranslation(boolean apply) { mApplyHunTranslation = apply; } /** * @return {@code true} if HUN translation should be applied to viewState.yTranslation */ public boolean shouldApplyHunTranslation() { return mApplyHunTranslation; } /** * The ExpandableNotificationRow that is pulsing, or the one that was pulsing Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +4 −0 Original line number Diff line number Diff line Loading @@ -1687,6 +1687,10 @@ public class NotificationStackScrollLayout clampScrollPosition(); } public void setApplyHunTranslation(boolean apply) { mAmbientState.setApplyHunTranslation(apply); } private void updateForcedScroll() { if (mForcedScroll != null && (!mForcedScroll.hasFocus() || !mForcedScroll.isAttachedToWindow())) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +4 −0 Original line number Diff line number Diff line Loading @@ -1028,6 +1028,10 @@ public class NotificationStackScrollLayoutController implements Dumpable { mViewBinder.bindWhileAttached(mView, this); } public void setApplyHunTranslation(boolean apply) { mView.setApplyHunTranslation(apply); } private boolean isInVisibleLocation(NotificationEntry entry) { ExpandableNotificationRow row = entry.getRow(); if (row == null) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +7 −0 Original line number Diff line number Diff line Loading @@ -964,6 +964,13 @@ public class StackScrollAlgorithm { : row.getEntryLegacy().isStickyAndNotDemoted())) { // the height of this child before clamping it to the top float unmodifiedChildHeight = childState.height; // When HUN first shows above QS overlay in dual shade, we need to snap the // HUN to the correct Y position from the placeholder. boolean isHunToShadeTransition = ambientState.getTrackedHeadsUpRow() == row; if (ambientState.shouldApplyHunTranslation() && !isHunToShadeTransition) { childState.setYTranslation(headsUpTranslation); } clampHunToTop( /* headsUpTop = */ headsUpTranslation, /* collapsedHeight = */ row.getCollapsedHeight(), Loading