diff options
author | Mady Mellor <madym@google.com> | 2020-05-26 16:48:23 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-05-26 16:48:23 +0000 |
commit | 892d50baf2b36f9e1f8e317f2967a3b709ea7cbb (patch) | |
tree | 082d2010a2e110375ce65251d18440e6d6544d2b | |
parent | 20467761276db28cd9786c9341601ef4d9b032a8 (diff) | |
parent | 3b80ee67fdb5513ddd6b58a0de070547187cbf1e (diff) |
Merge "Allow bubbles for HUNs that were "snoozed" via the gesture" into rvc-dev
2 files changed, 8 insertions, 21 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java index fefad531377f..da31fe03c9e7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java @@ -206,6 +206,13 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter return false; } + if (isSnoozedPackage(sbn)) { + if (DEBUG_HEADS_UP) { + Log.d(TAG, "No alerting: snoozed package: " + sbn.getKey()); + } + return false; + } + boolean inShade = mStatusBarStateController.getState() == SHADE; if (entry.isBubble() && inShade) { if (DEBUG_HEADS_UP) { @@ -365,14 +372,6 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter return false; } } - - if (isSnoozedPackage(sbn)) { - if (DEBUG_HEADS_UP) { - Log.d(TAG, "No alerting: snoozed package: " + sbn.getKey()); - } - return false; - } - return true; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImplTest.java index 5cbfcc1bcd06..e254cd2c82a7 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImplTest.java @@ -117,21 +117,12 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { /** * Sets up the state such that any requests to - * {@link NotificationInterruptStateProviderImpl#canAlertAwakeCommon(NotificationEntry)} will - * pass as long its provided NotificationEntry fulfills launch fullscreen check. - */ - private void ensureStateForAlertAwakeCommon() { - when(mHeadsUpManager.isSnoozed(any())).thenReturn(false); - } - - /** - * Sets up the state such that any requests to * {@link NotificationInterruptStateProviderImpl#shouldHeadsUp(NotificationEntry)} will * pass as long its provided NotificationEntry fulfills importance & DND checks. */ private void ensureStateForHeadsUpWhenAwake() throws RemoteException { ensureStateForAlertCommon(); - ensureStateForAlertAwakeCommon(); + when(mHeadsUpManager.isSnoozed(any())).thenReturn(false); when(mStatusBarStateController.isDozing()).thenReturn(false); when(mDreamManager.isDreaming()).thenReturn(false); @@ -157,7 +148,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { */ private void ensureStateForBubbleUp() { ensureStateForAlertCommon(); - ensureStateForAlertAwakeCommon(); } @Test @@ -392,7 +382,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { @Test public void testShouldNotHeadsUp_snoozedPackage() { NotificationEntry entry = createNotification(IMPORTANCE_DEFAULT); - ensureStateForAlertAwakeCommon(); when(mHeadsUpManager.isSnoozed(entry.getSbn().getPackageName())).thenReturn(true); @@ -402,7 +391,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { @Test public void testShouldNotHeadsUp_justLaunchedFullscreen() { - ensureStateForAlertAwakeCommon(); // On screen alerts don't happen when that package has just launched fullscreen. NotificationEntry entry = createNotification(IMPORTANCE_DEFAULT); |