Rename BaseHeadsUpManager.isAlerting to isHeadsUpEntry
Bug: 320753095
Test: SystemUITests
Flag: none
Change-Id: Iac0d5bbf65d6d7b3ce6f754f609c7b9607c37fcd
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorController.kt
index 96279e2..5983fc1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorController.kt
@@ -157,9 +157,9 @@
val summaryEntry = notificationEntry.parent?.summary
return when {
- headsUpManager.isAlerting(notificationKey) -> notification
+ headsUpManager.isHeadsUpEntry(notificationKey) -> notification
summaryEntry == null -> null
- headsUpManager.isAlerting(summaryEntry.key) -> summaryEntry.row
+ headsUpManager.isHeadsUpEntry(summaryEntry.key) -> summaryEntry.row
else -> null
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.kt
index 314566e..46806e6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.kt
@@ -221,7 +221,7 @@
wasUpdated = false,
shouldHeadsUpEver = false,
shouldHeadsUpAgain = false,
- isAlerting = mHeadsUpManager.isAlerting(logicalSummary.key),
+ isAlerting = mHeadsUpManager.isHeadsUpEntry(logicalSummary.key),
isBinding = isEntryBinding(logicalSummary),
)
// If we transfer the alert and the summary isn't even attached, that means we
@@ -268,7 +268,7 @@
wasUpdated = false,
shouldHeadsUpEver = true,
shouldHeadsUpAgain = true,
- isAlerting = mHeadsUpManager.isAlerting(childToReceiveParentAlert.key),
+ isAlerting = mHeadsUpManager.isHeadsUpEntry(childToReceiveParentAlert.key),
isBinding = isEntryBinding(childToReceiveParentAlert),
)
handlePostedEntry(
@@ -425,7 +425,7 @@
val shouldHeadsUpEver =
mVisualInterruptionDecisionProvider.makeAndLogHeadsUpDecision(entry).shouldInterrupt
val shouldHeadsUpAgain = shouldHunAgain(entry)
- val isAlerting = mHeadsUpManager.isAlerting(entry.key)
+ val isAlerting = mHeadsUpManager.isHeadsUpEntry(entry.key)
val isBinding = isEntryBinding(entry)
val posted = mPostedEntries.compute(entry.key) { _, value ->
value?.also { update ->
@@ -469,7 +469,7 @@
mEntriesUpdateTimes.remove(entry.key)
cancelHeadsUpBind(entry)
val entryKey = entry.key
- if (mHeadsUpManager.isAlerting(entryKey)) {
+ if (mHeadsUpManager.isHeadsUpEntry(entryKey)) {
// TODO: This should probably know the RemoteInputCoordinator's conditions,
// or otherwise reference that coordinator's state, rather than replicate its logic
val removeImmediatelyForRemoteInput = (mRemoteInputManager.isSpinning(entryKey) &&
@@ -719,7 +719,7 @@
* Whether the notification is already alerting or binding so that it can imminently alert
*/
private fun isAttemptingToShowHun(entry: ListEntry) =
- mHeadsUpManager.isAlerting(entry.key) || isEntryBinding(entry)
+ mHeadsUpManager.isHeadsUpEntry(entry.key) || isEntryBinding(entry)
/**
* Whether the notification is already alerting/binding per [isAttemptingToShowHun] OR if it
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinator.java
index a0129ff..8189fe0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinator.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinator.java
@@ -134,7 +134,7 @@
private final NotifStabilityManager mNotifStabilityManager =
new NotifStabilityManager("VisualStabilityCoordinator") {
private boolean canMoveForHeadsUp(NotificationEntry entry) {
- return entry != null && mHeadsUpManager.isAlerting(entry.getKey())
+ return entry != null && mHeadsUpManager.isHeadsUpEntry(entry.getKey())
&& !mVisibilityLocationProvider.isInVisibleLocation(entry);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/OnUserInteractionCallbackImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/OnUserInteractionCallbackImpl.java
index e71d80c..5743ab0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/OnUserInteractionCallbackImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/OnUserInteractionCallbackImpl.java
@@ -68,7 +68,7 @@
@NonNull
private DismissedByUserStats getDismissedByUserStats(NotificationEntry entry) {
int dismissalSurface = NotificationStats.DISMISSAL_SHADE;
- if (mHeadsUpManager.isAlerting(entry.getKey())) {
+ if (mHeadsUpManager.isHeadsUpEntry(entry.getKey())) {
dismissalSurface = NotificationStats.DISMISSAL_PEEK;
} else if (mStatusBarStateController.isDozing()) {
dismissalSurface = NotificationStats.DISMISSAL_AOD;
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 57cd4a4..9948978 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
@@ -222,7 +222,7 @@
mReleaseOnExpandFinish = false;
} else {
for (NotificationEntry entry : mEntriesToRemoveAfterExpand) {
- if (isAlerting(entry.getKey())) {
+ if (isHeadsUpEntry(entry.getKey())) {
// Maybe the heads-up was removed already
removeAlertEntry(entry.getKey());
}
@@ -357,7 +357,7 @@
private final OnReorderingAllowedListener mOnReorderingAllowedListener = () -> {
mAnimationStateHandler.setHeadsUpGoingAwayAnimationsAllowed(false);
for (NotificationEntry entry : mEntriesToRemoveWhenReorderingAllowed) {
- if (isAlerting(entry.getKey())) {
+ if (isHeadsUpEntry(entry.getKey())) {
// Maybe the heads-up was removed already
removeAlertEntry(entry.getKey());
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
index 9da6111..4ee061d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
@@ -562,7 +562,7 @@
private void removeHunAfterClick(ExpandableNotificationRow row) {
String key = row.getEntry().getSbn().getKey();
- if (mHeadsUpManager != null && mHeadsUpManager.isAlerting(key)) {
+ if (mHeadsUpManager != null && mHeadsUpManager.isHeadsUpEntry(key)) {
// Release the HUN notification to the shade.
if (mPresenter.isPresenterFullyCollapsed()) {
HeadsUpUtil.setNeedsHeadsUpDisappearAnimationAfterClick(row, true);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BaseHeadsUpManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BaseHeadsUpManager.java
index ddff5a4..9635c41 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BaseHeadsUpManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BaseHeadsUpManager.java
@@ -258,7 +258,7 @@
/**
* @return true if the notification is managed by this manager
*/
- public boolean isAlerting(@NonNull String key) {
+ public boolean isHeadsUpEntry(@NonNull String key) {
return mHeadsUpEntryMap.containsKey(key);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.kt
index d9527fe..b8c7e20 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.kt
@@ -71,7 +71,7 @@
fun hasPinnedHeadsUp(): Boolean
/** Returns whether or not the given notification is alerting and managed by this manager. */
- fun isAlerting(key: String): Boolean
+ fun isHeadsUpEntry(key: String): Boolean
fun isHeadsUpGoingAway(): Boolean
@@ -213,7 +213,7 @@
override fun getTouchableRegion(): Region? = null
override fun getTopEntry() = null
override fun hasPinnedHeadsUp() = false
- override fun isAlerting(key: String) = false
+ override fun isHeadsUpEntry(key: String) = false
override fun isHeadsUpGoingAway() = false
override fun isSnoozed(packageName: String) = false
override fun isSticky(key: String?) = false
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorControllerTest.kt
index 6059363..cd74410 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorControllerTest.kt
@@ -73,7 +73,7 @@
}
private fun flagNotificationAsHun() {
- `when`(headsUpManager.isAlerting(notificationKey)).thenReturn(true)
+ `when`(headsUpManager.isHeadsUpEntry(notificationKey)).thenReturn(true)
}
@Test
@@ -151,8 +151,8 @@
.build()
assertSame(summary, notification.entry.parent?.summary)
- `when`(headsUpManager.isAlerting(notificationKey)).thenReturn(false)
- `when`(headsUpManager.isAlerting(summary.key)).thenReturn(true)
+ `when`(headsUpManager.isHeadsUpEntry(notificationKey)).thenReturn(false)
+ `when`(headsUpManager.isHeadsUpEntry(summary.key)).thenReturn(true)
assertNotSame(GROUP_ALERT_SUMMARY, summary.sbn.notification.groupAlertBehavior)
assertNotSame(GROUP_ALERT_SUMMARY, notification.entry.sbn.notification.groupAlertBehavior)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt
index a8be62b..cd75e08 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt
@@ -148,7 +148,7 @@
verify(remoteInputManager).addActionPressListener(capture())
}
given(headsUpManager.allEntries).willAnswer { huns.stream() }
- given(headsUpManager.isAlerting(anyString())).willAnswer { invocation ->
+ given(headsUpManager.isHeadsUpEntry(anyString())).willAnswer { invocation ->
val key = invocation.getArgument<String>(0)
huns.any { entry -> entry.key == key }
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinatorTest.java
index 2e74d11..ea5a6e7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinatorTest.java
@@ -140,7 +140,7 @@
.setSummary(mEntry)
.build();
- when(mHeadsUpManager.isAlerting(mEntry.getKey())).thenReturn(false);
+ when(mHeadsUpManager.isHeadsUpEntry(mEntry.getKey())).thenReturn(false);
// Whenever we invalidate, the pipeline runs again, so we invalidate the state
doAnswer(i -> {
@@ -373,7 +373,7 @@
setSleepy(false);
// WHEN a notification is alerting and visible
- when(mHeadsUpManager.isAlerting(mEntry.getKey())).thenReturn(true);
+ when(mHeadsUpManager.isHeadsUpEntry(mEntry.getKey())).thenReturn(true);
when(mVisibilityLocationProvider.isInVisibleLocation(any(NotificationEntry.class)))
.thenReturn(true);
@@ -389,7 +389,7 @@
setSleepy(false);
// WHEN a notification is alerting but not visible
- when(mHeadsUpManager.isAlerting(mEntry.getKey())).thenReturn(true);
+ when(mHeadsUpManager.isHeadsUpEntry(mEntry.getKey())).thenReturn(true);
when(mVisibilityLocationProvider.isInVisibleLocation(any(NotificationEntry.class)))
.thenReturn(false);
@@ -537,7 +537,7 @@
assertFalse(mNotifStabilityManager.isSectionChangeAllowed(mEntry));
// GIVEN mEntry is a HUN
- when(mHeadsUpManager.isAlerting(mEntry.getKey())).thenReturn(true);
+ when(mHeadsUpManager.isHeadsUpEntry(mEntry.getKey())).thenReturn(true);
// THEN group + section changes are allowed
assertTrue(mNotifStabilityManager.isGroupChangeAllowed(mEntry));
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
index 95a05ef..c350de2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
@@ -173,7 +173,7 @@
/* releaseImmediately = */ false);
assertTrue(removedImmediately);
- assertFalse(hmp.isAlerting(entry.getKey()));
+ assertFalse(hmp.isHeadsUpEntry(entry.getKey()));
}
@Test
@@ -212,6 +212,6 @@
hmp.extendHeadsUp();
mSystemClock.advanceTime(TEST_AUTO_DISMISS_TIME + hmp.mExtensionTime / 2);
- assertTrue(hmp.isAlerting(entry.getKey()));
+ assertTrue(hmp.isHeadsUpEntry(entry.getKey()));
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java
index a27fff2..af62a6e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java
@@ -300,7 +300,7 @@
alm.showNotification(entry);
- assertTrue(alm.isAlerting(entry.getKey()));
+ assertTrue(alm.isHeadsUpEntry(entry.getKey()));
assertTrue(alm.hasNotifications());
assertEquals(entry, alm.getEntry(entry.getKey()));
}
@@ -313,7 +313,7 @@
alm.showNotification(entry);
mSystemClock.advanceTime(TEST_AUTO_DISMISS_TIME * 3 / 2);
- assertFalse(alm.isAlerting(entry.getKey()));
+ assertFalse(alm.isHeadsUpEntry(entry.getKey()));
}
@Test
@@ -326,7 +326,7 @@
final boolean removedImmediately = alm.removeNotification(
entry.getKey(), /* releaseImmediately = */ false);
assertFalse(removedImmediately);
- assertTrue(alm.isAlerting(entry.getKey()));
+ assertTrue(alm.isHeadsUpEntry(entry.getKey()));
}
@Test
@@ -339,7 +339,7 @@
final boolean removedImmediately = alm.removeNotification(
entry.getKey(), /* releaseImmediately = */ true);
assertTrue(removedImmediately);
- assertFalse(alm.isAlerting(entry.getKey()));
+ assertFalse(alm.isHeadsUpEntry(entry.getKey()));
}
@Test
@@ -428,7 +428,7 @@
hum.showNotification(entry);
mSystemClock.advanceTime(TEST_TOUCH_ACCEPTANCE_TIME / 2 + TEST_AUTO_DISMISS_TIME);
- assertTrue(hum.isAlerting(entry.getKey()));
+ assertTrue(hum.isHeadsUpEntry(entry.getKey()));
}
@@ -442,7 +442,7 @@
mSystemClock.advanceTime(TEST_TOUCH_ACCEPTANCE_TIME
+ (TEST_AUTO_DISMISS_TIME + TEST_A11Y_AUTO_DISMISS_TIME) / 2);
- assertFalse(hum.isAlerting(entry.getKey()));
+ assertFalse(hum.isHeadsUpEntry(entry.getKey()));
}
@@ -456,7 +456,7 @@
mSystemClock.advanceTime(TEST_TOUCH_ACCEPTANCE_TIME
+ (TEST_AUTO_DISMISS_TIME + TEST_STICKY_AUTO_DISMISS_TIME) / 2);
- assertTrue(hum.isAlerting(entry.getKey()));
+ assertTrue(hum.isHeadsUpEntry(entry.getKey()));
}
@@ -469,7 +469,7 @@
hum.showNotification(entry);
mSystemClock.advanceTime(TEST_TOUCH_ACCEPTANCE_TIME + 2 * TEST_A11Y_AUTO_DISMISS_TIME);
- assertTrue(hum.isAlerting(entry.getKey()));
+ assertTrue(hum.isHeadsUpEntry(entry.getKey()));
}
@@ -483,7 +483,7 @@
mSystemClock.advanceTime(TEST_TOUCH_ACCEPTANCE_TIME
+ (TEST_AUTO_DISMISS_TIME + TEST_A11Y_AUTO_DISMISS_TIME) / 2);
- assertTrue(hum.isAlerting(entry.getKey()));
+ assertTrue(hum.isHeadsUpEntry(entry.getKey()));
}
@@ -497,7 +497,7 @@
mSystemClock.advanceTime(TEST_TOUCH_ACCEPTANCE_TIME
+ (TEST_STICKY_AUTO_DISMISS_TIME + TEST_A11Y_AUTO_DISMISS_TIME) / 2);
- assertTrue(hum.isAlerting(entry.getKey()));
+ assertTrue(hum.isHeadsUpEntry(entry.getKey()));
}
@@ -512,11 +512,11 @@
final boolean removedImmediately = hum.removeNotification(
entry.getKey(), /* releaseImmediately = */ false);
assertFalse(removedImmediately);
- assertTrue(hum.isAlerting(entry.getKey()));
+ assertTrue(hum.isHeadsUpEntry(entry.getKey()));
mSystemClock.advanceTime((TEST_MINIMUM_DISPLAY_TIME + TEST_AUTO_DISMISS_TIME) / 2);
- assertFalse(hum.isAlerting(entry.getKey()));
+ assertFalse(hum.isHeadsUpEntry(entry.getKey()));
}
@@ -529,12 +529,12 @@
hum.showNotification(entry);
mSystemClock.advanceTime((TEST_MINIMUM_DISPLAY_TIME + TEST_AUTO_DISMISS_TIME) / 2);
- assertTrue(hum.isAlerting(entry.getKey()));
+ assertTrue(hum.isHeadsUpEntry(entry.getKey()));
final boolean removedImmediately = hum.removeNotification(
entry.getKey(), /* releaseImmediately = */ false);
assertTrue(removedImmediately);
- assertFalse(hum.isAlerting(entry.getKey()));
+ assertFalse(hum.isHeadsUpEntry(entry.getKey()));
}
@@ -548,7 +548,7 @@
final boolean removedImmediately = hum.removeNotification(
entry.getKey(), /* releaseImmediately = */ true);
assertTrue(removedImmediately);
- assertFalse(hum.isAlerting(entry.getKey()));
+ assertFalse(hum.isHeadsUpEntry(entry.getKey()));
}