Merge changes from topic "mpietal_smartspace" into tm-qpr-dev
* changes: Remove smartspace flag Transitions - Add GONE->LOCKSCREEN support
This commit is contained in:
@@ -33,8 +33,6 @@
|
|||||||
<!-- Whether to show chipbar UI whenever the device is unlocked by ActiveUnlock. -->
|
<!-- Whether to show chipbar UI whenever the device is unlocked by ActiveUnlock. -->
|
||||||
<bool name="flag_active_unlock_chipbar">true</bool>
|
<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
|
<!-- Whether the user switcher chip shows in the status bar. When true, the multi user
|
||||||
avatar will no longer show on the lockscreen -->
|
avatar will no longer show on the lockscreen -->
|
||||||
<bool name="flag_user_switcher_chip">false</bool>
|
<bool name="flag_user_switcher_chip">false</bool>
|
||||||
|
|||||||
@@ -229,7 +229,6 @@ object Flags {
|
|||||||
// TODO(b/254513100): Tracking Bug
|
// TODO(b/254513100): Tracking Bug
|
||||||
val SMARTSPACE_SHARED_ELEMENT_TRANSITION_ENABLED =
|
val SMARTSPACE_SHARED_ELEMENT_TRANSITION_ENABLED =
|
||||||
releasedFlag(401, "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.
|
// TODO(b/258517050): Clean up after the feature is launched.
|
||||||
@JvmField
|
@JvmField
|
||||||
|
|||||||
@@ -45,6 +45,27 @@ constructor(
|
|||||||
override fun start() {
|
override fun start() {
|
||||||
listenForGoneToAodOrDozing()
|
listenForGoneToAodOrDozing()
|
||||||
listenForGoneToDreaming()
|
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() {
|
private fun listenForGoneToDreaming() {
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.android.systemui.smartspace.preconditions
|
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.smartspace.SmartspacePrecondition
|
||||||
import com.android.systemui.statusbar.policy.DeviceProvisionedController
|
import com.android.systemui.statusbar.policy.DeviceProvisionedController
|
||||||
import com.android.systemui.util.concurrency.Execution
|
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
|
* {@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
|
* used over lockscreen. These conditions include the device being provisioned with a setup user.
|
||||||
* and the Smartspace feature flag enabled.
|
|
||||||
*/
|
*/
|
||||||
class LockscreenPrecondition @Inject constructor(
|
class LockscreenPrecondition @Inject constructor(
|
||||||
private val featureFlags: FeatureFlags,
|
|
||||||
private val deviceProvisionedController: DeviceProvisionedController,
|
private val deviceProvisionedController: DeviceProvisionedController,
|
||||||
private val execution: Execution
|
private val execution: Execution
|
||||||
) : SmartspacePrecondition {
|
) : SmartspacePrecondition {
|
||||||
@@ -90,6 +86,6 @@ class LockscreenPrecondition @Inject constructor(
|
|||||||
|
|
||||||
override fun conditionsMet(): Boolean {
|
override fun conditionsMet(): Boolean {
|
||||||
execution.assertIsMainThread()
|
execution.assertIsMainThread()
|
||||||
return featureFlags.isEnabled(Flags.SMARTSPACE) && deviceReady
|
return deviceReady
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -206,7 +206,7 @@ constructor(
|
|||||||
fun isEnabled(): Boolean {
|
fun isEnabled(): Boolean {
|
||||||
execution.assertIsMainThread()
|
execution.assertIsMainThread()
|
||||||
|
|
||||||
return featureFlags.isEnabled(Flags.SMARTSPACE) && plugin != null
|
return plugin != null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateBypassEnabled() {
|
private fun updateBypassEnabled() {
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ class NotifPipelineFlags @Inject constructor(
|
|||||||
fun isDevLoggingEnabled(): Boolean =
|
fun isDevLoggingEnabled(): Boolean =
|
||||||
featureFlags.isEnabled(Flags.NOTIFICATION_PIPELINE_DEVELOPER_LOGGING)
|
featureFlags.isEnabled(Flags.NOTIFICATION_PIPELINE_DEVELOPER_LOGGING)
|
||||||
|
|
||||||
fun isSmartspaceDedupingEnabled(): Boolean = featureFlags.isEnabled(Flags.SMARTSPACE)
|
|
||||||
|
|
||||||
fun fullScreenIntentRequiresKeyguard(): Boolean =
|
fun fullScreenIntentRequiresKeyguard(): Boolean =
|
||||||
featureFlags.isEnabled(Flags.FSI_REQUIRES_KEYGUARD)
|
featureFlags.isEnabled(Flags.FSI_REQUIRES_KEYGUARD)
|
||||||
|
|
||||||
|
|||||||
@@ -88,9 +88,7 @@ class NotifCoordinatorsImpl @Inject constructor(
|
|||||||
mCoordinators.add(viewConfigCoordinator)
|
mCoordinators.add(viewConfigCoordinator)
|
||||||
mCoordinators.add(visualStabilityCoordinator)
|
mCoordinators.add(visualStabilityCoordinator)
|
||||||
mCoordinators.add(sensitiveContentCoordinator)
|
mCoordinators.add(sensitiveContentCoordinator)
|
||||||
if (notifPipelineFlags.isSmartspaceDedupingEnabled()) {
|
mCoordinators.add(smartspaceDedupingCoordinator)
|
||||||
mCoordinators.add(smartspaceDedupingCoordinator)
|
|
||||||
}
|
|
||||||
mCoordinators.add(headsUpCoordinator)
|
mCoordinators.add(headsUpCoordinator)
|
||||||
mCoordinators.add(gutsCoordinator)
|
mCoordinators.add(gutsCoordinator)
|
||||||
mCoordinators.add(preparationCoordinator)
|
mCoordinators.add(preparationCoordinator)
|
||||||
|
|||||||
@@ -518,6 +518,43 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
|||||||
coroutineContext.cancelChildren()
|
coroutineContext.cancelChildren()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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
|
@Test
|
||||||
fun `GONE to DREAMING`() =
|
fun `GONE to DREAMING`() =
|
||||||
testScope.runTest {
|
testScope.runTest {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class KeyguardTransitionRunner(
|
|||||||
waitUntilComplete(info.animator!!)
|
waitUntilComplete(info.animator!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend private fun waitUntilComplete(animator: ValueAnimator) {
|
private suspend fun waitUntilComplete(animator: ValueAnimator) {
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
val startTime = System.currentTimeMillis()
|
val startTime = System.currentTimeMillis()
|
||||||
while (!isTerminated && animator.isRunning()) {
|
while (!isTerminated && animator.isRunning()) {
|
||||||
@@ -96,6 +96,6 @@ class KeyguardTransitionRunner(
|
|||||||
override fun setFrameDelay(delay: Long) {}
|
override fun setFrameDelay(delay: Long) {}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val MAX_TEST_DURATION = 100L
|
private const val MAX_TEST_DURATION = 200L
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ import android.testing.AndroidTestingRunner
|
|||||||
import android.testing.TestableLooper
|
import android.testing.TestableLooper
|
||||||
import androidx.test.filters.SmallTest
|
import androidx.test.filters.SmallTest
|
||||||
import com.android.systemui.SysuiTestCase
|
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.smartspace.preconditions.LockscreenPrecondition
|
||||||
import com.android.systemui.statusbar.policy.DeviceProvisionedController
|
import com.android.systemui.statusbar.policy.DeviceProvisionedController
|
||||||
import com.android.systemui.util.concurrency.Execution
|
import com.android.systemui.util.concurrency.Execution
|
||||||
@@ -40,9 +38,6 @@ import org.mockito.MockitoAnnotations
|
|||||||
@RunWith(AndroidTestingRunner::class)
|
@RunWith(AndroidTestingRunner::class)
|
||||||
@TestableLooper.RunWithLooper
|
@TestableLooper.RunWithLooper
|
||||||
class LockscreenPreconditionTest : SysuiTestCase() {
|
class LockscreenPreconditionTest : SysuiTestCase() {
|
||||||
@Mock
|
|
||||||
private lateinit var featureFlags: FeatureFlags
|
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private lateinit var deviceProvisionedController: DeviceProvisionedController
|
private lateinit var deviceProvisionedController: DeviceProvisionedController
|
||||||
|
|
||||||
@@ -64,10 +59,7 @@ class LockscreenPreconditionTest : SysuiTestCase() {
|
|||||||
fun testFullyEnabled() {
|
fun testFullyEnabled() {
|
||||||
`when`(deviceProvisionedController.isCurrentUserSetup).thenReturn(true)
|
`when`(deviceProvisionedController.isCurrentUserSetup).thenReturn(true)
|
||||||
`when`(deviceProvisionedController.isDeviceProvisioned).thenReturn(true)
|
`when`(deviceProvisionedController.isDeviceProvisioned).thenReturn(true)
|
||||||
`when`(featureFlags.isEnabled(Mockito.eq(Flags.SMARTSPACE) ?: Flags.SMARTSPACE))
|
val precondition = LockscreenPrecondition(deviceProvisionedController, execution)
|
||||||
.thenReturn(true)
|
|
||||||
val precondition = LockscreenPrecondition(featureFlags, deviceProvisionedController,
|
|
||||||
execution)
|
|
||||||
precondition.addListener(listener)
|
precondition.addListener(listener)
|
||||||
|
|
||||||
`verify`(listener).onCriteriaChanged()
|
`verify`(listener).onCriteriaChanged()
|
||||||
@@ -81,10 +73,8 @@ class LockscreenPreconditionTest : SysuiTestCase() {
|
|||||||
fun testProvisioning() {
|
fun testProvisioning() {
|
||||||
`when`(deviceProvisionedController.isCurrentUserSetup).thenReturn(true)
|
`when`(deviceProvisionedController.isCurrentUserSetup).thenReturn(true)
|
||||||
`when`(deviceProvisionedController.isDeviceProvisioned).thenReturn(false)
|
`when`(deviceProvisionedController.isDeviceProvisioned).thenReturn(false)
|
||||||
`when`(featureFlags.isEnabled(Mockito.eq(Flags.SMARTSPACE) ?: Flags.SMARTSPACE))
|
|
||||||
.thenReturn(true)
|
|
||||||
val precondition =
|
val precondition =
|
||||||
LockscreenPrecondition(featureFlags, deviceProvisionedController, execution)
|
LockscreenPrecondition(deviceProvisionedController, execution)
|
||||||
precondition.addListener(listener)
|
precondition.addListener(listener)
|
||||||
|
|
||||||
verify(listener).onCriteriaChanged()
|
verify(listener).onCriteriaChanged()
|
||||||
@@ -109,10 +99,8 @@ class LockscreenPreconditionTest : SysuiTestCase() {
|
|||||||
fun testUserSetup() {
|
fun testUserSetup() {
|
||||||
`when`(deviceProvisionedController.isCurrentUserSetup).thenReturn(false)
|
`when`(deviceProvisionedController.isCurrentUserSetup).thenReturn(false)
|
||||||
`when`(deviceProvisionedController.isDeviceProvisioned).thenReturn(true)
|
`when`(deviceProvisionedController.isDeviceProvisioned).thenReturn(true)
|
||||||
`when`(featureFlags.isEnabled(Mockito.eq(Flags.SMARTSPACE) ?: Flags.SMARTSPACE))
|
|
||||||
.thenReturn(true)
|
|
||||||
val precondition =
|
val precondition =
|
||||||
LockscreenPrecondition(featureFlags, deviceProvisionedController, execution)
|
LockscreenPrecondition(deviceProvisionedController, execution)
|
||||||
precondition.addListener(listener)
|
precondition.addListener(listener)
|
||||||
|
|
||||||
verify(listener).onCriteriaChanged()
|
verify(listener).onCriteriaChanged()
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import android.widget.FrameLayout
|
|||||||
import androidx.test.filters.SmallTest
|
import androidx.test.filters.SmallTest
|
||||||
import com.android.systemui.SysuiTestCase
|
import com.android.systemui.SysuiTestCase
|
||||||
import com.android.systemui.flags.FeatureFlags
|
import com.android.systemui.flags.FeatureFlags
|
||||||
import com.android.systemui.flags.Flags
|
|
||||||
import com.android.systemui.plugins.ActivityStarter
|
import com.android.systemui.plugins.ActivityStarter
|
||||||
import com.android.systemui.plugins.BcSmartspaceConfigPlugin
|
import com.android.systemui.plugins.BcSmartspaceConfigPlugin
|
||||||
import com.android.systemui.plugins.BcSmartspaceDataPlugin
|
import com.android.systemui.plugins.BcSmartspaceDataPlugin
|
||||||
@@ -177,8 +176,6 @@ class LockscreenSmartspaceControllerTest : SysuiTestCase() {
|
|||||||
fun setUp() {
|
fun setUp() {
|
||||||
MockitoAnnotations.initMocks(this)
|
MockitoAnnotations.initMocks(this)
|
||||||
|
|
||||||
`when`(featureFlags.isEnabled(Flags.SMARTSPACE)).thenReturn(true)
|
|
||||||
|
|
||||||
`when`(secureSettings.getUriFor(PRIVATE_LOCKSCREEN_SETTING))
|
`when`(secureSettings.getUriFor(PRIVATE_LOCKSCREEN_SETTING))
|
||||||
.thenReturn(fakePrivateLockscreenSettingUri)
|
.thenReturn(fakePrivateLockscreenSettingUri)
|
||||||
`when`(secureSettings.getUriFor(NOTIF_ON_LOCKSCREEN_SETTING))
|
`when`(secureSettings.getUriFor(NOTIF_ON_LOCKSCREEN_SETTING))
|
||||||
@@ -221,17 +218,6 @@ class LockscreenSmartspaceControllerTest : SysuiTestCase() {
|
|||||||
deviceProvisionedListener = deviceProvisionedCaptor.value
|
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
|
@Test
|
||||||
fun connectOnlyAfterDeviceIsProvisioned() {
|
fun connectOnlyAfterDeviceIsProvisioned() {
|
||||||
// GIVEN an unprovisioned device and an attempt to connect
|
// GIVEN an unprovisioned device and an attempt to connect
|
||||||
|
|||||||
Reference in New Issue
Block a user