diff options
11 files changed, 69 insertions, 48 deletions
diff --git a/packages/SystemUI/res/values/flags.xml b/packages/SystemUI/res/values/flags.xml index c5ffc94d01af..6354752e1b22 100644 --- a/packages/SystemUI/res/values/flags.xml +++ b/packages/SystemUI/res/values/flags.xml @@ -33,8 +33,6 @@ <!-- Whether to show chipbar UI whenever the device is unlocked by ActiveUnlock. --> <bool name="flag_active_unlock_chipbar">true</bool> - <bool name="flag_smartspace">false</bool> - <!-- Whether the user switcher chip shows in the status bar. When true, the multi user avatar will no longer show on the lockscreen --> <bool name="flag_user_switcher_chip">false</bool> diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index ae9b3e3dccf2..1e0f6cd799d3 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -229,7 +229,6 @@ object Flags { // TODO(b/254513100): Tracking Bug val SMARTSPACE_SHARED_ELEMENT_TRANSITION_ENABLED = releasedFlag(401, "smartspace_shared_element_transition_enabled") - val SMARTSPACE = resourceBooleanFlag(402, R.bool.flag_smartspace, "smartspace") // TODO(b/258517050): Clean up after the feature is launched. @JvmField diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromGoneTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromGoneTransitionInteractor.kt index 14f918d78bc6..b5bcd45f03dd 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromGoneTransitionInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromGoneTransitionInteractor.kt @@ -45,6 +45,27 @@ constructor( override fun start() { listenForGoneToAodOrDozing() listenForGoneToDreaming() + listenForGoneToLockscreen() + } + + // Primarily for when the user chooses to lock down the device + private fun listenForGoneToLockscreen() { + scope.launch { + keyguardInteractor.isKeyguardShowing + .sample(keyguardTransitionInteractor.startedKeyguardTransitionStep, ::Pair) + .collect { (isKeyguardShowing, lastStartedStep) -> + if (isKeyguardShowing && lastStartedStep.to == KeyguardState.GONE) { + keyguardTransitionRepository.startTransition( + TransitionInfo( + name, + KeyguardState.GONE, + KeyguardState.LOCKSCREEN, + getAnimator(), + ) + ) + } + } + } } private fun listenForGoneToDreaming() { diff --git a/packages/SystemUI/src/com/android/systemui/smartspace/preconditions/LockscreenPrecondition.kt b/packages/SystemUI/src/com/android/systemui/smartspace/preconditions/LockscreenPrecondition.kt index 1302ec9dbc55..88e8ad9d1bae 100644 --- a/packages/SystemUI/src/com/android/systemui/smartspace/preconditions/LockscreenPrecondition.kt +++ b/packages/SystemUI/src/com/android/systemui/smartspace/preconditions/LockscreenPrecondition.kt @@ -15,8 +15,6 @@ */ package com.android.systemui.smartspace.preconditions -import com.android.systemui.flags.FeatureFlags -import com.android.systemui.flags.Flags import com.android.systemui.smartspace.SmartspacePrecondition import com.android.systemui.statusbar.policy.DeviceProvisionedController import com.android.systemui.util.concurrency.Execution @@ -24,11 +22,9 @@ import javax.inject.Inject /** * {@link LockscreenPrecondition} covers the conditions that must be met before Smartspace can be - * used over lockscreen. These conditions include the device being provisioned with a setup user - * and the Smartspace feature flag enabled. + * used over lockscreen. These conditions include the device being provisioned with a setup user. */ class LockscreenPrecondition @Inject constructor( - private val featureFlags: FeatureFlags, private val deviceProvisionedController: DeviceProvisionedController, private val execution: Execution ) : SmartspacePrecondition { @@ -90,6 +86,6 @@ class LockscreenPrecondition @Inject constructor( override fun conditionsMet(): Boolean { execution.assertIsMainThread() - return featureFlags.isEnabled(Flags.SMARTSPACE) && deviceReady + return deviceReady } -}
\ No newline at end of file +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt index 43e2e52b3b8a..665b1bc15adc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt @@ -206,7 +206,7 @@ constructor( fun isEnabled(): Boolean { execution.assertIsMainThread() - return featureFlags.isEnabled(Flags.SMARTSPACE) && plugin != null + return plugin != null } private fun updateBypassEnabled() { 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 635ed7c16140..48567592c43e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotifPipelineFlags.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotifPipelineFlags.kt @@ -32,8 +32,6 @@ class NotifPipelineFlags @Inject constructor( fun isDevLoggingEnabled(): Boolean = featureFlags.isEnabled(Flags.NOTIFICATION_PIPELINE_DEVELOPER_LOGGING) - fun isSmartspaceDedupingEnabled(): Boolean = featureFlags.isEnabled(Flags.SMARTSPACE) - fun fullScreenIntentRequiresKeyguard(): Boolean = featureFlags.isEnabled(Flags.FSI_REQUIRES_KEYGUARD) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/NotifCoordinators.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/NotifCoordinators.kt index 1399385e7654..03a3ca55083f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/NotifCoordinators.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/NotifCoordinators.kt @@ -88,9 +88,7 @@ class NotifCoordinatorsImpl @Inject constructor( mCoordinators.add(viewConfigCoordinator) mCoordinators.add(visualStabilityCoordinator) mCoordinators.add(sensitiveContentCoordinator) - if (notifPipelineFlags.isSmartspaceDedupingEnabled()) { - mCoordinators.add(smartspaceDedupingCoordinator) - } + mCoordinators.add(smartspaceDedupingCoordinator) mCoordinators.add(headsUpCoordinator) mCoordinators.add(gutsCoordinator) mCoordinators.add(preparationCoordinator) diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt index 5a7a3d49b628..3a871b4de8bc 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt @@ -519,6 +519,43 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() { } @Test + fun `GONE to LOCKSREEN`() = + testScope.runTest { + // GIVEN a prior transition has run to GONE + runner.startTransition( + testScope, + TransitionInfo( + ownerName = "", + from = KeyguardState.LOCKSCREEN, + to = KeyguardState.GONE, + animator = + ValueAnimator().apply { + duration = 10 + interpolator = Interpolators.LINEAR + }, + ) + ) + runCurrent() + reset(mockTransitionRepository) + + // WHEN the keyguard starts to show + keyguardRepository.setKeyguardShowing(true) + runCurrent() + + val info = + withArgCaptor<TransitionInfo> { + verify(mockTransitionRepository).startTransition(capture()) + } + // THEN a transition to AOD should occur + assertThat(info.ownerName).isEqualTo("FromGoneTransitionInteractor") + assertThat(info.from).isEqualTo(KeyguardState.GONE) + assertThat(info.to).isEqualTo(KeyguardState.LOCKSCREEN) + assertThat(info.animator).isNotNull() + + coroutineContext.cancelChildren() + } + + @Test fun `GONE to DREAMING`() = testScope.runTest { // GIVEN a device that is not dreaming or dozing diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/util/KeyguardTransitionRunner.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/util/KeyguardTransitionRunner.kt index c88f84a028ed..54fc4938e1b0 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/util/KeyguardTransitionRunner.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/util/KeyguardTransitionRunner.kt @@ -71,7 +71,7 @@ class KeyguardTransitionRunner( waitUntilComplete(info.animator!!) } - suspend private fun waitUntilComplete(animator: ValueAnimator) { + private suspend fun waitUntilComplete(animator: ValueAnimator) { withContext(Dispatchers.Main) { val startTime = System.currentTimeMillis() while (!isTerminated && animator.isRunning()) { @@ -96,6 +96,6 @@ class KeyguardTransitionRunner( override fun setFrameDelay(delay: Long) {} companion object { - private const val MAX_TEST_DURATION = 100L + private const val MAX_TEST_DURATION = 200L } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/smartspace/LockscreenPreconditionTest.kt b/packages/SystemUI/tests/src/com/android/systemui/smartspace/LockscreenPreconditionTest.kt index d29e9a66a331..fa7d869b6b95 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/smartspace/LockscreenPreconditionTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/smartspace/LockscreenPreconditionTest.kt @@ -20,8 +20,6 @@ import android.testing.AndroidTestingRunner import android.testing.TestableLooper import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase -import com.android.systemui.flags.FeatureFlags -import com.android.systemui.flags.Flags import com.android.systemui.smartspace.preconditions.LockscreenPrecondition import com.android.systemui.statusbar.policy.DeviceProvisionedController import com.android.systemui.util.concurrency.Execution @@ -41,9 +39,6 @@ import org.mockito.MockitoAnnotations @TestableLooper.RunWithLooper class LockscreenPreconditionTest : SysuiTestCase() { @Mock - private lateinit var featureFlags: FeatureFlags - - @Mock private lateinit var deviceProvisionedController: DeviceProvisionedController @Mock @@ -64,10 +59,7 @@ class LockscreenPreconditionTest : SysuiTestCase() { fun testFullyEnabled() { `when`(deviceProvisionedController.isCurrentUserSetup).thenReturn(true) `when`(deviceProvisionedController.isDeviceProvisioned).thenReturn(true) - `when`(featureFlags.isEnabled(Mockito.eq(Flags.SMARTSPACE) ?: Flags.SMARTSPACE)) - .thenReturn(true) - val precondition = LockscreenPrecondition(featureFlags, deviceProvisionedController, - execution) + val precondition = LockscreenPrecondition(deviceProvisionedController, execution) precondition.addListener(listener) `verify`(listener).onCriteriaChanged() @@ -81,10 +73,8 @@ class LockscreenPreconditionTest : SysuiTestCase() { fun testProvisioning() { `when`(deviceProvisionedController.isCurrentUserSetup).thenReturn(true) `when`(deviceProvisionedController.isDeviceProvisioned).thenReturn(false) - `when`(featureFlags.isEnabled(Mockito.eq(Flags.SMARTSPACE) ?: Flags.SMARTSPACE)) - .thenReturn(true) val precondition = - LockscreenPrecondition(featureFlags, deviceProvisionedController, execution) + LockscreenPrecondition(deviceProvisionedController, execution) precondition.addListener(listener) verify(listener).onCriteriaChanged() @@ -109,10 +99,8 @@ class LockscreenPreconditionTest : SysuiTestCase() { fun testUserSetup() { `when`(deviceProvisionedController.isCurrentUserSetup).thenReturn(false) `when`(deviceProvisionedController.isDeviceProvisioned).thenReturn(true) - `when`(featureFlags.isEnabled(Mockito.eq(Flags.SMARTSPACE) ?: Flags.SMARTSPACE)) - .thenReturn(true) val precondition = - LockscreenPrecondition(featureFlags, deviceProvisionedController, execution) + LockscreenPrecondition(deviceProvisionedController, execution) precondition.addListener(listener) verify(listener).onCriteriaChanged() @@ -129,4 +117,4 @@ class LockscreenPreconditionTest : SysuiTestCase() { verify(listener).onCriteriaChanged() assertThat(precondition.conditionsMet()).isTrue() } -}
\ No newline at end of file +} diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt index 4bcb54ddbbc0..43b6e4144a2e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt @@ -34,7 +34,6 @@ import android.widget.FrameLayout import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.flags.FeatureFlags -import com.android.systemui.flags.Flags import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.BcSmartspaceConfigPlugin import com.android.systemui.plugins.BcSmartspaceDataPlugin @@ -177,8 +176,6 @@ class LockscreenSmartspaceControllerTest : SysuiTestCase() { fun setUp() { MockitoAnnotations.initMocks(this) - `when`(featureFlags.isEnabled(Flags.SMARTSPACE)).thenReturn(true) - `when`(secureSettings.getUriFor(PRIVATE_LOCKSCREEN_SETTING)) .thenReturn(fakePrivateLockscreenSettingUri) `when`(secureSettings.getUriFor(NOTIF_ON_LOCKSCREEN_SETTING)) @@ -221,17 +218,6 @@ class LockscreenSmartspaceControllerTest : SysuiTestCase() { deviceProvisionedListener = deviceProvisionedCaptor.value } - @Test(expected = RuntimeException::class) - fun testThrowsIfFlagIsDisabled() { - // GIVEN the feature flag is disabled - `when`(featureFlags.isEnabled(Flags.SMARTSPACE)).thenReturn(false) - - // WHEN we try to build the view - controller.buildAndConnectView(fakeParent) - - // THEN an exception is thrown - } - @Test fun connectOnlyAfterDeviceIsProvisioned() { // GIVEN an unprovisioned device and an attempt to connect |