diff options
13 files changed, 40 insertions, 40 deletions
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 96279e2d2e44..5983fc17d4c3 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 @@ class NotificationLaunchAnimatorController( 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 314566eaf8d0..46806e66cb8c 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 @@ class HeadsUpCoordinator @Inject constructor( 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 @@ class HeadsUpCoordinator @Inject constructor( wasUpdated = false, shouldHeadsUpEver = true, shouldHeadsUpAgain = true, - isAlerting = mHeadsUpManager.isAlerting(childToReceiveParentAlert.key), + isAlerting = mHeadsUpManager.isHeadsUpEntry(childToReceiveParentAlert.key), isBinding = isEntryBinding(childToReceiveParentAlert), ) handlePostedEntry( @@ -425,7 +425,7 @@ class HeadsUpCoordinator @Inject constructor( 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 @@ class HeadsUpCoordinator @Inject constructor( 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 @@ class HeadsUpCoordinator @Inject constructor( * 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 a0129ff5cd90..8189fe03b2ed 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 @@ public class VisualStabilityCoordinator implements Coordinator, Dumpable { 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 e71d80c130da..5743ab0eae27 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 @@ public class OnUserInteractionCallbackImpl implements OnUserInteractionCallback @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 57cd4a4b414b..99489789895e 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 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements OnHeadsUp 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 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements OnHeadsUp 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 9da61112fd0c..4ee061d05a3b 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 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit 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 ddff5a464d3c..9635c4193a4d 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 @@ public abstract class BaseHeadsUpManager implements HeadsUpManager { /** * @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 d9527fe98b1a..b8c7e202ce7c 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 @@ interface HeadsUpManager : Dumpable { 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 @@ class HeadsUpManagerEmptyImpl @Inject constructor() : HeadsUpManager { 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 605936372e7a..cd744100770e 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 @@ class NotificationLaunchAnimatorControllerTest : SysuiTestCase() { } private fun flagNotificationAsHun() { - `when`(headsUpManager.isAlerting(notificationKey)).thenReturn(true) + `when`(headsUpManager.isHeadsUpEntry(notificationKey)).thenReturn(true) } @Test @@ -151,8 +151,8 @@ class NotificationLaunchAnimatorControllerTest : SysuiTestCase() { .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 a8be62b367b4..cd75e0811fff 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 @@ class HeadsUpCoordinatorTest : SysuiTestCase() { 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 2e74d119849e..ea5a6e72557a 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 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase { .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 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase { 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 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase { 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 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase { 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 95a05ef29914..c350de21dda5 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 @@ public class HeadsUpManagerPhoneTest extends BaseHeadsUpManagerTest { /* releaseImmediately = */ false); assertTrue(removedImmediately); - assertFalse(hmp.isAlerting(entry.getKey())); + assertFalse(hmp.isHeadsUpEntry(entry.getKey())); } @Test @@ -212,6 +212,6 @@ public class HeadsUpManagerPhoneTest extends BaseHeadsUpManagerTest { 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 a27fff2dfde3..af62a6e74473 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 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { 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 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { 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 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { 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 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { 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 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { 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 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { 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 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { 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 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { 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 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { 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 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { 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 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { 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 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { 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 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { final boolean removedImmediately = hum.removeNotification( entry.getKey(), /* releaseImmediately = */ true); assertTrue(removedImmediately); - assertFalse(hum.isAlerting(entry.getKey())); + assertFalse(hum.isHeadsUpEntry(entry.getKey())); } |