Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/FullScreenIntentDecisionProvider.kt +6 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import com.android.systemui.statusbar.notification.interruption.FullScreenIntent import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.FSI_KEYGUARD_OCCLUDED import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.FSI_KEYGUARD_SHOWING import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.FSI_LOCKED_SHADE import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.FSI_USER_SETUP_INCOMPLETE import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.NO_FSI_EXPECTED_TO_HUN import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.NO_FSI_NOT_IMPORTANT_ENOUGH import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.NO_FSI_NO_FULL_SCREEN_INTENT Loading Loading @@ -101,6 +102,7 @@ class FullScreenIntentDecisionProvider( FSI_KEYGUARD_OCCLUDED(true, "keyguard is occluded"), FSI_LOCKED_SHADE(true, "locked shade"), FSI_DEVICE_NOT_PROVISIONED(true, "device not provisioned"), FSI_USER_SETUP_INCOMPLETE(true, "user setup incomplete"), NO_FSI_NO_HUN_OR_KEYGUARD( false, "no HUN or keyguard", Loading Loading @@ -189,6 +191,10 @@ class FullScreenIntentDecisionProvider( return FSI_DEVICE_NOT_PROVISIONED } if (!deviceProvisionedController.isCurrentUserSetup) { return FSI_USER_SETUP_INCOMPLETE } return NO_FSI_NO_HUN_OR_KEYGUARD } } packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProvider.java +5 −1 Original line number Diff line number Diff line Loading @@ -104,7 +104,11 @@ public interface NotificationInterruptStateProvider { /** * The device is not provisioned, launch FSI. */ FSI_NOT_PROVISIONED(true); FSI_NOT_PROVISIONED(true), /** * The current user has not completed setup, launch FSI. */ FSI_USER_SETUP_INCOMPLETE(true); public final boolean shouldLaunch; Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java +6 −0 Original line number Diff line number Diff line Loading @@ -362,6 +362,12 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter suppressedByDND); } // The current user hasn't completed setup, launch FSI. if (!mDeviceProvisionedController.isCurrentUserSetup()) { return getDecisionGivenSuppression(FullScreenIntentDecision.FSI_USER_SETUP_INCOMPLETE, 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, Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt +27 −2 Original line number Diff line number Diff line Loading @@ -148,7 +148,10 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { @Before fun setUp() { val user = UserInfo(ActivityManager.getCurrentUser(), "Current user", /* flags = */ 0) val userId = ActivityManager.getCurrentUser() val user = UserInfo(userId, "Current user", /* flags = */ 0) deviceProvisionedController.currentUser = userId userTracker.set(listOf(user), /* currentUserIndex = */ 0) provider.start() Loading Loading @@ -820,6 +823,13 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { assertNoEventsLogged() } @Test fun testShouldFsi_userSetupIncomplete() { ensureUserSetupIncompleteFsiState() assertShouldFsi(buildFsiEntry()) assertNoEventsLogged() } @Test fun testShouldNotFsi_noHunOrKeyguard() { ensureNoHunOrKeyguardFsiState() Loading Loading @@ -886,7 +896,8 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { var statusBarState: Int? = null, var keyguardIsShowing: Boolean = false, var keyguardIsOccluded: Boolean = false, var deviceProvisioned: Boolean = true var deviceProvisioned: Boolean = true, var currentUserSetup: Boolean = true ) protected fun setState(state: State): Unit = Loading Loading @@ -923,6 +934,7 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { keyguardStateController.isShowing = keyguardIsShowing deviceProvisionedController.deviceProvisioned = deviceProvisioned deviceProvisionedController.isCurrentUserSetup = currentUserSetup } protected fun ensureState(block: State.() -> Unit) = Loading Loading @@ -997,6 +1009,18 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { hunSettingEnabled = false keyguardIsShowing = false deviceProvisioned = false currentUserSetup = true run(block) } protected fun ensureUserSetupIncompleteFsiState(block: State.() -> Unit = {}) = ensureState { isInteractive = true isDreaming = false statusBarState = SHADE hunSettingEnabled = false keyguardIsShowing = false deviceProvisioned = true currentUserSetup = false run(block) } Loading @@ -1007,6 +1031,7 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { hunSettingEnabled = false keyguardIsShowing = false deviceProvisioned = true currentUserSetup = true run(block) } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/FullScreenIntentDecisionProvider.kt +6 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import com.android.systemui.statusbar.notification.interruption.FullScreenIntent import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.FSI_KEYGUARD_OCCLUDED import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.FSI_KEYGUARD_SHOWING import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.FSI_LOCKED_SHADE import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.FSI_USER_SETUP_INCOMPLETE import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.NO_FSI_EXPECTED_TO_HUN import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.NO_FSI_NOT_IMPORTANT_ENOUGH import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.NO_FSI_NO_FULL_SCREEN_INTENT Loading Loading @@ -101,6 +102,7 @@ class FullScreenIntentDecisionProvider( FSI_KEYGUARD_OCCLUDED(true, "keyguard is occluded"), FSI_LOCKED_SHADE(true, "locked shade"), FSI_DEVICE_NOT_PROVISIONED(true, "device not provisioned"), FSI_USER_SETUP_INCOMPLETE(true, "user setup incomplete"), NO_FSI_NO_HUN_OR_KEYGUARD( false, "no HUN or keyguard", Loading Loading @@ -189,6 +191,10 @@ class FullScreenIntentDecisionProvider( return FSI_DEVICE_NOT_PROVISIONED } if (!deviceProvisionedController.isCurrentUserSetup) { return FSI_USER_SETUP_INCOMPLETE } return NO_FSI_NO_HUN_OR_KEYGUARD } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProvider.java +5 −1 Original line number Diff line number Diff line Loading @@ -104,7 +104,11 @@ public interface NotificationInterruptStateProvider { /** * The device is not provisioned, launch FSI. */ FSI_NOT_PROVISIONED(true); FSI_NOT_PROVISIONED(true), /** * The current user has not completed setup, launch FSI. */ FSI_USER_SETUP_INCOMPLETE(true); public final boolean shouldLaunch; Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java +6 −0 Original line number Diff line number Diff line Loading @@ -362,6 +362,12 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter suppressedByDND); } // The current user hasn't completed setup, launch FSI. if (!mDeviceProvisionedController.isCurrentUserSetup()) { return getDecisionGivenSuppression(FullScreenIntentDecision.FSI_USER_SETUP_INCOMPLETE, 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, Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt +27 −2 Original line number Diff line number Diff line Loading @@ -148,7 +148,10 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { @Before fun setUp() { val user = UserInfo(ActivityManager.getCurrentUser(), "Current user", /* flags = */ 0) val userId = ActivityManager.getCurrentUser() val user = UserInfo(userId, "Current user", /* flags = */ 0) deviceProvisionedController.currentUser = userId userTracker.set(listOf(user), /* currentUserIndex = */ 0) provider.start() Loading Loading @@ -820,6 +823,13 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { assertNoEventsLogged() } @Test fun testShouldFsi_userSetupIncomplete() { ensureUserSetupIncompleteFsiState() assertShouldFsi(buildFsiEntry()) assertNoEventsLogged() } @Test fun testShouldNotFsi_noHunOrKeyguard() { ensureNoHunOrKeyguardFsiState() Loading Loading @@ -886,7 +896,8 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { var statusBarState: Int? = null, var keyguardIsShowing: Boolean = false, var keyguardIsOccluded: Boolean = false, var deviceProvisioned: Boolean = true var deviceProvisioned: Boolean = true, var currentUserSetup: Boolean = true ) protected fun setState(state: State): Unit = Loading Loading @@ -923,6 +934,7 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { keyguardStateController.isShowing = keyguardIsShowing deviceProvisionedController.deviceProvisioned = deviceProvisioned deviceProvisionedController.isCurrentUserSetup = currentUserSetup } protected fun ensureState(block: State.() -> Unit) = Loading Loading @@ -997,6 +1009,18 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { hunSettingEnabled = false keyguardIsShowing = false deviceProvisioned = false currentUserSetup = true run(block) } protected fun ensureUserSetupIncompleteFsiState(block: State.() -> Unit = {}) = ensureState { isInteractive = true isDreaming = false statusBarState = SHADE hunSettingEnabled = false keyguardIsShowing = false deviceProvisioned = true currentUserSetup = false run(block) } Loading @@ -1007,6 +1031,7 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() { hunSettingEnabled = false keyguardIsShowing = false deviceProvisioned = true currentUserSetup = true run(block) } Loading