Merge "[flexiglass] Adds logging for scene and visibility changes." into udc-qpr-dev
This commit is contained in:
@@ -127,10 +127,12 @@ constructor(
|
|||||||
repository.setMessage(message ?: promptMessage(getAuthenticationMethod()))
|
repository.setMessage(message ?: promptMessage(getAuthenticationMethod()))
|
||||||
sceneInteractor.setCurrentScene(
|
sceneInteractor.setCurrentScene(
|
||||||
scene = SceneModel(SceneKey.Bouncer),
|
scene = SceneModel(SceneKey.Bouncer),
|
||||||
|
loggingReason = "request to unlock device while authentication required",
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
sceneInteractor.setCurrentScene(
|
sceneInteractor.setCurrentScene(
|
||||||
scene = SceneModel(SceneKey.Gone),
|
scene = SceneModel(SceneKey.Gone),
|
||||||
|
loggingReason = "request to unlock device while authentication isn't required",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,6 +178,7 @@ constructor(
|
|||||||
if (isAuthenticated) {
|
if (isAuthenticated) {
|
||||||
sceneInteractor.setCurrentScene(
|
sceneInteractor.setCurrentScene(
|
||||||
scene = SceneModel(SceneKey.Gone),
|
scene = SceneModel(SceneKey.Gone),
|
||||||
|
loggingReason = "successful authentication",
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
repository.setMessage(errorMessage(getAuthenticationMethod()))
|
repository.setMessage(errorMessage(getAuthenticationMethod()))
|
||||||
|
|||||||
@@ -496,4 +496,12 @@ public class LogModule {
|
|||||||
public static LogBuffer provideDisplayMetricsRepoLogBuffer(LogBufferFactory factory) {
|
public static LogBuffer provideDisplayMetricsRepoLogBuffer(LogBufferFactory factory) {
|
||||||
return factory.create("DisplayMetricsRepo", 50);
|
return factory.create("DisplayMetricsRepo", 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Provides a {@link LogBuffer} for the scene framework. */
|
||||||
|
@Provides
|
||||||
|
@SysUISingleton
|
||||||
|
@SceneFrameworkLog
|
||||||
|
public static LogBuffer provideSceneFrameworkLogBuffer(LogBufferFactory factory) {
|
||||||
|
return factory.create("SceneFramework", 50);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.systemui.log.dagger
|
||||||
|
|
||||||
|
import javax.inject.Qualifier
|
||||||
|
|
||||||
|
/** A [com.android.systemui.log.LogBuffer] for the Scene Framework. */
|
||||||
|
@Qualifier
|
||||||
|
@MustBeDocumented
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
annotation class SceneFrameworkLog
|
||||||
@@ -220,7 +220,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
|
|||||||
// If scene framework is enabled, set the scene container window to
|
// If scene framework is enabled, set the scene container window to
|
||||||
// visible and let the touch "slip" into that window.
|
// visible and let the touch "slip" into that window.
|
||||||
if (mFeatureFlags.isEnabled(Flags.SCENE_CONTAINER)) {
|
if (mFeatureFlags.isEnabled(Flags.SCENE_CONTAINER)) {
|
||||||
mSceneInteractor.get().setVisible(true);
|
mSceneInteractor.get().setVisible(true, "swipe down on launcher");
|
||||||
} else {
|
} else {
|
||||||
centralSurfaces.onInputFocusTransfer(
|
centralSurfaces.onInputFocusTransfer(
|
||||||
mInputFocusTransferStarted, false /* cancel */,
|
mInputFocusTransferStarted, false /* cancel */,
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.android.systemui.scene.domain.interactor
|
|||||||
|
|
||||||
import com.android.systemui.dagger.SysUISingleton
|
import com.android.systemui.dagger.SysUISingleton
|
||||||
import com.android.systemui.scene.data.repository.SceneContainerRepository
|
import com.android.systemui.scene.data.repository.SceneContainerRepository
|
||||||
|
import com.android.systemui.scene.shared.logger.SceneLogger
|
||||||
import com.android.systemui.scene.shared.model.ObservableTransitionState
|
import com.android.systemui.scene.shared.model.ObservableTransitionState
|
||||||
import com.android.systemui.scene.shared.model.RemoteUserInput
|
import com.android.systemui.scene.shared.model.RemoteUserInput
|
||||||
import com.android.systemui.scene.shared.model.SceneKey
|
import com.android.systemui.scene.shared.model.SceneKey
|
||||||
@@ -41,6 +42,7 @@ class SceneInteractor
|
|||||||
@Inject
|
@Inject
|
||||||
constructor(
|
constructor(
|
||||||
private val repository: SceneContainerRepository,
|
private val repository: SceneContainerRepository,
|
||||||
|
private val logger: SceneLogger,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,8 +56,17 @@ constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the scene in the container with the given name. */
|
/** Sets the scene in the container with the given name. */
|
||||||
fun setCurrentScene(scene: SceneModel) {
|
fun setCurrentScene(scene: SceneModel, loggingReason: String) {
|
||||||
val currentSceneKey = repository.currentScene.value.key
|
val currentSceneKey = repository.currentScene.value.key
|
||||||
|
if (currentSceneKey == scene.key) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.logSceneChange(
|
||||||
|
from = currentSceneKey,
|
||||||
|
to = scene.key,
|
||||||
|
reason = loggingReason,
|
||||||
|
)
|
||||||
repository.setCurrentScene(scene)
|
repository.setCurrentScene(scene)
|
||||||
repository.setSceneTransition(from = currentSceneKey, to = scene.key)
|
repository.setSceneTransition(from = currentSceneKey, to = scene.key)
|
||||||
}
|
}
|
||||||
@@ -64,7 +75,17 @@ constructor(
|
|||||||
val currentScene: StateFlow<SceneModel> = repository.currentScene
|
val currentScene: StateFlow<SceneModel> = repository.currentScene
|
||||||
|
|
||||||
/** Sets the visibility of the container with the given name. */
|
/** Sets the visibility of the container with the given name. */
|
||||||
fun setVisible(isVisible: Boolean) {
|
fun setVisible(isVisible: Boolean, loggingReason: String) {
|
||||||
|
val wasVisible = repository.isVisible.value
|
||||||
|
if (wasVisible == isVisible) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.logVisibilityChange(
|
||||||
|
from = wasVisible,
|
||||||
|
to = isVisible,
|
||||||
|
reason = loggingReason,
|
||||||
|
)
|
||||||
return repository.setVisible(isVisible)
|
return repository.setVisible(isVisible)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import com.android.systemui.keyguard.shared.model.WakefulnessState
|
|||||||
import com.android.systemui.model.SysUiState
|
import com.android.systemui.model.SysUiState
|
||||||
import com.android.systemui.model.updateFlags
|
import com.android.systemui.model.updateFlags
|
||||||
import com.android.systemui.scene.domain.interactor.SceneInteractor
|
import com.android.systemui.scene.domain.interactor.SceneInteractor
|
||||||
|
import com.android.systemui.scene.shared.logger.SceneLogger
|
||||||
import com.android.systemui.scene.shared.model.SceneKey
|
import com.android.systemui.scene.shared.model.SceneKey
|
||||||
import com.android.systemui.scene.shared.model.SceneModel
|
import com.android.systemui.scene.shared.model.SceneModel
|
||||||
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING
|
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING
|
||||||
@@ -57,13 +58,17 @@ constructor(
|
|||||||
private val featureFlags: FeatureFlags,
|
private val featureFlags: FeatureFlags,
|
||||||
private val sysUiState: SysUiState,
|
private val sysUiState: SysUiState,
|
||||||
@DisplayId private val displayId: Int,
|
@DisplayId private val displayId: Int,
|
||||||
|
private val sceneLogger: SceneLogger,
|
||||||
) : CoreStartable {
|
) : CoreStartable {
|
||||||
|
|
||||||
override fun start() {
|
override fun start() {
|
||||||
if (featureFlags.isEnabled(Flags.SCENE_CONTAINER)) {
|
if (featureFlags.isEnabled(Flags.SCENE_CONTAINER)) {
|
||||||
|
sceneLogger.logFrameworkEnabled(isEnabled = true)
|
||||||
hydrateVisibility()
|
hydrateVisibility()
|
||||||
automaticallySwitchScenes()
|
automaticallySwitchScenes()
|
||||||
hydrateSystemUiState()
|
hydrateSystemUiState()
|
||||||
|
} else {
|
||||||
|
sceneLogger.logFrameworkEnabled(isEnabled = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +78,9 @@ constructor(
|
|||||||
sceneInteractor.currentScene
|
sceneInteractor.currentScene
|
||||||
.map { it.key }
|
.map { it.key }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.collect { sceneKey -> sceneInteractor.setVisible(sceneKey != SceneKey.Gone) }
|
.collect { sceneKey ->
|
||||||
|
sceneInteractor.setVisible(sceneKey != SceneKey.Gone, "scene is $sceneKey")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,10 +95,17 @@ constructor(
|
|||||||
isUnlocked ->
|
isUnlocked ->
|
||||||
when (currentSceneKey) {
|
when (currentSceneKey) {
|
||||||
// When the device becomes unlocked in Bouncer, go to Gone.
|
// When the device becomes unlocked in Bouncer, go to Gone.
|
||||||
is SceneKey.Bouncer -> SceneKey.Gone
|
is SceneKey.Bouncer ->
|
||||||
|
SceneKey.Gone to "device unlocked in Bouncer scene"
|
||||||
// When the device becomes unlocked in Lockscreen, go to Gone if
|
// When the device becomes unlocked in Lockscreen, go to Gone if
|
||||||
// bypass is enabled.
|
// bypass is enabled.
|
||||||
is SceneKey.Lockscreen -> SceneKey.Gone.takeIf { isBypassEnabled }
|
is SceneKey.Lockscreen ->
|
||||||
|
if (isBypassEnabled) {
|
||||||
|
SceneKey.Gone to
|
||||||
|
"device unlocked in Lockscreen scene with bypass"
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
// We got unlocked while on a scene that's not Lockscreen or
|
// We got unlocked while on a scene that's not Lockscreen or
|
||||||
// Bouncer, no need to change scenes.
|
// Bouncer, no need to change scenes.
|
||||||
else -> null
|
else -> null
|
||||||
@@ -104,13 +118,19 @@ constructor(
|
|||||||
is SceneKey.Bouncer -> null
|
is SceneKey.Bouncer -> null
|
||||||
// We got locked while on a scene that's not Lockscreen or Bouncer,
|
// We got locked while on a scene that's not Lockscreen or Bouncer,
|
||||||
// go to Lockscreen.
|
// go to Lockscreen.
|
||||||
else -> SceneKey.Lockscreen
|
else ->
|
||||||
|
SceneKey.Lockscreen to "device locked in $currentSceneKey scene"
|
||||||
}
|
}
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.filterNotNull()
|
.filterNotNull()
|
||||||
.collect { targetSceneKey -> switchToScene(targetSceneKey) }
|
.collect { (targetSceneKey, loggingReason) ->
|
||||||
|
switchToScene(
|
||||||
|
targetSceneKey = targetSceneKey,
|
||||||
|
loggingReason = loggingReason,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
applicationScope.launch {
|
applicationScope.launch {
|
||||||
@@ -121,7 +141,16 @@ constructor(
|
|||||||
if (isAsleep) {
|
if (isAsleep) {
|
||||||
// When the device goes to sleep, reset the current scene.
|
// When the device goes to sleep, reset the current scene.
|
||||||
val isUnlocked = authenticationInteractor.isUnlocked.value
|
val isUnlocked = authenticationInteractor.isUnlocked.value
|
||||||
switchToScene(if (isUnlocked) SceneKey.Gone else SceneKey.Lockscreen)
|
val (targetSceneKey, loggingReason) =
|
||||||
|
if (isUnlocked) {
|
||||||
|
SceneKey.Gone to "device is asleep while unlocked"
|
||||||
|
} else {
|
||||||
|
SceneKey.Lockscreen to "device is asleep while locked"
|
||||||
|
}
|
||||||
|
switchToScene(
|
||||||
|
targetSceneKey = targetSceneKey,
|
||||||
|
loggingReason = loggingReason,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,9 +176,10 @@ constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun switchToScene(targetSceneKey: SceneKey) {
|
private fun switchToScene(targetSceneKey: SceneKey, loggingReason: String) {
|
||||||
sceneInteractor.setCurrentScene(
|
sceneInteractor.setCurrentScene(
|
||||||
scene = SceneModel(targetSceneKey),
|
scene = SceneModel(targetSceneKey),
|
||||||
|
loggingReason = loggingReason,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2023 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.systemui.scene.shared.logger
|
||||||
|
|
||||||
|
import com.android.systemui.log.LogBuffer
|
||||||
|
import com.android.systemui.log.core.LogLevel
|
||||||
|
import com.android.systemui.log.dagger.SceneFrameworkLog
|
||||||
|
import com.android.systemui.scene.shared.model.SceneKey
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class SceneLogger @Inject constructor(@SceneFrameworkLog private val logBuffer: LogBuffer) {
|
||||||
|
|
||||||
|
fun logFrameworkEnabled(isEnabled: Boolean) {
|
||||||
|
fun asWord(isEnabled: Boolean): String {
|
||||||
|
return if (isEnabled) "enabled" else "disabled"
|
||||||
|
}
|
||||||
|
|
||||||
|
logBuffer.log(
|
||||||
|
tag = TAG,
|
||||||
|
level = LogLevel.INFO,
|
||||||
|
messageInitializer = { bool1 = isEnabled },
|
||||||
|
messagePrinter = { "Scene framework is ${asWord(bool1)}" }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun logSceneChange(
|
||||||
|
from: SceneKey,
|
||||||
|
to: SceneKey,
|
||||||
|
reason: String,
|
||||||
|
) {
|
||||||
|
logBuffer.log(
|
||||||
|
tag = TAG,
|
||||||
|
level = LogLevel.INFO,
|
||||||
|
messageInitializer = {
|
||||||
|
str1 = from.toString()
|
||||||
|
str2 = to.toString()
|
||||||
|
str3 = reason
|
||||||
|
},
|
||||||
|
messagePrinter = { "$str1 → $str2, reason: $str3" },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun logVisibilityChange(
|
||||||
|
from: Boolean,
|
||||||
|
to: Boolean,
|
||||||
|
reason: String,
|
||||||
|
) {
|
||||||
|
fun asWord(isVisible: Boolean): String {
|
||||||
|
return if (isVisible) "visible" else "invisible"
|
||||||
|
}
|
||||||
|
|
||||||
|
logBuffer.log(
|
||||||
|
tag = TAG,
|
||||||
|
level = LogLevel.INFO,
|
||||||
|
messageInitializer = {
|
||||||
|
str1 = asWord(from)
|
||||||
|
str2 = asWord(to)
|
||||||
|
str3 = reason
|
||||||
|
},
|
||||||
|
messagePrinter = { "$str1 → $str2, reason: $str3" },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val TAG = "SceneFramework"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,7 +53,10 @@ constructor(
|
|||||||
|
|
||||||
/** Requests a transition to the scene with the given key. */
|
/** Requests a transition to the scene with the given key. */
|
||||||
fun setCurrentScene(scene: SceneModel) {
|
fun setCurrentScene(scene: SceneModel) {
|
||||||
interactor.setCurrentScene(scene)
|
interactor.setCurrentScene(
|
||||||
|
scene = scene,
|
||||||
|
loggingReason = SCENE_TRANSITION_LOGGING_REASON,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,4 +72,8 @@ constructor(
|
|||||||
fun onRemoteUserInput(event: MotionEvent) {
|
fun onRemoteUserInput(event: MotionEvent) {
|
||||||
interactor.onRemoteUserInput(RemoteUserInput.translateMotionEvent(event))
|
interactor.onRemoteUserInput(RemoteUserInput.translateMotionEvent(event))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val SCENE_TRANSITION_LOGGING_REASON = "user input"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,10 +150,10 @@ class PhoneStatusBarViewController private constructor(
|
|||||||
fun onTouch(event: MotionEvent) {
|
fun onTouch(event: MotionEvent) {
|
||||||
if (centralSurfaces.statusBarWindowState == WINDOW_STATE_SHOWING) {
|
if (centralSurfaces.statusBarWindowState == WINDOW_STATE_SHOWING) {
|
||||||
val upOrCancel =
|
val upOrCancel =
|
||||||
event.action == MotionEvent.ACTION_UP ||
|
event.action == MotionEvent.ACTION_UP ||
|
||||||
event.action == MotionEvent.ACTION_CANCEL
|
event.action == MotionEvent.ACTION_CANCEL
|
||||||
centralSurfaces.setInteracting(WINDOW_STATUS_BAR,
|
centralSurfaces.setInteracting(WINDOW_STATUS_BAR,
|
||||||
!upOrCancel || shadeController.isExpandedVisible)
|
!upOrCancel || shadeController.isExpandedVisible)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ class PhoneStatusBarViewController private constructor(
|
|||||||
if (!centralSurfaces.commandQueuePanelsEnabled) {
|
if (!centralSurfaces.commandQueuePanelsEnabled) {
|
||||||
if (event.action == MotionEvent.ACTION_DOWN) {
|
if (event.action == MotionEvent.ACTION_DOWN) {
|
||||||
Log.v(TAG, String.format("onTouchForwardedFromStatusBar: panel disabled, " +
|
Log.v(TAG, String.format("onTouchForwardedFromStatusBar: panel disabled, " +
|
||||||
"ignoring touch at (${event.x.toInt()},${event.y.toInt()})"))
|
"ignoring touch at (${event.x.toInt()},${event.y.toInt()})"))
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ class PhoneStatusBarViewController private constructor(
|
|||||||
sceneInteractor.get()
|
sceneInteractor.get()
|
||||||
.onRemoteUserInput(RemoteUserInput.translateMotionEvent(event))
|
.onRemoteUserInput(RemoteUserInput.translateMotionEvent(event))
|
||||||
// TODO(b/291965119): remove once view is expanded to cover the status bar
|
// TODO(b/291965119): remove once view is expanded to cover the status bar
|
||||||
sceneInteractor.get().setVisible(true)
|
sceneInteractor.get().setVisible(true, "swipe down from status bar")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,11 +191,11 @@ class PhoneStatusBarViewController private constructor(
|
|||||||
// bar eat the gesture.
|
// bar eat the gesture.
|
||||||
if (!shadeViewController.isViewEnabled) {
|
if (!shadeViewController.isViewEnabled) {
|
||||||
shadeLogger.logMotionEvent(event,
|
shadeLogger.logMotionEvent(event,
|
||||||
"onTouchForwardedFromStatusBar: panel view disabled")
|
"onTouchForwardedFromStatusBar: panel view disabled")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (shadeViewController.isFullyCollapsed &&
|
if (shadeViewController.isFullyCollapsed &&
|
||||||
event.y < 1f) {
|
event.y < 1f) {
|
||||||
// b/235889526 Eat events on the top edge of the phone when collapsed
|
// b/235889526 Eat events on the top edge of the phone when collapsed
|
||||||
shadeLogger.logMotionEvent(event, "top edge touch ignored")
|
shadeLogger.logMotionEvent(event, "top edge touch ignored")
|
||||||
return true
|
return true
|
||||||
@@ -257,26 +257,26 @@ class PhoneStatusBarViewController private constructor(
|
|||||||
view: PhoneStatusBarView
|
view: PhoneStatusBarView
|
||||||
): PhoneStatusBarViewController {
|
): PhoneStatusBarViewController {
|
||||||
val statusBarMoveFromCenterAnimationController =
|
val statusBarMoveFromCenterAnimationController =
|
||||||
if (featureFlags.isEnabled(Flags.ENABLE_UNFOLD_STATUS_BAR_ANIMATIONS)) {
|
if (featureFlags.isEnabled(Flags.ENABLE_UNFOLD_STATUS_BAR_ANIMATIONS)) {
|
||||||
unfoldComponent.getOrNull()?.getStatusBarMoveFromCenterAnimationController()
|
unfoldComponent.getOrNull()?.getStatusBarMoveFromCenterAnimationController()
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
return PhoneStatusBarViewController(
|
return PhoneStatusBarViewController(
|
||||||
view,
|
view,
|
||||||
progressProvider.getOrNull(),
|
progressProvider.getOrNull(),
|
||||||
centralSurfaces,
|
centralSurfaces,
|
||||||
shadeController,
|
shadeController,
|
||||||
shadeViewController,
|
shadeViewController,
|
||||||
sceneInteractor,
|
sceneInteractor,
|
||||||
shadeLogger,
|
shadeLogger,
|
||||||
statusBarMoveFromCenterAnimationController,
|
statusBarMoveFromCenterAnimationController,
|
||||||
userChipViewModel,
|
userChipViewModel,
|
||||||
viewUtil,
|
viewUtil,
|
||||||
featureFlags,
|
featureFlags,
|
||||||
configurationController,
|
configurationController,
|
||||||
statusOverlayHoverListenerFactory,
|
statusOverlayHoverListenerFactory,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -733,20 +733,20 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
|
|||||||
// is
|
// is
|
||||||
// not enough to trigger a dismissal of the keyguard.
|
// not enough to trigger a dismissal of the keyguard.
|
||||||
underTest.onViewAttached()
|
underTest.onViewAttached()
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer, null))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer, null), "reason")
|
||||||
runCurrent()
|
runCurrent()
|
||||||
verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt())
|
verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt())
|
||||||
|
|
||||||
// While listening, going from the bouncer scene to the gone scene, does dismiss the
|
// While listening, going from the bouncer scene to the gone scene, does dismiss the
|
||||||
// keyguard.
|
// keyguard.
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Gone, null))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Gone, null), "reason")
|
||||||
runCurrent()
|
runCurrent()
|
||||||
verify(viewMediatorCallback).keyguardDone(anyBoolean(), anyInt())
|
verify(viewMediatorCallback).keyguardDone(anyBoolean(), anyInt())
|
||||||
|
|
||||||
// While listening, moving back to the bouncer scene does not dismiss the keyguard
|
// While listening, moving back to the bouncer scene does not dismiss the keyguard
|
||||||
// again.
|
// again.
|
||||||
clearInvocations(viewMediatorCallback)
|
clearInvocations(viewMediatorCallback)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer, null))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer, null), "reason")
|
||||||
runCurrent()
|
runCurrent()
|
||||||
verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt())
|
verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt())
|
||||||
|
|
||||||
@@ -754,12 +754,12 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
|
|||||||
// scene
|
// scene
|
||||||
// does not dismiss the keyguard while we're not listening.
|
// does not dismiss the keyguard while we're not listening.
|
||||||
underTest.onViewDetached()
|
underTest.onViewDetached()
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Gone, null))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Gone, null), "reason")
|
||||||
runCurrent()
|
runCurrent()
|
||||||
verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt())
|
verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt())
|
||||||
|
|
||||||
// While not listening, moving back to the bouncer does not dismiss the keyguard.
|
// While not listening, moving back to the bouncer does not dismiss the keyguard.
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer, null))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer, null), "reason")
|
||||||
runCurrent()
|
runCurrent()
|
||||||
verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt())
|
verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt())
|
||||||
|
|
||||||
@@ -767,7 +767,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
|
|||||||
// gone
|
// gone
|
||||||
// scene now does dismiss the keyguard again.
|
// scene now does dismiss the keyguard again.
|
||||||
underTest.onViewAttached()
|
underTest.onViewAttached()
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Gone, null))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Gone, null), "reason")
|
||||||
runCurrent()
|
runCurrent()
|
||||||
verify(viewMediatorCallback).keyguardDone(anyBoolean(), anyInt())
|
verify(viewMediatorCallback).keyguardDone(anyBoolean(), anyInt())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class PasswordBouncerViewModelTest : SysuiTestCase() {
|
|||||||
AuthenticationMethodModel.Password
|
AuthenticationMethodModel.Password
|
||||||
)
|
)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
|
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
@@ -99,7 +99,7 @@ class PasswordBouncerViewModelTest : SysuiTestCase() {
|
|||||||
AuthenticationMethodModel.Password
|
AuthenticationMethodModel.Password
|
||||||
)
|
)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
runCurrent()
|
runCurrent()
|
||||||
@@ -119,7 +119,7 @@ class PasswordBouncerViewModelTest : SysuiTestCase() {
|
|||||||
AuthenticationMethodModel.Password
|
AuthenticationMethodModel.Password
|
||||||
)
|
)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
underTest.onPasswordInputChanged("password")
|
underTest.onPasswordInputChanged("password")
|
||||||
@@ -139,7 +139,7 @@ class PasswordBouncerViewModelTest : SysuiTestCase() {
|
|||||||
AuthenticationMethodModel.Password
|
AuthenticationMethodModel.Password
|
||||||
)
|
)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
underTest.onPasswordInputChanged("wrong")
|
underTest.onPasswordInputChanged("wrong")
|
||||||
@@ -161,7 +161,7 @@ class PasswordBouncerViewModelTest : SysuiTestCase() {
|
|||||||
AuthenticationMethodModel.Password
|
AuthenticationMethodModel.Password
|
||||||
)
|
)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
underTest.onPasswordInputChanged("wrong")
|
underTest.onPasswordInputChanged("wrong")
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class PatternBouncerViewModelTest : SysuiTestCase() {
|
|||||||
AuthenticationMethodModel.Pattern
|
AuthenticationMethodModel.Pattern
|
||||||
)
|
)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
|
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
@@ -105,7 +105,7 @@ class PatternBouncerViewModelTest : SysuiTestCase() {
|
|||||||
AuthenticationMethodModel.Pattern
|
AuthenticationMethodModel.Pattern
|
||||||
)
|
)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
runCurrent()
|
runCurrent()
|
||||||
@@ -128,7 +128,7 @@ class PatternBouncerViewModelTest : SysuiTestCase() {
|
|||||||
AuthenticationMethodModel.Pattern
|
AuthenticationMethodModel.Pattern
|
||||||
)
|
)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
underTest.onDragStart()
|
underTest.onDragStart()
|
||||||
@@ -176,7 +176,7 @@ class PatternBouncerViewModelTest : SysuiTestCase() {
|
|||||||
AuthenticationMethodModel.Pattern
|
AuthenticationMethodModel.Pattern
|
||||||
)
|
)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
underTest.onDragStart()
|
underTest.onDragStart()
|
||||||
@@ -208,7 +208,7 @@ class PatternBouncerViewModelTest : SysuiTestCase() {
|
|||||||
AuthenticationMethodModel.Pattern
|
AuthenticationMethodModel.Pattern
|
||||||
)
|
)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
underTest.onDragStart()
|
underTest.onDragStart()
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class PinBouncerViewModelTest : SysuiTestCase() {
|
|||||||
val message by collectLastValue(bouncerViewModel.message)
|
val message by collectLastValue(bouncerViewModel.message)
|
||||||
val pin by collectLastValue(underTest.pinInput.map { it.getPin() })
|
val pin by collectLastValue(underTest.pinInput.map { it.getPin() })
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
|
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
@@ -97,7 +97,7 @@ class PinBouncerViewModelTest : SysuiTestCase() {
|
|||||||
val pin by collectLastValue(underTest.pinInput.map { it.getPin() })
|
val pin by collectLastValue(underTest.pinInput.map { it.getPin() })
|
||||||
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
runCurrent()
|
runCurrent()
|
||||||
@@ -117,7 +117,7 @@ class PinBouncerViewModelTest : SysuiTestCase() {
|
|||||||
val pin by collectLastValue(underTest.pinInput.map { it.getPin() })
|
val pin by collectLastValue(underTest.pinInput.map { it.getPin() })
|
||||||
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
runCurrent()
|
runCurrent()
|
||||||
@@ -138,7 +138,7 @@ class PinBouncerViewModelTest : SysuiTestCase() {
|
|||||||
val pin by collectLastValue(underTest.pinInput.map { it.getPin() })
|
val pin by collectLastValue(underTest.pinInput.map { it.getPin() })
|
||||||
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ class PinBouncerViewModelTest : SysuiTestCase() {
|
|||||||
val pin by collectLastValue(underTest.pinInput.map { it.getPin() })
|
val pin by collectLastValue(underTest.pinInput.map { it.getPin() })
|
||||||
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
runCurrent()
|
runCurrent()
|
||||||
@@ -183,7 +183,7 @@ class PinBouncerViewModelTest : SysuiTestCase() {
|
|||||||
val currentScene by collectLastValue(sceneInteractor.currentScene)
|
val currentScene by collectLastValue(sceneInteractor.currentScene)
|
||||||
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
FakeAuthenticationRepository.DEFAULT_PIN.forEach { digit ->
|
FakeAuthenticationRepository.DEFAULT_PIN.forEach { digit ->
|
||||||
@@ -203,7 +203,7 @@ class PinBouncerViewModelTest : SysuiTestCase() {
|
|||||||
val pin by collectLastValue(underTest.pinInput.map { it.getPin() })
|
val pin by collectLastValue(underTest.pinInput.map { it.getPin() })
|
||||||
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
underTest.onPinButtonClicked(1)
|
underTest.onPinButtonClicked(1)
|
||||||
@@ -227,7 +227,7 @@ class PinBouncerViewModelTest : SysuiTestCase() {
|
|||||||
val pin by collectLastValue(underTest.pinInput.map { it.getPin() })
|
val pin by collectLastValue(underTest.pinInput.map { it.getPin() })
|
||||||
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
underTest.onPinButtonClicked(1)
|
underTest.onPinButtonClicked(1)
|
||||||
@@ -258,7 +258,7 @@ class PinBouncerViewModelTest : SysuiTestCase() {
|
|||||||
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
utils.authenticationRepository.setAutoConfirmEnabled(true)
|
utils.authenticationRepository.setAutoConfirmEnabled(true)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
FakeAuthenticationRepository.DEFAULT_PIN.forEach { digit ->
|
FakeAuthenticationRepository.DEFAULT_PIN.forEach { digit ->
|
||||||
@@ -277,7 +277,7 @@ class PinBouncerViewModelTest : SysuiTestCase() {
|
|||||||
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
||||||
utils.authenticationRepository.setUnlocked(false)
|
utils.authenticationRepository.setUnlocked(false)
|
||||||
utils.authenticationRepository.setAutoConfirmEnabled(true)
|
utils.authenticationRepository.setAutoConfirmEnabled(true)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Bouncer), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
|
||||||
underTest.onShown()
|
underTest.onShown()
|
||||||
FakeAuthenticationRepository.DEFAULT_PIN.dropLast(1).forEach { digit ->
|
FakeAuthenticationRepository.DEFAULT_PIN.dropLast(1).forEach { digit ->
|
||||||
|
|||||||
@@ -130,11 +130,11 @@ class LockscreenSceneInteractorTest : SysuiTestCase() {
|
|||||||
fun switchFromLockScreenToGone_authMethodNotSwipe_doesNotUnlockDevice() =
|
fun switchFromLockScreenToGone_authMethodNotSwipe_doesNotUnlockDevice() =
|
||||||
testScope.runTest {
|
testScope.runTest {
|
||||||
val isUnlocked by collectLastValue(authenticationInteractor.isUnlocked)
|
val isUnlocked by collectLastValue(authenticationInteractor.isUnlocked)
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Lockscreen))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Lockscreen), "reason")
|
||||||
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
|
||||||
assertThat(isUnlocked).isFalse()
|
assertThat(isUnlocked).isFalse()
|
||||||
|
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Gone))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Gone), "reason")
|
||||||
|
|
||||||
assertThat(isUnlocked).isFalse()
|
assertThat(isUnlocked).isFalse()
|
||||||
}
|
}
|
||||||
@@ -144,13 +144,13 @@ class LockscreenSceneInteractorTest : SysuiTestCase() {
|
|||||||
testScope.runTest {
|
testScope.runTest {
|
||||||
val isUnlocked by collectLastValue(authenticationInteractor.isUnlocked)
|
val isUnlocked by collectLastValue(authenticationInteractor.isUnlocked)
|
||||||
runCurrent()
|
runCurrent()
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Shade))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Shade), "reason")
|
||||||
runCurrent()
|
runCurrent()
|
||||||
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Swipe)
|
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Swipe)
|
||||||
runCurrent()
|
runCurrent()
|
||||||
assertThat(isUnlocked).isFalse()
|
assertThat(isUnlocked).isFalse()
|
||||||
|
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Gone))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Gone), "reason")
|
||||||
|
|
||||||
assertThat(isUnlocked).isFalse()
|
assertThat(isUnlocked).isFalse()
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ class LockscreenSceneInteractorTest : SysuiTestCase() {
|
|||||||
val currentScene by collectLastValue(sceneInteractor.currentScene)
|
val currentScene by collectLastValue(sceneInteractor.currentScene)
|
||||||
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Swipe)
|
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Swipe)
|
||||||
runCurrent()
|
runCurrent()
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.QuickSettings))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.QuickSettings), "reason")
|
||||||
runCurrent()
|
runCurrent()
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.QuickSettings))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.QuickSettings))
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class SceneInteractorTest : SysuiTestCase() {
|
|||||||
val currentScene by collectLastValue(underTest.currentScene)
|
val currentScene by collectLastValue(underTest.currentScene)
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Lockscreen))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Lockscreen))
|
||||||
|
|
||||||
underTest.setCurrentScene(SceneModel(SceneKey.Shade))
|
underTest.setCurrentScene(SceneModel(SceneKey.Shade), "reason")
|
||||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Shade))
|
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Shade))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,10 +79,10 @@ class SceneInteractorTest : SysuiTestCase() {
|
|||||||
val isVisible by collectLastValue(underTest.isVisible)
|
val isVisible by collectLastValue(underTest.isVisible)
|
||||||
assertThat(isVisible).isTrue()
|
assertThat(isVisible).isTrue()
|
||||||
|
|
||||||
underTest.setVisible(false)
|
underTest.setVisible(false, "reason")
|
||||||
assertThat(isVisible).isFalse()
|
assertThat(isVisible).isFalse()
|
||||||
|
|
||||||
underTest.setVisible(true)
|
underTest.setVisible(true, "reason")
|
||||||
assertThat(isVisible).isTrue()
|
assertThat(isVisible).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ class SceneInteractorTest : SysuiTestCase() {
|
|||||||
assertThat(transitions).isNull()
|
assertThat(transitions).isNull()
|
||||||
|
|
||||||
val initialSceneKey = underTest.currentScene.value.key
|
val initialSceneKey = underTest.currentScene.value.key
|
||||||
underTest.setCurrentScene(SceneModel(SceneKey.Shade))
|
underTest.setCurrentScene(SceneModel(SceneKey.Shade), "reason")
|
||||||
assertThat(transitions)
|
assertThat(transitions)
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
SceneTransitionModel(
|
SceneTransitionModel(
|
||||||
@@ -101,7 +101,7 @@ class SceneInteractorTest : SysuiTestCase() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
underTest.setCurrentScene(SceneModel(SceneKey.QuickSettings))
|
underTest.setCurrentScene(SceneModel(SceneKey.QuickSettings), "reason")
|
||||||
assertThat(transitions)
|
assertThat(transitions)
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
SceneTransitionModel(
|
SceneTransitionModel(
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
|
|||||||
featureFlags = featureFlags,
|
featureFlags = featureFlags,
|
||||||
sysUiState = sysUiState,
|
sysUiState = sysUiState,
|
||||||
displayId = Display.DEFAULT_DISPLAY,
|
displayId = Display.DEFAULT_DISPLAY,
|
||||||
|
sceneLogger = mock(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@@ -97,7 +98,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
|
|||||||
|
|
||||||
assertThat(isVisible).isFalse()
|
assertThat(isVisible).isFalse()
|
||||||
|
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Shade))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Shade), "reason")
|
||||||
assertThat(isVisible).isTrue()
|
assertThat(isVisible).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,10 +118,10 @@ class SceneContainerStartableTest : SysuiTestCase() {
|
|||||||
underTest.start()
|
underTest.start()
|
||||||
assertThat(isVisible).isTrue()
|
assertThat(isVisible).isTrue()
|
||||||
|
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Gone))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Gone), "reason")
|
||||||
assertThat(isVisible).isTrue()
|
assertThat(isVisible).isTrue()
|
||||||
|
|
||||||
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Shade))
|
sceneInteractor.setCurrentScene(SceneModel(SceneKey.Shade), "reason")
|
||||||
assertThat(isVisible).isTrue()
|
assertThat(isVisible).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,7 +327,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
|
|||||||
SceneKey.QuickSettings,
|
SceneKey.QuickSettings,
|
||||||
)
|
)
|
||||||
.forEachIndexed { index, sceneKey ->
|
.forEachIndexed { index, sceneKey ->
|
||||||
sceneInteractor.setCurrentScene(SceneModel(sceneKey))
|
sceneInteractor.setCurrentScene(SceneModel(sceneKey), "reason")
|
||||||
runCurrent()
|
runCurrent()
|
||||||
|
|
||||||
verify(sysUiState, times(index + 1)).commitUpdate(Display.DEFAULT_DISPLAY)
|
verify(sysUiState, times(index + 1)).commitUpdate(Display.DEFAULT_DISPLAY)
|
||||||
@@ -342,7 +343,7 @@ class SceneContainerStartableTest : SysuiTestCase() {
|
|||||||
featureFlags.set(Flags.SCENE_CONTAINER, isFeatureEnabled)
|
featureFlags.set(Flags.SCENE_CONTAINER, isFeatureEnabled)
|
||||||
authenticationRepository.setUnlocked(isDeviceUnlocked)
|
authenticationRepository.setUnlocked(isDeviceUnlocked)
|
||||||
keyguardRepository.setBypassEnabled(isBypassEnabled)
|
keyguardRepository.setBypassEnabled(isBypassEnabled)
|
||||||
initialSceneKey?.let { sceneInteractor.setCurrentScene(SceneModel(it)) }
|
initialSceneKey?.let { sceneInteractor.setCurrentScene(SceneModel(it), "reason") }
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
@@ -52,10 +52,10 @@ class SceneContainerViewModelTest : SysuiTestCase() {
|
|||||||
val isVisible by collectLastValue(underTest.isVisible)
|
val isVisible by collectLastValue(underTest.isVisible)
|
||||||
assertThat(isVisible).isTrue()
|
assertThat(isVisible).isTrue()
|
||||||
|
|
||||||
interactor.setVisible(false)
|
interactor.setVisible(false, "reason")
|
||||||
assertThat(isVisible).isFalse()
|
assertThat(isVisible).isFalse()
|
||||||
|
|
||||||
interactor.setVisible(true)
|
interactor.setVisible(true, "reason")
|
||||||
assertThat(isVisible).isTrue()
|
assertThat(isVisible).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ class SceneTestUtils(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val context = test.context
|
private val context = test.context
|
||||||
|
|
||||||
fun fakeSceneContainerRepository(
|
fun fakeSceneContainerRepository(
|
||||||
@@ -124,6 +125,7 @@ class SceneTestUtils(
|
|||||||
): SceneInteractor {
|
): SceneInteractor {
|
||||||
return SceneInteractor(
|
return SceneInteractor(
|
||||||
repository = repository,
|
repository = repository,
|
||||||
|
logger = mock(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user