summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lyn Han <lynhan@google.com> 2024-07-19 17:17:24 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-07-19 17:17:24 +0000
commit2c89cdacaff3898adbb7facb2e56d75c4352fbf0 (patch)
tree14488a089b7393c152571ea0f34d014d36fe01ee
parent82cf0ebbd46606ca89a6c236fd05c01af6681401 (diff)
parent0ecfe53c554555b13db05aaf7cb322aa11b75b88 (diff)
Merge "Flag guard avalanche changes" into main
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.kt3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProvider.kt3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java43
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java3
5 files changed, 47 insertions, 17 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.kt
index 5dadc4caf0f6..b91bde4fb417 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/HeadsUpManagerPhoneTest.kt
@@ -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
@@ -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()
@@ -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()
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProvider.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProvider.kt
index 0c7ba15baa92..5614f3fc9590 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProvider.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/provider/VisualStabilityProvider.kt
@@ -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
@@ -21,7 +22,7 @@ class VisualStabilityProvider @Inject constructor() {
field = value
if (value) {
notifyReorderingAllowed()
- } else {
+ } else if (NotificationThrottleHun.isEnabled){
banListeners.forEach { listener ->
listener.onReorderingBanned()
}
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 4a447b7439b8..5d2b61b42db9 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
@@ -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;
@@ -4862,10 +4863,13 @@ public class NotificationStackScrollLayout
* @param isHeadsUp true for appear, false for disappear animations
*/
public void generateHeadsUpAnimation(ExpandableNotificationRow row, boolean isHeadsUp) {
- final boolean closedAndSeenInShade = !mIsExpanded && row.getEntry() != null
- && row.getEntry().isSeenInShade();
- final boolean addAnimation = mAnimationsEnabled && !closedAndSeenInShade &&
- (isHeadsUp || mHeadsUpGoingAwayAnimationsAllowed);
+ boolean addAnimation =
+ mAnimationsEnabled && (isHeadsUp || mHeadsUpGoingAwayAnimationsAllowed);
+ if (NotificationThrottleHun.isEnabled()) {
+ final boolean closedAndSeenInShade = !mIsExpanded && row.getEntry() != null
+ && row.getEntry().isSeenInShade();
+ addAnimation = addAnimation && !closedAndSeenInShade;
+ }
if (SPEW) {
Log.v(TAG, "generateHeadsUpAnimation:"
+ " addAnimation=" + addAnimation
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
index 8577d48b6679..789a6f4483a3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
@@ -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;
@@ -174,9 +175,12 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements
});
javaAdapter.alwaysCollectFlow(shadeInteractor.isAnyExpanded(),
this::onShadeOrQsExpanded);
- mVisualStabilityProvider.addPersistentReorderingBannedListener(mOnReorderingBannedListener);
- mVisualStabilityProvider.addPersistentReorderingAllowedListener(
- mOnReorderingAllowedListener);
+ if (NotificationThrottleHun.isEnabled()) {
+ mVisualStabilityProvider.addPersistentReorderingBannedListener(
+ mOnReorderingBannedListener);
+ mVisualStabilityProvider.addPersistentReorderingAllowedListener(
+ mOnReorderingAllowedListener);
+ }
}
public void setAnimationStateHandler(AnimationStateHandler handler) {
@@ -383,7 +387,9 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements
private final OnReorderingAllowedListener mOnReorderingAllowedListener = () -> {
mAnimationStateHandler.setHeadsUpGoingAwayAnimationsAllowed(false);
- mAvalancheController.setEnableAtRuntime(true);
+ if (NotificationThrottleHun.isEnabled()) {
+ mAvalancheController.setEnableAtRuntime(true);
+ }
for (NotificationEntry entry : mEntriesToRemoveWhenReorderingAllowed) {
if (isHeadsUpEntry(entry.getKey())) {
// Maybe the heads-up was removed already
@@ -586,19 +592,29 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements
@androidx.annotation.Nullable Runnable removeRunnable) {
super.setEntry(entry, removeRunnable);
- if (!mVisualStabilityProvider.isReorderingAllowed()
- // We don't want to allow reordering while pulsing, but headsup need to
- // time out anyway
- && !entry.showingPulsing()) {
- mEntriesToRemoveWhenReorderingAllowed.add(entry);
- entry.setSeenInShade(true);
+ if (NotificationThrottleHun.isEnabled()) {
+ if (!mVisualStabilityProvider.isReorderingAllowed()
+ // We don't want to allow reordering while pulsing, but headsup need to
+ // time out anyway
+ && !entry.showingPulsing()) {
+ mEntriesToRemoveWhenReorderingAllowed.add(entry);
+ 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()) {
@@ -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
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
index c9710370c2c2..b7995953b327 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
@@ -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;
@@ -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);