Merge "Revert "Fix HUNs re-showing after shade closes"" into main
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 f166d32..5adf31b 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
@@ -13,18 +13,12 @@
/** The subset of active listeners which are temporary (will be removed after called) */
private val temporaryListeners = ArraySet<OnReorderingAllowedListener>()
- private val banListeners = ListenerSet<OnReorderingBannedListener>()
-
var isReorderingAllowed = true
set(value) {
if (field != value) {
field = value
if (value) {
notifyReorderingAllowed()
- } else {
- banListeners.forEach { listener ->
- listener.onReorderingBanned()
- }
}
}
}
@@ -44,10 +38,6 @@
allListeners.addIfAbsent(listener)
}
- fun addPersistentReorderingBannedListener(listener: OnReorderingBannedListener) {
- banListeners.addIfAbsent(listener)
- }
-
/** Add a listener which will be removed when it is called. */
fun addTemporaryReorderingAllowedListener(listener: OnReorderingAllowedListener) {
// Only add to the temporary set if it was added to the global set
@@ -67,8 +57,3 @@
fun interface OnReorderingAllowedListener {
fun onReorderingAllowed()
}
-
-fun interface OnReorderingBannedListener {
- fun onReorderingBanned()
-}
-
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 0623bb2c..a2d7281 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
@@ -40,7 +40,6 @@
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.provider.OnReorderingAllowedListener;
-import com.android.systemui.statusbar.notification.collection.provider.OnReorderingBannedListener;
import com.android.systemui.statusbar.notification.collection.provider.VisualStabilityProvider;
import com.android.systemui.statusbar.notification.collection.render.GroupMembershipManager;
import com.android.systemui.statusbar.notification.data.repository.HeadsUpRepository;
@@ -88,7 +87,7 @@
private final List<OnHeadsUpPhoneListenerChange> mHeadsUpPhoneListeners = new ArrayList<>();
private final VisualStabilityProvider mVisualStabilityProvider;
- private AvalancheController mAvalancheController;
+ private final AvalancheController mAvalancheController;
// TODO(b/328393698) move the topHeadsUpRow logic to an interactor
private final MutableStateFlow<HeadsUpRowRepository> mTopHeadsUpRow =
@@ -177,7 +176,6 @@
javaAdapter.alwaysCollectFlow(shadeInteractor.isAnyExpanded(),
this::onShadeOrQsExpanded);
}
- mVisualStabilityProvider.addPersistentReorderingBannedListener(mOnReorderingBannedListener);
}
public void setAnimationStateHandler(AnimationStateHandler handler) {
@@ -385,8 +383,6 @@
private final OnReorderingAllowedListener mOnReorderingAllowedListener = () -> {
mAnimationStateHandler.setHeadsUpGoingAwayAnimationsAllowed(false);
- mAvalancheController.setEnableAtRuntime(true);
-
for (NotificationEntry entry : mEntriesToRemoveWhenReorderingAllowed) {
if (isHeadsUpEntry(entry.getKey())) {
// Maybe the heads-up was removed already
@@ -397,29 +393,6 @@
mAnimationStateHandler.setHeadsUpGoingAwayAnimationsAllowed(true);
};
- private final OnReorderingBannedListener mOnReorderingBannedListener = () -> {
- if (mAvalancheController != null) {
- // Waiting HUNs in AvalancheController are still promoted to the HUN section and thus
- // seen in open shade; clear them so we don't show them again when the shade closes and
- // reordering is allowed again.
- final int numDropped = mAvalancheController.getWaitingKeys().size();
- mAvalancheController.logDroppedHunsInBackground(numDropped);
- mAvalancheController.clearNext();
-
- // In open shade the first HUN is pinned, and visual stability logic prevents us from
- // unpinning this first HUN as long as the shade remains open. AvalancheController only
- // shows the next HUN when the currently showing HUN is unpinned, so we must disable
- // throttling here so that the incoming HUN stream is not forever paused. This is reset
- // when reorder becomes allowed.
- mAvalancheController.setEnableAtRuntime(false);
-
- // Note that we cannot do the above when
- // 1) the remove runnable runs because its delay means it may not run before shade close
- // 2) reordering is allowed again (when shade closes) because the HUN appear animation
- // will have started by then
- }
- };
-
///////////////////////////////////////////////////////////////////////////////////////////////
// HeadsUpManager utility (protected) methods overrides:
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AvalancheController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AvalancheController.kt
index 8aabdf2..43ab337 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AvalancheController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AvalancheController.kt
@@ -44,7 +44,6 @@
private val tag = "AvalancheController"
private val debug = Compile.IS_DEBUG && Log.isLoggable(tag, Log.DEBUG)
- var enableAtRuntime = true
// HUN showing right now, in the floating state where full shade is hidden, on launcher or AOD
@VisibleForTesting var headsUpEntryShowing: HeadsUpEntry? = null
@@ -87,17 +86,13 @@
dumpManager.registerNormalDumpable(tag, /* module */ this)
}
- fun isEnabled() : Boolean {
- return NotificationThrottleHun.isEnabled && enableAtRuntime
- }
-
fun getShowingHunKey(): String {
return getKey(headsUpEntryShowing)
}
/** Run or delay Runnable for given HeadsUpEntry */
fun update(entry: HeadsUpEntry?, runnable: Runnable, label: String) {
- if (!isEnabled()) {
+ if (!NotificationThrottleHun.isEnabled) {
runnable.run()
return
}
@@ -153,7 +148,7 @@
* all Runnables associated with that entry.
*/
fun delete(entry: HeadsUpEntry?, runnable: Runnable, label: String) {
- if (!isEnabled()) {
+ if (!NotificationThrottleHun.isEnabled) {
runnable.run()
return
}
@@ -194,7 +189,7 @@
* BaseHeadsUpManager.HeadsUpEntry.calculateFinishTime to shorten display duration.
*/
fun getDurationMs(entry: HeadsUpEntry, autoDismissMs: Int): Int {
- if (!isEnabled()) {
+ if (!NotificationThrottleHun.isEnabled) {
// Use default duration, like we did before AvalancheController existed
return autoDismissMs
}
@@ -243,7 +238,7 @@
/** Return true if entry is waiting to show. */
fun isWaiting(key: String): Boolean {
- if (!isEnabled()) {
+ if (!NotificationThrottleHun.isEnabled) {
return false
}
for (entry in nextMap.keys) {
@@ -256,7 +251,7 @@
/** Return list of keys for huns waiting */
fun getWaitingKeys(): MutableList<String> {
- if (!isEnabled()) {
+ if (!NotificationThrottleHun.isEnabled) {
return mutableListOf()
}
val keyList = mutableListOf<String>()
@@ -267,7 +262,7 @@
}
fun getWaitingEntry(key: String): HeadsUpEntry? {
- if (!isEnabled()) {
+ if (!NotificationThrottleHun.isEnabled) {
return null
}
for (headsUpEntry in nextMap.keys) {
@@ -279,7 +274,7 @@
}
fun getWaitingEntryList(): List<HeadsUpEntry> {
- if (!isEnabled()) {
+ if (!NotificationThrottleHun.isEnabled) {
return mutableListOf()
}
return nextMap.keys.toList()