diff options
| author | 2023-04-04 17:27:25 -0400 | |
|---|---|---|
| committer | 2023-04-13 12:26:12 -0400 | |
| commit | c9b630899d8868366e74f0cb887cb0131f042e36 (patch) | |
| tree | e9dc131a8a0170eeebdd9ddb1cae10a08f3dc39e | |
| parent | a1e56c40984e332fd4121772c5c875c1141d5244 (diff) | |
Remove FSI_REQUIRES_KEYGUARD flag
Test: atest SystemUITests
Fixes: 254512517
Change-Id: I6b0cb27ab148271f13adf46b7eff427b4e333036
8 files changed, 23 insertions, 176 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index dfe86970190c..6aaad6fea157 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -58,9 +58,6 @@ object Flags { "notification_drag_to_contents" ) - // TODO(b/254512517): Tracking Bug - val FSI_REQUIRES_KEYGUARD = releasedFlag(110, "fsi_requires_keyguard") - // TODO(b/259130119): Tracking Bug val FSI_ON_DND_UPDATE = releasedFlag(259130119, "fsi_on_dnd_update") diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotifPipelineFlags.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotifPipelineFlags.kt index 00d8c421c721..d2d623b73d44 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotifPipelineFlags.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotifPipelineFlags.kt @@ -31,9 +31,6 @@ class NotifPipelineFlags @Inject constructor( fun isDevLoggingEnabled(): Boolean = featureFlags.isEnabled(Flags.NOTIFICATION_PIPELINE_DEVELOPER_LOGGING) - fun fullScreenIntentRequiresKeyguard(): Boolean = - featureFlags.isEnabled(Flags.FSI_REQUIRES_KEYGUARD) - fun fsiOnDNDUpdate(): Boolean = featureFlags.isEnabled(Flags.FSI_ON_DND_UPDATE) fun forceDemoteFsi(): Boolean = diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProvider.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProvider.java index 9a1747a9c931..88994b9eec04 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProvider.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProvider.java @@ -98,10 +98,6 @@ public interface NotificationInterruptStateProvider { */ NO_FSI_NO_HUN_OR_KEYGUARD(false), /** - * No conditions blocking FSI launch. - */ - FSI_EXPECTED_NOT_TO_HUN(true), - /** * The notification is coming from a suspended packages, so FSI is suppressed. */ NO_FSI_SUSPENDED(false); 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 a48870ba9f45..609f9d47a983 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 @@ -321,30 +321,22 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter suppressedByDND); } - // Check whether FSI requires the keyguard to be showing. - if (mFlags.fullScreenIntentRequiresKeyguard()) { - - // If notification won't HUN and keyguard is showing, launch the FSI. - if (mKeyguardStateController.isShowing()) { - if (mKeyguardStateController.isOccluded()) { - return getDecisionGivenSuppression( - FullScreenIntentDecision.FSI_KEYGUARD_OCCLUDED, - suppressedByDND); - } else { - // Likely LOCKED_SHADE, but launch FSI anyway - return getDecisionGivenSuppression(FullScreenIntentDecision.FSI_LOCKED_SHADE, - suppressedByDND); - } + // If notification won't HUN and keyguard is showing, launch the FSI. + if (mKeyguardStateController.isShowing()) { + if (mKeyguardStateController.isOccluded()) { + return getDecisionGivenSuppression( + FullScreenIntentDecision.FSI_KEYGUARD_OCCLUDED, + suppressedByDND); + } else { + // Likely LOCKED_SHADE, but launch FSI anyway + return getDecisionGivenSuppression(FullScreenIntentDecision.FSI_LOCKED_SHADE, + suppressedByDND); } - - // Detect the case determined by b/231322873 to launch FSI while device is in use, - // as blocked by the correct implementation, and report the event. - return getDecisionGivenSuppression(FullScreenIntentDecision.NO_FSI_NO_HUN_OR_KEYGUARD, - suppressedByDND); } - // If the notification won't HUN for some other reason (DND/snooze/etc), launch FSI. - return getDecisionGivenSuppression(FullScreenIntentDecision.FSI_EXPECTED_NOT_TO_HUN, + // Detect the case determined by b/231322873 to launch FSI while device is in use, + // as blocked by the correct implementation, and report the event. + return getDecisionGivenSuppression(FullScreenIntentDecision.NO_FSI_NO_HUN_OR_KEYGUARD, suppressedByDND); } @@ -409,14 +401,11 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter } final boolean isSnoozedPackage = isSnoozedPackage(sbn); - final boolean fsiRequiresKeyguard = mFlags.fullScreenIntentRequiresKeyguard(); final boolean hasFsi = sbn.getNotification().fullScreenIntent != null; // Assume any notification with an FSI is time-sensitive (like an alarm or incoming call) // and ignore whether HUNs have been snoozed for the package. - final boolean shouldBypassSnooze = fsiRequiresKeyguard && hasFsi; - - if (isSnoozedPackage && !shouldBypassSnooze) { + if (isSnoozedPackage && !hasFsi) { if (log) mLogger.logNoHeadsUpPackageSnoozed(entry); return false; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java index 39362cf29e14..f08dac6c570b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java @@ -364,26 +364,6 @@ class StatusBarNotificationPresenter implements NotificationPresenter, return true; } - if (sbn.getNotification().fullScreenIntent != null - && !mNotifPipelineFlags.fullScreenIntentRequiresKeyguard()) { - // we don't allow head-up on the lockscreen (unless there's a - // "showWhenLocked" activity currently showing) if - // the potential HUN has a fullscreen intent - if (mKeyguardStateController.isShowing() && !mCentralSurfaces.isOccluded()) { - if (DEBUG) { - Log.d(TAG, "No heads up: entry has fullscreen intent on lockscreen " - + sbn.getKey()); - } - return true; - } - - if (mAccessibilityManager.isTouchExplorationEnabled()) { - if (DEBUG) { - Log.d(TAG, "No heads up: accessible fullscreen: " + sbn.getKey()); - } - return true; - } - } return false; } 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 ba91d87c659a..dba83d177383 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 @@ -258,7 +258,7 @@ class HeadsUpCoordinatorTest : SysuiTestCase() { @Test fun testOnEntryAdded_shouldFullScreen() { - setShouldFullScreen(entry, FullScreenIntentDecision.FSI_EXPECTED_NOT_TO_HUN) + setShouldFullScreen(entry, FullScreenIntentDecision.FSI_KEYGUARD_SHOWING) collectionListener.onEntryAdded(entry) verify(launchFullScreenIntentProvider).launchFullScreenIntent(entry) } @@ -1046,7 +1046,7 @@ class HeadsUpCoordinatorTest : SysuiTestCase() { coordinator.addForFSIReconsideration(entry, systemClock.currentTimeMillis() - 10000) // and it is updated to full screen later - setShouldFullScreen(entry, FullScreenIntentDecision.FSI_EXPECTED_NOT_TO_HUN) + setShouldFullScreen(entry, FullScreenIntentDecision.FSI_KEYGUARD_SHOWING) collectionListener.onRankingApplied() // THEN it should still not full screen because it's too old 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 ae6ced410638..d3e5816cd1d4 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 @@ -123,7 +123,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { @Before public void setup() { MockitoAnnotations.initMocks(this); - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(false); when(mUserTracker.getUserId()).thenReturn(ActivityManager.getCurrentUser()); mUiEventLoggerFake = new UiEventLoggerFake(); @@ -544,12 +543,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { } @Test - public void testShouldNotFullScreen_notPendingIntent_withStrictFlag() throws Exception { - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); - testShouldNotFullScreen_notPendingIntent(); - } - - @Test public void testShouldNotFullScreen_notPendingIntent() throws RemoteException { NotificationEntry entry = createNotification(IMPORTANCE_HIGH); when(mPowerManager.isInteractive()).thenReturn(true); @@ -604,12 +597,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { } @Test - public void testShouldNotFullScreen_notHighImportance_withStrictFlag() throws Exception { - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); - testShouldNotFullScreen_notHighImportance(); - } - - @Test public void testShouldNotFullScreen_notHighImportance() throws RemoteException { NotificationEntry entry = createFsiNotification(IMPORTANCE_DEFAULT, /* silenced */ false); when(mPowerManager.isInteractive()).thenReturn(true); @@ -626,12 +613,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { } @Test - public void testShouldNotFullScreen_isGroupAlertSilenced_withStrictFlag() throws Exception { - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); - testShouldNotFullScreen_isGroupAlertSilenced(); - } - - @Test public void testShouldNotFullScreen_isGroupAlertSilenced() throws RemoteException { NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ true); when(mPowerManager.isInteractive()).thenReturn(false); @@ -656,12 +637,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { } @Test - public void testShouldNotFullScreen_isSuppressedByBubbleMetadata_withStrictFlag() { - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); - testShouldNotFullScreen_isSuppressedByBubbleMetadata(); - } - - @Test public void testShouldNotFullScreen_isSuppressedByBubbleMetadata() { NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false); Notification.BubbleMetadata bubbleMetadata = new Notification.BubbleMetadata.Builder("foo") @@ -689,12 +664,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { } @Test - public void testShouldFullScreen_notInteractive_withStrictFlag() throws Exception { - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); - testShouldFullScreen_notInteractive(); - } - - @Test public void testShouldFullScreen_notInteractive() throws RemoteException { NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false); Notification.BubbleMetadata bubbleMetadata = new Notification.BubbleMetadata.Builder("foo") @@ -714,12 +683,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { } @Test - public void testShouldFullScreen_isDreaming_withStrictFlag() throws Exception { - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); - testShouldFullScreen_isDreaming(); - } - - @Test public void testShouldFullScreen_isDreaming() throws RemoteException { NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false); when(mPowerManager.isInteractive()).thenReturn(true); @@ -736,12 +699,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { } @Test - public void testShouldFullScreen_onKeyguard_withStrictFlag() throws Exception { - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); - testShouldFullScreen_onKeyguard(); - } - - @Test public void testShouldFullScreen_onKeyguard() throws RemoteException { NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false); when(mPowerManager.isInteractive()).thenReturn(true); @@ -758,12 +715,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { } @Test - public void testShouldNotFullScreen_willHun_withStrictFlag() throws Exception { - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); - testShouldNotFullScreen_willHun(); - } - - @Test public void testShouldNotFullScreen_willHun() throws RemoteException { NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false); when(mPowerManager.isInteractive()).thenReturn(true); @@ -781,26 +732,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { } @Test - public void testShouldFullScreen_packageSnoozed() throws RemoteException { - NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false); - when(mPowerManager.isInteractive()).thenReturn(true); - when(mPowerManager.isScreenOn()).thenReturn(true); - when(mStatusBarStateController.isDreaming()).thenReturn(false); - when(mStatusBarStateController.getState()).thenReturn(SHADE); - when(mHeadsUpManager.isSnoozed("a")).thenReturn(true); - - assertThat(mNotifInterruptionStateProvider.getFullScreenIntentDecision(entry)) - .isEqualTo(FullScreenIntentDecision.FSI_EXPECTED_NOT_TO_HUN); - assertThat(mNotifInterruptionStateProvider.shouldLaunchFullScreenIntentWhenAdded(entry)) - .isTrue(); - verify(mLogger, never()).logNoFullscreen(any(), any()); - verify(mLogger, never()).logNoFullscreenWarning(any(), any()); - verify(mLogger).logFullscreen(entry, "FSI_EXPECTED_NOT_TO_HUN"); - } - - @Test - public void testShouldNotFullScreen_snoozed_occluding_withStrictRules() throws Exception { - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); + public void testShouldNotFullScreen_snoozed_occluding() throws Exception { NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false); when(mPowerManager.isInteractive()).thenReturn(true); when(mPowerManager.isScreenOn()).thenReturn(true); @@ -820,8 +752,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { } @Test - public void testShouldHeadsUp_snoozed_occluding_withStrictRules() throws Exception { - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); + public void testShouldHeadsUp_snoozed_occluding() throws Exception { NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false); when(mPowerManager.isInteractive()).thenReturn(true); when(mPowerManager.isScreenOn()).thenReturn(true); @@ -845,8 +776,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { } @Test - public void testShouldNotFullScreen_snoozed_lockedShade_withStrictRules() throws Exception { - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); + public void testShouldNotFullScreen_snoozed_lockedShade() throws Exception { NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false); when(mPowerManager.isInteractive()).thenReturn(true); when(mPowerManager.isScreenOn()).thenReturn(true); @@ -866,8 +796,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { } @Test - public void testShouldHeadsUp_snoozed_lockedShade_withStrictRules() throws Exception { - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); + public void testShouldHeadsUp_snoozed_lockedShade() throws Exception { NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false); when(mPowerManager.isInteractive()).thenReturn(true); when(mPowerManager.isScreenOn()).thenReturn(true); @@ -891,8 +820,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { } @Test - public void testShouldNotFullScreen_snoozed_unlocked_withStrictRules() throws Exception { - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); + public void testShouldNotFullScreen_snoozed_unlocked() throws Exception { NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false); when(mPowerManager.isInteractive()).thenReturn(true); when(mPowerManager.isScreenOn()).thenReturn(true); @@ -955,8 +883,7 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase { } @Test - public void testShouldHeadsUp_snoozed_unlocked_withStrictRules() throws Exception { - when(mFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); + public void testShouldHeadsUp_snoozed_unlocked() throws Exception { NotificationEntry entry = createFsiNotification(IMPORTANCE_HIGH, /* silenced */ false); when(mPowerManager.isInteractive()).thenReturn(true); when(mPowerManager.isScreenOn()).thenReturn(true); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java index e83e50d65ae9..104c9e63d665 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java @@ -198,46 +198,7 @@ public class StatusBarNotificationPresenterTest extends SysuiTestCase { } @Test - public void testNoSuppressHeadsUp_FSI_occludedKeygaurd() { - when(mNotifPipelineFlags.fullScreenIntentRequiresKeyguard()).thenReturn(false); - Notification n = new Notification.Builder(getContext(), "a") - .setFullScreenIntent(mock(PendingIntent.class), true) - .build(); - NotificationEntry entry = new NotificationEntryBuilder() - .setPkg("a") - .setOpPkg("a") - .setTag("a") - .setNotification(n) - .build(); - - when(mKeyguardStateController.isShowing()).thenReturn(true); - when(mKeyguardStateController.isOccluded()).thenReturn(true); - when(mCentralSurfaces.isOccluded()).thenReturn(true); - assertFalse(mInterruptSuppressor.suppressAwakeHeadsUp(entry)); - } - - @Test - public void testSuppressHeadsUp_FSI_nonOccludedKeygaurd() { - when(mNotifPipelineFlags.fullScreenIntentRequiresKeyguard()).thenReturn(false); - Notification n = new Notification.Builder(getContext(), "a") - .setFullScreenIntent(mock(PendingIntent.class), true) - .build(); - NotificationEntry entry = new NotificationEntryBuilder() - .setPkg("a") - .setOpPkg("a") - .setTag("a") - .setNotification(n) - .build(); - - when(mKeyguardStateController.isShowing()).thenReturn(true); - when(mKeyguardStateController.isOccluded()).thenReturn(false); - when(mCentralSurfaces.isOccluded()).thenReturn(false); - assertTrue(mInterruptSuppressor.suppressAwakeHeadsUp(entry)); - } - - @Test - public void testNoSuppressHeadsUp_FSI_nonOccludedKeygaurd_withNewFlag() { - when(mNotifPipelineFlags.fullScreenIntentRequiresKeyguard()).thenReturn(true); + public void testNoSuppressHeadsUp_FSI_nonOccludedKeyguard() { Notification n = new Notification.Builder(getContext(), "a") .setFullScreenIntent(mock(PendingIntent.class), true) .build(); |