Remove FSI_REQUIRES_KEYGUARD flag

Test: atest SystemUITests
Fixes: 254512517
Change-Id: I6b0cb27ab148271f13adf46b7eff427b4e333036
This commit is contained in:
Jeff DeCew
2023-04-04 17:27:25 -04:00
parent a1e56c4098
commit c9b630899d
8 changed files with 23 additions and 176 deletions

View File

@@ -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")

View File

@@ -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 =

View File

@@ -97,10 +97,6 @@ public interface NotificationInterruptStateProvider {
* that the HUN will probably not display.
*/
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.
*/

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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();
@@ -543,12 +542,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
verify(mLogger, never()).logMaybeHeadsUpDespiteOldWhen(any(), anyLong(), anyLong(), any());
}
@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);
@@ -603,12 +596,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
verify(mLogger).logNoFullscreen(entry, "NO_FSI_SUPPRESSED_BY_DND");
}
@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);
@@ -625,12 +612,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
verify(mLogger, never()).logFullscreen(any(), any());
}
@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);
@@ -655,12 +636,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
assertThat(fakeUiEvent.packageName).isEqualTo(entry.getSbn().getPackageName());
}
@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);
@@ -688,12 +663,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
assertThat(fakeUiEvent.packageName).isEqualTo(entry.getSbn().getPackageName());
}
@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);
@@ -713,12 +682,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
verify(mLogger).logFullscreen(entry, "FSI_DEVICE_NOT_INTERACTIVE");
}
@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);
@@ -735,12 +698,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
verify(mLogger).logFullscreen(entry, "FSI_DEVICE_IS_DREAMING");
}
@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);
@@ -757,12 +714,6 @@ public class NotificationInterruptStateProviderImplTest extends SysuiTestCase {
verify(mLogger).logFullscreen(entry, "FSI_KEYGUARD_SHOWING");
}
@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);
@@ -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);

View File

@@ -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();