Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.kt +3 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.statusbar.policy import android.content.Context import android.os.Handler import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.FlagsParameterization import android.testing.TestableLooper.RunWithLooper import androidx.test.filters.SmallTest Loading Loading @@ -239,6 +240,7 @@ class HeadsUpManagerPhoneTest(flags: FlagsParameterization) : BaseHeadsUpManager } @Test @EnableFlags(NotificationThrottleHun.FLAG_NAME) fun testShowNotification_reorderNotAllowed_notPulsing_seenInShadeTrue() { whenever(mVSProvider.isReorderingAllowed).thenReturn(false) val hmp = createHeadsUpManagerPhone() Loading @@ -253,6 +255,7 @@ class HeadsUpManagerPhoneTest(flags: FlagsParameterization) : BaseHeadsUpManager } @Test @EnableFlags(NotificationThrottleHun.FLAG_NAME) fun testShowNotification_reorderAllowed_notPulsing_seenInShadeFalse() { whenever(mVSProvider.isReorderingAllowed).thenReturn(true) val hmp = createHeadsUpManagerPhone() Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProvider.kt +2 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package com.android.systemui.statusbar.notification.collection.provider import android.util.ArraySet import com.android.systemui.dagger.SysUISingleton import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun import com.android.systemui.util.ListenerSet import javax.inject.Inject Loading @@ -21,7 +22,7 @@ class VisualStabilityProvider @Inject constructor() { field = value if (value) { notifyReorderingAllowed() } else { } else if (NotificationThrottleHun.isEnabled){ banListeners.forEach { listener -> listener.onReorderingBanned() } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +8 −4 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.ExpandableView; import com.android.systemui.statusbar.notification.row.StackScrollerDecorView; import com.android.systemui.statusbar.notification.shared.NotificationHeadsUpCycling; import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun; import com.android.systemui.statusbar.notification.shared.NotificationsHeadsUpRefactor; import com.android.systemui.statusbar.notification.shared.NotificationsImprovedHunAnimation; import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor; Loading Loading @@ -4862,10 +4863,13 @@ public class NotificationStackScrollLayout * @param isHeadsUp true for appear, false for disappear animations */ public void generateHeadsUpAnimation(ExpandableNotificationRow row, boolean isHeadsUp) { boolean addAnimation = mAnimationsEnabled && (isHeadsUp || mHeadsUpGoingAwayAnimationsAllowed); if (NotificationThrottleHun.isEnabled()) { final boolean closedAndSeenInShade = !mIsExpanded && row.getEntry() != null && row.getEntry().isSeenInShade(); final boolean addAnimation = mAnimationsEnabled && !closedAndSeenInShade && (isHeadsUp || mHeadsUpGoingAwayAnimationsAllowed); addAnimation = addAnimation && !closedAndSeenInShade; } if (SPEW) { Log.v(TAG, "generateHeadsUpAnimation:" + " addAnimation=" + addAnimation Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java +32 −11 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import com.android.systemui.statusbar.notification.collection.render.GroupMember import com.android.systemui.statusbar.notification.data.repository.HeadsUpRepository; import com.android.systemui.statusbar.notification.data.repository.HeadsUpRowRepository; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun; import com.android.systemui.statusbar.notification.shared.NotificationsHeadsUpRefactor; import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper; import com.android.systemui.statusbar.policy.AnimationStateHandler; Loading Loading @@ -174,10 +175,13 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements }); javaAdapter.alwaysCollectFlow(shadeInteractor.isAnyExpanded(), this::onShadeOrQsExpanded); mVisualStabilityProvider.addPersistentReorderingBannedListener(mOnReorderingBannedListener); if (NotificationThrottleHun.isEnabled()) { mVisualStabilityProvider.addPersistentReorderingBannedListener( mOnReorderingBannedListener); mVisualStabilityProvider.addPersistentReorderingAllowedListener( mOnReorderingAllowedListener); } } public void setAnimationStateHandler(AnimationStateHandler handler) { mAnimationStateHandler = handler; Loading Loading @@ -383,7 +387,9 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements private final OnReorderingAllowedListener mOnReorderingAllowedListener = () -> { mAnimationStateHandler.setHeadsUpGoingAwayAnimationsAllowed(false); if (NotificationThrottleHun.isEnabled()) { mAvalancheController.setEnableAtRuntime(true); } for (NotificationEntry entry : mEntriesToRemoveWhenReorderingAllowed) { if (isHeadsUpEntry(entry.getKey())) { // Maybe the heads-up was removed already Loading Loading @@ -586,6 +592,7 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements @androidx.annotation.Nullable Runnable removeRunnable) { super.setEntry(entry, removeRunnable); if (NotificationThrottleHun.isEnabled()) { if (!mVisualStabilityProvider.isReorderingAllowed() // We don't want to allow reordering while pulsing, but headsup need to // time out anyway Loading @@ -594,11 +601,20 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements entry.setSeenInShade(true); } } } @Override protected Runnable createRemoveRunnable(NotificationEntry entry) { return () -> { if (mTrackingHeadsUp) { if (!NotificationThrottleHun.isEnabled() && !mVisualStabilityProvider.isReorderingAllowed() // We don't want to allow reordering while pulsing, but headsup need to // time out anyway && !entry.showingPulsing()) { mEntriesToRemoveWhenReorderingAllowed.add(entry); mVisualStabilityProvider.addTemporaryReorderingAllowedListener( mOnReorderingAllowedListener); } else if (mTrackingHeadsUp) { mEntriesToRemoveAfterExpand.add(entry); } else if (mVisualStabilityProvider.isReorderingAllowed() || entry.showingPulsing()) { Loading @@ -614,6 +630,11 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements if (mEntriesToRemoveAfterExpand.contains(mEntry)) { mEntriesToRemoveAfterExpand.remove(mEntry); } if (!NotificationThrottleHun.isEnabled()) { if (mEntriesToRemoveWhenReorderingAllowed.contains(mEntry)) { mEntriesToRemoveWhenReorderingAllowed.remove(mEntry); } } } @Override Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ import com.android.systemui.statusbar.notification.footer.shared.FooterViewRefac import com.android.systemui.statusbar.notification.footer.ui.view.FooterView; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableView; import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun; import com.android.systemui.statusbar.notification.shared.NotificationsHeadsUpRefactor; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.ScreenOffAnimationController; Loading Loading @@ -1196,7 +1197,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { } @Test @EnableFlags(NotificationsHeadsUpRefactor.FLAG_NAME) @EnableFlags(NotificationThrottleHun.FLAG_NAME) public void testGenerateHeadsUpAnimation_isSeenInShade_noAnimation() { // GIVEN NSSL is ready for HUN animations Consumer<Boolean> headsUpAnimatingAwayListener = mock(BooleanConsumer.class); Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.kt +3 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.statusbar.policy import android.content.Context import android.os.Handler import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.FlagsParameterization import android.testing.TestableLooper.RunWithLooper import androidx.test.filters.SmallTest Loading Loading @@ -239,6 +240,7 @@ class HeadsUpManagerPhoneTest(flags: FlagsParameterization) : BaseHeadsUpManager } @Test @EnableFlags(NotificationThrottleHun.FLAG_NAME) fun testShowNotification_reorderNotAllowed_notPulsing_seenInShadeTrue() { whenever(mVSProvider.isReorderingAllowed).thenReturn(false) val hmp = createHeadsUpManagerPhone() Loading @@ -253,6 +255,7 @@ class HeadsUpManagerPhoneTest(flags: FlagsParameterization) : BaseHeadsUpManager } @Test @EnableFlags(NotificationThrottleHun.FLAG_NAME) fun testShowNotification_reorderAllowed_notPulsing_seenInShadeFalse() { whenever(mVSProvider.isReorderingAllowed).thenReturn(true) val hmp = createHeadsUpManagerPhone() Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProvider.kt +2 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package com.android.systemui.statusbar.notification.collection.provider import android.util.ArraySet import com.android.systemui.dagger.SysUISingleton import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun import com.android.systemui.util.ListenerSet import javax.inject.Inject Loading @@ -21,7 +22,7 @@ class VisualStabilityProvider @Inject constructor() { field = value if (value) { notifyReorderingAllowed() } else { } else if (NotificationThrottleHun.isEnabled){ banListeners.forEach { listener -> listener.onReorderingBanned() } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +8 −4 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.ExpandableView; import com.android.systemui.statusbar.notification.row.StackScrollerDecorView; import com.android.systemui.statusbar.notification.shared.NotificationHeadsUpCycling; import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun; import com.android.systemui.statusbar.notification.shared.NotificationsHeadsUpRefactor; import com.android.systemui.statusbar.notification.shared.NotificationsImprovedHunAnimation; import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor; Loading Loading @@ -4862,10 +4863,13 @@ public class NotificationStackScrollLayout * @param isHeadsUp true for appear, false for disappear animations */ public void generateHeadsUpAnimation(ExpandableNotificationRow row, boolean isHeadsUp) { boolean addAnimation = mAnimationsEnabled && (isHeadsUp || mHeadsUpGoingAwayAnimationsAllowed); if (NotificationThrottleHun.isEnabled()) { final boolean closedAndSeenInShade = !mIsExpanded && row.getEntry() != null && row.getEntry().isSeenInShade(); final boolean addAnimation = mAnimationsEnabled && !closedAndSeenInShade && (isHeadsUp || mHeadsUpGoingAwayAnimationsAllowed); addAnimation = addAnimation && !closedAndSeenInShade; } if (SPEW) { Log.v(TAG, "generateHeadsUpAnimation:" + " addAnimation=" + addAnimation Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java +32 −11 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import com.android.systemui.statusbar.notification.collection.render.GroupMember import com.android.systemui.statusbar.notification.data.repository.HeadsUpRepository; import com.android.systemui.statusbar.notification.data.repository.HeadsUpRowRepository; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun; import com.android.systemui.statusbar.notification.shared.NotificationsHeadsUpRefactor; import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper; import com.android.systemui.statusbar.policy.AnimationStateHandler; Loading Loading @@ -174,10 +175,13 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements }); javaAdapter.alwaysCollectFlow(shadeInteractor.isAnyExpanded(), this::onShadeOrQsExpanded); mVisualStabilityProvider.addPersistentReorderingBannedListener(mOnReorderingBannedListener); if (NotificationThrottleHun.isEnabled()) { mVisualStabilityProvider.addPersistentReorderingBannedListener( mOnReorderingBannedListener); mVisualStabilityProvider.addPersistentReorderingAllowedListener( mOnReorderingAllowedListener); } } public void setAnimationStateHandler(AnimationStateHandler handler) { mAnimationStateHandler = handler; Loading Loading @@ -383,7 +387,9 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements private final OnReorderingAllowedListener mOnReorderingAllowedListener = () -> { mAnimationStateHandler.setHeadsUpGoingAwayAnimationsAllowed(false); if (NotificationThrottleHun.isEnabled()) { mAvalancheController.setEnableAtRuntime(true); } for (NotificationEntry entry : mEntriesToRemoveWhenReorderingAllowed) { if (isHeadsUpEntry(entry.getKey())) { // Maybe the heads-up was removed already Loading Loading @@ -586,6 +592,7 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements @androidx.annotation.Nullable Runnable removeRunnable) { super.setEntry(entry, removeRunnable); if (NotificationThrottleHun.isEnabled()) { if (!mVisualStabilityProvider.isReorderingAllowed() // We don't want to allow reordering while pulsing, but headsup need to // time out anyway Loading @@ -594,11 +601,20 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements entry.setSeenInShade(true); } } } @Override protected Runnable createRemoveRunnable(NotificationEntry entry) { return () -> { if (mTrackingHeadsUp) { if (!NotificationThrottleHun.isEnabled() && !mVisualStabilityProvider.isReorderingAllowed() // We don't want to allow reordering while pulsing, but headsup need to // time out anyway && !entry.showingPulsing()) { mEntriesToRemoveWhenReorderingAllowed.add(entry); mVisualStabilityProvider.addTemporaryReorderingAllowedListener( mOnReorderingAllowedListener); } else if (mTrackingHeadsUp) { mEntriesToRemoveAfterExpand.add(entry); } else if (mVisualStabilityProvider.isReorderingAllowed() || entry.showingPulsing()) { Loading @@ -614,6 +630,11 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements if (mEntriesToRemoveAfterExpand.contains(mEntry)) { mEntriesToRemoveAfterExpand.remove(mEntry); } if (!NotificationThrottleHun.isEnabled()) { if (mEntriesToRemoveWhenReorderingAllowed.contains(mEntry)) { mEntriesToRemoveWhenReorderingAllowed.remove(mEntry); } } } @Override Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ import com.android.systemui.statusbar.notification.footer.shared.FooterViewRefac import com.android.systemui.statusbar.notification.footer.ui.view.FooterView; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableView; import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun; import com.android.systemui.statusbar.notification.shared.NotificationsHeadsUpRefactor; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.ScreenOffAnimationController; Loading Loading @@ -1196,7 +1197,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { } @Test @EnableFlags(NotificationsHeadsUpRefactor.FLAG_NAME) @EnableFlags(NotificationThrottleHun.FLAG_NAME) public void testGenerateHeadsUpAnimation_isSeenInShade_noAnimation() { // GIVEN NSSL is ready for HUN animations Consumer<Boolean> headsUpAnimatingAwayListener = mock(BooleanConsumer.class); Loading