Remove sceneInteractor and deviceEntry dependencies from BouncerInteractor and AuthenticationInteractor
Summary of changes:
- BouncerInteractor does not have the responsibility of handling scene transitions, it is now managed only by SceneContainerStartable
- Eagerly start State flows in DeviceEntryInteractor as there are non collecting consumers for the flow.
- Remove Swipe as an AuthenticationMethod, no authentication flow cares specifically about Swipe.
- Expose Swipe "authentication" method through DeviceEntryInteractor#canSwipeToEnter
- Change usages of Swipe "authentication" method to DeviceEntry.canSwipeToEnter
Test: all affected unit tests
Bug: 310005730
Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT
Change-Id: Ie89c0217b9302826ef4e637fecb4f229f9a8acaa
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerActionButtonInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerActionButtonInteractorTest.kt
index 15d4d20..67ce86b 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerActionButtonInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerActionButtonInteractorTest.kt
@@ -25,7 +25,7 @@
import com.android.internal.logging.testing.FakeMetricsLogger
import com.android.internal.util.EmergencyAffordanceManager
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.flags.Flags.REFACTOR_GETCURRENTUSER
import com.android.systemui.log.table.TableLogBuffer
diff --git a/packages/SystemUI/src/com/android/systemui/authentication/data/repository/AuthenticationRepository.kt b/packages/SystemUI/src/com/android/systemui/authentication/data/repository/AuthenticationRepository.kt
index 14cbf76..ee3a55f 100644
--- a/packages/SystemUI/src/com/android/systemui/authentication/data/repository/AuthenticationRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/authentication/data/repository/AuthenticationRepository.kt
@@ -25,7 +25,7 @@
import com.android.internal.widget.LockPatternUtils
import com.android.internal.widget.LockscreenCredential
import com.android.keyguard.KeyguardSecurityModel
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.authentication.shared.model.AuthenticationResultModel
import com.android.systemui.authentication.shared.model.AuthenticationThrottlingModel
import com.android.systemui.broadcast.BroadcastDispatcher
diff --git a/packages/SystemUI/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractor.kt b/packages/SystemUI/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractor.kt
index 321293f..1ede530 100644
--- a/packages/SystemUI/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractor.kt
@@ -19,15 +19,13 @@
import com.android.app.tracing.TraceUtils.Companion.withContext
import com.android.internal.widget.LockPatternView
import com.android.internal.widget.LockscreenCredential
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel as DataLayerAuthenticationMethodModel
import com.android.systemui.authentication.data.repository.AuthenticationRepository
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel as DomainLayerAuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.authentication.shared.model.AuthenticationPatternCoordinate
import com.android.systemui.authentication.shared.model.AuthenticationThrottlingModel
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
-import com.android.systemui.deviceentry.data.repository.DeviceEntryRepository
import com.android.systemui.user.data.repository.UserRepository
import com.android.systemui.util.time.SystemClock
import javax.inject.Inject
@@ -63,7 +61,6 @@
private val repository: AuthenticationRepository,
@Background private val backgroundDispatcher: CoroutineDispatcher,
private val userRepository: UserRepository,
- private val deviceEntryRepository: DeviceEntryRepository,
private val clock: SystemClock,
) {
/**
@@ -84,8 +81,7 @@
* `true` even when the lockscreen is showing and still needs to be dismissed by the user to
* proceed.
*/
- val authenticationMethod: Flow<DomainLayerAuthenticationMethodModel> =
- repository.authenticationMethod.map { rawModel -> rawModel.toDomainLayer() }
+ val authenticationMethod: Flow<AuthenticationMethodModel> = repository.authenticationMethod
/** The current authentication throttling state, only meaningful if [isThrottled] is `true`. */
val throttling: StateFlow<AuthenticationThrottlingModel> = repository.throttling
@@ -171,17 +167,8 @@
* The flow should be used for code that wishes to stay up-to-date its logic as the
* authentication changes over time and this method should be used for simple code that only
* needs to check the current value.
- *
- * Note: this layer adds the synthetic authentication method of "swipe" which is special. When
- * the current authentication method is "swipe", the user does not need to complete any
- * authentication challenge to unlock the device; they just need to dismiss the lockscreen to
- * get past it. This also means that the value of `DeviceEntryInteractor#isUnlocked` remains
- * `true` even when the lockscreen is showing and still needs to be dismissed by the user to
- * proceed.
*/
- suspend fun getAuthenticationMethod(): DomainLayerAuthenticationMethodModel {
- return repository.getAuthenticationMethod().toDomainLayer()
- }
+ suspend fun getAuthenticationMethod() = repository.getAuthenticationMethod()
/**
* Attempts to authenticate the user and unlock the device.
@@ -211,13 +198,13 @@
// attempt.
isThrottled.value -> true
// The pattern is too short; skip the attempt.
- authMethod == DomainLayerAuthenticationMethodModel.Pattern &&
+ authMethod == AuthenticationMethodModel.Pattern &&
input.size < repository.minPatternLength -> true
// Auto-confirm attempt when the feature is not enabled; skip the attempt.
tryAutoConfirm && !isAutoConfirmEnabled.value -> true
// Auto-confirm should skip the attempt if the pin entered is too short.
tryAutoConfirm &&
- authMethod == DomainLayerAuthenticationMethodModel.Pin &&
+ authMethod == AuthenticationMethodModel.Pin &&
input.size < repository.getPinLength() -> true
else -> false
}
@@ -303,15 +290,15 @@
}
}
- private fun DomainLayerAuthenticationMethodModel.createCredential(
+ private fun AuthenticationMethodModel.createCredential(
input: List<Any>
): LockscreenCredential? {
return when (this) {
- is DomainLayerAuthenticationMethodModel.Pin ->
+ is AuthenticationMethodModel.Pin ->
LockscreenCredential.createPin(input.joinToString(""))
- is DomainLayerAuthenticationMethodModel.Password ->
+ is AuthenticationMethodModel.Password ->
LockscreenCredential.createPassword(input.joinToString(""))
- is DomainLayerAuthenticationMethodModel.Pattern ->
+ is AuthenticationMethodModel.Pattern ->
LockscreenCredential.createPattern(
input
.map { it as AuthenticationPatternCoordinate }
@@ -321,23 +308,6 @@
}
}
- private suspend fun DataLayerAuthenticationMethodModel.toDomainLayer():
- DomainLayerAuthenticationMethodModel {
- return when (this) {
- is DataLayerAuthenticationMethodModel.None ->
- if (deviceEntryRepository.isInsecureLockscreenEnabled()) {
- DomainLayerAuthenticationMethodModel.Swipe
- } else {
- DomainLayerAuthenticationMethodModel.None
- }
- is DataLayerAuthenticationMethodModel.Pin -> DomainLayerAuthenticationMethodModel.Pin
- is DataLayerAuthenticationMethodModel.Password ->
- DomainLayerAuthenticationMethodModel.Password
- is DataLayerAuthenticationMethodModel.Pattern ->
- DomainLayerAuthenticationMethodModel.Pattern
- }
- }
-
companion object {
const val TAG = "AuthenticationInteractor"
}
diff --git a/packages/SystemUI/src/com/android/systemui/authentication/domain/model/AuthenticationMethodModel.kt b/packages/SystemUI/src/com/android/systemui/authentication/domain/model/AuthenticationMethodModel.kt
deleted file mode 100644
index d7e6099..0000000
--- a/packages/SystemUI/src/com/android/systemui/authentication/domain/model/AuthenticationMethodModel.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.authentication.domain.model
-
-/** Enumerates all known authentication methods. */
-sealed class AuthenticationMethodModel(
- /**
- * Whether the authentication method is considered to be "secure".
- *
- * "Secure" authentication methods require authentication to unlock the device. Non-secure auth
- * methods simply require user dismissal.
- */
- open val isSecure: Boolean,
-) {
- /** There is no authentication method on the device. We shouldn't even show the lock screen. */
- object None : AuthenticationMethodModel(isSecure = false)
-
- /** The most basic authentication method. The lock screen can be swiped away when displayed. */
- object Swipe : AuthenticationMethodModel(isSecure = false)
-
- object Pin : AuthenticationMethodModel(isSecure = true)
-
- object Password : AuthenticationMethodModel(isSecure = true)
-
- object Pattern : AuthenticationMethodModel(isSecure = true)
-}
diff --git a/packages/SystemUI/src/com/android/systemui/authentication/data/model/AuthenticationMethodModel.kt b/packages/SystemUI/src/com/android/systemui/authentication/shared/model/AuthenticationMethodModel.kt
similarity index 81%
rename from packages/SystemUI/src/com/android/systemui/authentication/data/model/AuthenticationMethodModel.kt
rename to packages/SystemUI/src/com/android/systemui/authentication/shared/model/AuthenticationMethodModel.kt
index 6d23b11..bb5b81d 100644
--- a/packages/SystemUI/src/com/android/systemui/authentication/data/model/AuthenticationMethodModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/authentication/shared/model/AuthenticationMethodModel.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 The Android Open Source Project
+ * 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.systemui.authentication.data.model
+package com.android.systemui.authentication.shared.model
/** Enumerates all known authentication methods. */
sealed class AuthenticationMethodModel(
@@ -26,7 +26,10 @@
*/
open val isSecure: Boolean,
) {
- /** There is no authentication method on the device. We shouldn't even show the lock screen. */
+ /**
+ * Device doesn't use a secure authentication method. Either there is no lockscreen or the lock
+ * screen can be swiped away when displayed.
+ */
object None : AuthenticationMethodModel(isSecure = false)
object Pin : AuthenticationMethodModel(isSecure = true)
diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractor.kt b/packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractor.kt
index 94f1c2d..4e1cddc 100644
--- a/packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractor.kt
@@ -19,7 +19,7 @@
import android.content.Context
import com.android.systemui.authentication.domain.interactor.AuthenticationInteractor
import com.android.systemui.authentication.domain.interactor.AuthenticationResult
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.authentication.shared.model.AuthenticationThrottlingModel
import com.android.systemui.bouncer.data.repository.BouncerRepository
import com.android.systemui.classifier.FalsingClassifier
@@ -27,15 +27,14 @@
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.res.R
-import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.shared.flag.SceneContainerFlags
-import com.android.systemui.scene.shared.model.SceneKey
-import com.android.systemui.scene.shared.model.SceneModel
import com.android.systemui.util.kotlin.pairwise
import javax.inject.Inject
import kotlin.time.Duration.Companion.milliseconds
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.async
+import kotlinx.coroutines.flow.MutableSharedFlow
+import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine
@@ -51,7 +50,6 @@
@Application private val applicationContext: Context,
private val repository: BouncerRepository,
private val authenticationInteractor: AuthenticationInteractor,
- private val sceneInteractor: SceneInteractor,
flags: SceneContainerFlags,
private val falsingInteractor: FalsingInteractor,
) {
@@ -98,6 +96,10 @@
val isUserSwitcherVisible: Boolean
get() = repository.isUserSwitcherVisible
+ private val _onImeHidden = MutableSharedFlow<Unit>()
+ /** Provide the onImeHidden events from the bouncer */
+ val onImeHidden: SharedFlow<Unit> = _onImeHidden
+
init {
if (flags.isEnabled()) {
// Clear the message if moved from throttling to no-longer throttling.
@@ -208,16 +210,8 @@
}
/** Notifies the interactor that the input method editor has been hidden. */
- fun onImeHidden() {
- // If the bouncer is showing, hide it and return to the lockscreen scene.
- if (sceneInteractor.desiredScene.value.key != SceneKey.Bouncer) {
- return
- }
-
- sceneInteractor.changeScene(
- scene = SceneModel(SceneKey.Lockscreen),
- loggingReason = "IME hidden",
- )
+ suspend fun onImeHidden() {
+ _onImeHidden.emit(Unit)
}
private fun promptMessage(authMethod: AuthenticationMethodModel): String {
diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModel.kt b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModel.kt
index 55bc653..f46574c 100644
--- a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModel.kt
@@ -18,7 +18,7 @@
import android.annotation.StringRes
import com.android.systemui.authentication.domain.interactor.AuthenticationResult
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.bouncer.domain.interactor.BouncerInteractor
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.MutableStateFlow
@@ -75,7 +75,7 @@
* Notifies that the input method editor (for example, the software keyboard) has been shown or
* hidden.
*/
- fun onImeVisibilityChanged(isVisible: Boolean) {
+ suspend fun onImeVisibilityChanged(isVisible: Boolean) {
if (isImeVisible && !isVisible) {
interactor.onImeHidden()
}
diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModel.kt b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModel.kt
index 4767e21..09c94c8 100644
--- a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModel.kt
@@ -20,7 +20,7 @@
import android.graphics.Bitmap
import androidx.core.graphics.drawable.toBitmap
import com.android.systemui.authentication.domain.interactor.AuthenticationInteractor
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.bouncer.domain.interactor.BouncerActionButtonInteractor
import com.android.systemui.bouncer.domain.interactor.BouncerInteractor
import com.android.systemui.bouncer.shared.model.BouncerActionButtonModel
diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModel.kt b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModel.kt
index fe77419..a15698e 100644
--- a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModel.kt
@@ -16,7 +16,7 @@
package com.android.systemui.bouncer.ui.viewmodel
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.bouncer.domain.interactor.BouncerInteractor
import com.android.systemui.res.R
import kotlinx.coroutines.CoroutineScope
diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModel.kt b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModel.kt
index d301085..ed6a48f 100644
--- a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModel.kt
@@ -18,7 +18,7 @@
import android.content.Context
import android.util.TypedValue
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.authentication.shared.model.AuthenticationPatternCoordinate
import com.android.systemui.bouncer.domain.interactor.BouncerInteractor
import com.android.systemui.res.R
diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModel.kt b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModel.kt
index b90e255..2ed0d5d 100644
--- a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModel.kt
@@ -18,7 +18,7 @@
import android.content.Context
import com.android.keyguard.PinShapeAdapter
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.bouncer.domain.interactor.BouncerInteractor
import com.android.systemui.res.R
import kotlinx.coroutines.CoroutineScope
diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryRepository.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryRepository.kt
index 64fd2b3..f27bbe6 100644
--- a/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryRepository.kt
@@ -39,10 +39,11 @@
val isUnlocked: StateFlow<Boolean>
/**
- * Whether the lockscreen should be shown when the authentication method is not secure (e.g.
- * `None` or `Swipe`).
+ * Whether the lockscreen is enabled for the current user. This is `true` whenever the user has
+ * chosen any secure authentication method and even if they set the lockscreen to be dismissed
+ * when the user swipes on it.
*/
- suspend fun isInsecureLockscreenEnabled(): Boolean
+ suspend fun isLockscreenEnabled(): Boolean
/** Report successful authentication for device entry. */
fun reportSuccessfulAuthentication()
@@ -117,7 +118,7 @@
override val isUnlocked: StateFlow<Boolean> = _isUnlocked.asStateFlow()
- override suspend fun isInsecureLockscreenEnabled(): Boolean {
+ override suspend fun isLockscreenEnabled(): Boolean {
return withContext(backgroundDispatcher) {
val selectedUserId = userRepository.getSelectedUserInfo().id
!lockPatternUtils.isLockScreenDisabled(selectedUserId)
diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractor.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractor.kt
index 2f9087b..c3f3529 100644
--- a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractor.kt
@@ -17,7 +17,7 @@
package com.android.systemui.deviceentry.domain.interactor
import com.android.systemui.authentication.domain.interactor.AuthenticationInteractor
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.deviceentry.data.repository.DeviceEntryRepository
@@ -36,6 +36,7 @@
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.merge
+import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
@@ -95,28 +96,33 @@
.map { it == SceneKey.Gone }
.stateIn(
scope = applicationScope,
- started = SharingStarted.WhileSubscribed(),
+ started = SharingStarted.Eagerly,
initialValue = false,
)
// Authenticated by a TrustAgent like trusted device, location, etc or by face auth.
private val passivelyAuthenticated =
merge(
- trustRepository.isCurrentUserTrusted,
- deviceEntryFaceAuthRepository.isAuthenticated,
- )
+ trustRepository.isCurrentUserTrusted,
+ deviceEntryFaceAuthRepository.isAuthenticated,
+ )
+ .onStart { emit(false) }
/**
* Whether it's currently possible to swipe up to enter the device without requiring
- * authentication. This returns `false` whenever the lockscreen has been dismissed.
+ * authentication or when the device is already authenticated using a passive authentication
+ * mechanism like face or trust manager. This returns `false` whenever the lockscreen has been
+ * dismissed.
*
* Note: `true` doesn't mean the lockscreen is visible. It may be occluded or covered by other
* UI.
*/
val canSwipeToEnter =
combine(
+ // This is true when the user has chosen to show the lockscreen but has not made it
+ // secure.
authenticationInteractor.authenticationMethod.map {
- it == AuthenticationMethodModel.Swipe
+ it == AuthenticationMethodModel.None && repository.isLockscreenEnabled()
},
passivelyAuthenticated,
isDeviceEntered
@@ -125,7 +131,7 @@
}
.stateIn(
scope = applicationScope,
- started = SharingStarted.WhileSubscribed(),
+ started = SharingStarted.Eagerly,
initialValue = false,
)
@@ -164,10 +170,10 @@
}
/**
- * Whether lock screen bypass is enabled. When enabled, the lock screen will be automatically
+ * Whether lockscreen bypass is enabled. When enabled, the lockscreen will be automatically
* dismissed once the authentication challenge is completed. For example, completing a biometric
* authentication challenge via face unlock or fingerprint sensor can automatically bypass the
- * lock screen.
+ * lockscreen.
*/
val isBypassEnabled: StateFlow<Boolean> = repository.isBypassEnabled
diff --git a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
index 91b4d17..ca2828b 100644
--- a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
+++ b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt
@@ -19,8 +19,7 @@
package com.android.systemui.scene.domain.startable
import com.android.systemui.CoreStartable
-import com.android.systemui.authentication.domain.interactor.AuthenticationInteractor
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel
+import com.android.systemui.bouncer.domain.interactor.BouncerInteractor
import com.android.systemui.classifier.FalsingCollector
import com.android.systemui.classifier.FalsingCollectorActual
import com.android.systemui.dagger.SysUISingleton
@@ -45,6 +44,7 @@
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.distinctUntilChangedBy
import kotlinx.coroutines.flow.emptyFlow
@@ -64,7 +64,7 @@
@Application private val applicationScope: CoroutineScope,
private val sceneInteractor: SceneInteractor,
private val deviceEntryInteractor: DeviceEntryInteractor,
- private val authenticationInteractor: AuthenticationInteractor,
+ private val bouncerInteractor: BouncerInteractor,
private val keyguardInteractor: KeyguardInteractor,
private val flags: SceneContainerFlags,
private val sysUiState: SysUiState,
@@ -121,6 +121,17 @@
/** Switches between scenes based on ever-changing application state. */
private fun automaticallySwitchScenes() {
applicationScope.launch {
+ // TODO (b/308001302): Move this to a bouncer specific interactor.
+ bouncerInteractor.onImeHidden.collectLatest {
+ if (sceneInteractor.desiredScene.value.key == SceneKey.Bouncer) {
+ sceneInteractor.changeScene(
+ scene = SceneModel(SceneKey.Lockscreen),
+ loggingReason = "IME hidden",
+ )
+ }
+ }
+ }
+ applicationScope.launch {
deviceEntryInteractor.isUnlocked
.mapNotNull { isUnlocked ->
val renderedScenes =
@@ -132,41 +143,41 @@
transitionState.toScene,
)
}
+ val isOnLockscreen = renderedScenes.contains(SceneKey.Lockscreen)
+ val isOnBouncer = renderedScenes.contains(SceneKey.Bouncer)
+ if (!isUnlocked) {
+ return@mapNotNull if (isOnLockscreen || isOnBouncer) {
+ // Already on lockscreen or bouncer, no need to change scenes.
+ null
+ } else {
+ // The device locked while on a scene that's not Lockscreen or Bouncer,
+ // go to Lockscreen.
+ SceneKey.Lockscreen to
+ "device locked in non-Lockscreen and non-Bouncer scene"
+ }
+ }
+
+ val isBypassEnabled = deviceEntryInteractor.isBypassEnabled.value
+ val canSwipeToEnter = deviceEntryInteractor.canSwipeToEnter.value
when {
- isUnlocked ->
- when {
- // When the device becomes unlocked in Bouncer, go to Gone.
- renderedScenes.contains(SceneKey.Bouncer) ->
- SceneKey.Gone to "device unlocked in Bouncer scene"
-
- // When the device becomes unlocked in Lockscreen, go to Gone if
- // bypass is enabled.
- renderedScenes.contains(SceneKey.Lockscreen) ->
- if (deviceEntryInteractor.isBypassEnabled.value) {
- SceneKey.Gone to
- "device unlocked in Lockscreen scene with bypass"
- } else {
- null
- }
-
- // We got unlocked while on a scene that's not Lockscreen or
- // Bouncer, no need to change scenes.
- else -> null
- }
-
- // When the device becomes locked, to Lockscreen.
- !isUnlocked ->
- when {
- // Already on lockscreen or bouncer, no need to change scenes.
- renderedScenes.contains(SceneKey.Lockscreen) ||
- renderedScenes.contains(SceneKey.Bouncer) -> null
-
- // We got locked while on a scene that's not Lockscreen or Bouncer,
- // go to Lockscreen.
- else ->
- SceneKey.Lockscreen to
- "device locked in non-Lockscreen and non-Bouncer scene"
- }
+ isOnBouncer ->
+ // When the device becomes unlocked in Bouncer, go to Gone.
+ SceneKey.Gone to "device was unlocked in Bouncer scene"
+ isOnLockscreen ->
+ // The lockscreen should be dismissed automatically in 2 scenarios:
+ // 1. When face auth bypass is enabled and authentication happens while
+ // the user is on the lockscreen.
+ // 2. Whenever the user authenticates using an active authentication
+ // mechanism like fingerprint auth. Since canSwipeToEnter is true
+ // when the user is passively authenticated, the false value here
+ // when the unlock state changes indicates this is an active
+ // authentication attempt.
+ if (isBypassEnabled || !canSwipeToEnter)
+ SceneKey.Gone to
+ "device has been unlocked on lockscreen with either " +
+ "bypass enabled or using an active authentication mechanism"
+ else null
+ // Not on lockscreen or bouncer, so remain in the current scene.
else -> null
}
}
@@ -186,24 +197,15 @@
loggingReason = "device is starting to sleep",
)
} else {
- val authMethod = authenticationInteractor.getAuthenticationMethod()
+ val canSwipeToEnter = deviceEntryInteractor.canSwipeToEnter.value
val isUnlocked = deviceEntryInteractor.isUnlocked.value
- when {
- authMethod == AuthenticationMethodModel.None -> {
- switchToScene(
- targetSceneKey = SceneKey.Gone,
- loggingReason =
- "device is starting to wake up while auth method is" + " none",
- )
- }
- authMethod.isSecure && isUnlocked -> {
- switchToScene(
- targetSceneKey = SceneKey.Gone,
- loggingReason =
- "device is starting to wake up while unlocked with a" +
- " secure auth method",
- )
- }
+ if (isUnlocked && !canSwipeToEnter) {
+ switchToScene(
+ targetSceneKey = SceneKey.Gone,
+ loggingReason =
+ "device is waking up while unlocked without the ability" +
+ " to swipe up on lockscreen to enter.",
+ )
}
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/authentication/data/repository/AuthenticationRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/authentication/data/repository/AuthenticationRepositoryTest.kt
index bdb2eea..ae2ec2c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/authentication/data/repository/AuthenticationRepositoryTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/authentication/data/repository/AuthenticationRepositoryTest.kt
@@ -26,7 +26,7 @@
import com.android.internal.widget.LockPatternUtils
import com.android.keyguard.KeyguardSecurityModel
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.coroutines.collectValues
import com.android.systemui.scene.SceneTestUtils
diff --git a/packages/SystemUI/tests/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractorTest.kt
index ed059b5..7439db2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractorTest.kt
@@ -20,9 +20,8 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel as DataLayerAuthenticationMethodModel
import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel as DomainLayerAuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.authentication.shared.model.AuthenticationPatternCoordinate
import com.android.systemui.authentication.shared.model.AuthenticationThrottlingModel
import com.android.systemui.coroutines.collectLastValue
@@ -51,33 +50,16 @@
testScope.runTest {
val authMethod by collectLastValue(underTest.authenticationMethod)
runCurrent()
- assertThat(authMethod).isEqualTo(DomainLayerAuthenticationMethodModel.Pin)
- assertThat(underTest.getAuthenticationMethod())
- .isEqualTo(DomainLayerAuthenticationMethodModel.Pin)
+ assertThat(authMethod).isEqualTo(AuthenticationMethodModel.Pin)
+ assertThat(underTest.getAuthenticationMethod()).isEqualTo(AuthenticationMethodModel.Pin)
utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.Password
+ AuthenticationMethodModel.Password
)
- assertThat(authMethod).isEqualTo(DomainLayerAuthenticationMethodModel.Password)
+ assertThat(authMethod).isEqualTo(AuthenticationMethodModel.Password)
assertThat(underTest.getAuthenticationMethod())
- .isEqualTo(DomainLayerAuthenticationMethodModel.Password)
- }
-
- @Test
- fun authenticationMethod_noneTreatedAsSwipe_whenLockscreenEnabled() =
- testScope.runTest {
- val authMethod by collectLastValue(underTest.authenticationMethod)
- runCurrent()
-
- utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.None
- )
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(true)
-
- assertThat(authMethod).isEqualTo(DomainLayerAuthenticationMethodModel.Swipe)
- assertThat(underTest.getAuthenticationMethod())
- .isEqualTo(DomainLayerAuthenticationMethodModel.Swipe)
+ .isEqualTo(AuthenticationMethodModel.Password)
}
@Test
@@ -86,23 +68,18 @@
val authMethod by collectLastValue(underTest.authenticationMethod)
runCurrent()
- utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.None
- )
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(false)
+ utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.None)
- assertThat(authMethod).isEqualTo(DomainLayerAuthenticationMethodModel.None)
+ assertThat(authMethod).isEqualTo(AuthenticationMethodModel.None)
assertThat(underTest.getAuthenticationMethod())
- .isEqualTo(DomainLayerAuthenticationMethodModel.None)
+ .isEqualTo(AuthenticationMethodModel.None)
}
@Test
fun authenticate_withCorrectPin_returnsTrue() =
testScope.runTest {
val isThrottled by collectLastValue(underTest.isThrottled)
- utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.Pin
- )
+ utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
assertThat(underTest.authenticate(FakeAuthenticationRepository.DEFAULT_PIN))
.isEqualTo(AuthenticationResult.SUCCEEDED)
assertThat(isThrottled).isFalse()
@@ -111,9 +88,7 @@
@Test
fun authenticate_withIncorrectPin_returnsFalse() =
testScope.runTest {
- utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.Pin
- )
+ utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
assertThat(underTest.authenticate(listOf(9, 8, 7, 6, 5, 4)))
.isEqualTo(AuthenticationResult.FAILED)
}
@@ -121,9 +96,7 @@
@Test(expected = IllegalArgumentException::class)
fun authenticate_withEmptyPin_throwsException() =
testScope.runTest {
- utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.Pin
- )
+ utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
underTest.authenticate(listOf())
}
@@ -132,7 +105,7 @@
testScope.runTest {
val pin = List(16) { 9 }
utils.authenticationRepository.apply {
- setAuthenticationMethod(DataLayerAuthenticationMethodModel.Pin)
+ setAuthenticationMethod(AuthenticationMethodModel.Pin)
overrideCredential(pin)
}
@@ -148,9 +121,7 @@
// If the policy changes, there is work to do in SysUI.
assertThat(DevicePolicyManager.MAX_PASSWORD_LENGTH).isLessThan(17)
- utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.Pin
- )
+ utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
assertThat(underTest.authenticate(List(17) { 9 }))
.isEqualTo(AuthenticationResult.FAILED)
}
@@ -160,7 +131,7 @@
testScope.runTest {
val isThrottled by collectLastValue(underTest.isThrottled)
utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.Password
+ AuthenticationMethodModel.Password
)
assertThat(underTest.authenticate("password".toList()))
@@ -172,7 +143,7 @@
fun authenticate_withIncorrectPassword_returnsFalse() =
testScope.runTest {
utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.Password
+ AuthenticationMethodModel.Password
)
assertThat(underTest.authenticate("alohomora".toList()))
@@ -183,7 +154,7 @@
fun authenticate_withCorrectPattern_returnsTrue() =
testScope.runTest {
utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.Pattern
+ AuthenticationMethodModel.Pattern
)
assertThat(underTest.authenticate(FakeAuthenticationRepository.PATTERN))
@@ -194,7 +165,7 @@
fun authenticate_withIncorrectPattern_returnsFalse() =
testScope.runTest {
utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.Pattern
+ AuthenticationMethodModel.Pattern
)
assertThat(
@@ -216,7 +187,7 @@
val isAutoConfirmEnabled by collectLastValue(underTest.isAutoConfirmEnabled)
val isThrottled by collectLastValue(underTest.isThrottled)
utils.authenticationRepository.apply {
- setAuthenticationMethod(DataLayerAuthenticationMethodModel.Pin)
+ setAuthenticationMethod(AuthenticationMethodModel.Pin)
setAutoConfirmFeatureEnabled(true)
}
assertThat(isAutoConfirmEnabled).isTrue()
@@ -238,7 +209,7 @@
testScope.runTest {
val isAutoConfirmEnabled by collectLastValue(underTest.isAutoConfirmEnabled)
utils.authenticationRepository.apply {
- setAuthenticationMethod(DataLayerAuthenticationMethodModel.Pin)
+ setAuthenticationMethod(AuthenticationMethodModel.Pin)
setAutoConfirmFeatureEnabled(true)
}
assertThat(isAutoConfirmEnabled).isTrue()
@@ -257,7 +228,7 @@
testScope.runTest {
val isAutoConfirmEnabled by collectLastValue(underTest.isAutoConfirmEnabled)
utils.authenticationRepository.apply {
- setAuthenticationMethod(DataLayerAuthenticationMethodModel.Pin)
+ setAuthenticationMethod(AuthenticationMethodModel.Pin)
setAutoConfirmFeatureEnabled(true)
}
assertThat(isAutoConfirmEnabled).isTrue()
@@ -276,7 +247,7 @@
testScope.runTest {
val isAutoConfirmEnabled by collectLastValue(underTest.isAutoConfirmEnabled)
utils.authenticationRepository.apply {
- setAuthenticationMethod(DataLayerAuthenticationMethodModel.Pin)
+ setAuthenticationMethod(AuthenticationMethodModel.Pin)
setAutoConfirmFeatureEnabled(true)
}
assertThat(isAutoConfirmEnabled).isTrue()
@@ -297,7 +268,7 @@
val isUnlocked by collectLastValue(utils.deviceEntryRepository.isUnlocked)
val hintedPinLength by collectLastValue(underTest.hintedPinLength)
utils.authenticationRepository.apply {
- setAuthenticationMethod(DataLayerAuthenticationMethodModel.Pin)
+ setAuthenticationMethod(AuthenticationMethodModel.Pin)
setAutoConfirmFeatureEnabled(true)
setThrottleDuration(42)
}
@@ -318,7 +289,7 @@
fun tryAutoConfirm_withoutAutoConfirmButCorrectPin_returnsNull() =
testScope.runTest {
utils.authenticationRepository.apply {
- setAuthenticationMethod(DataLayerAuthenticationMethodModel.Pin)
+ setAuthenticationMethod(AuthenticationMethodModel.Pin)
setAutoConfirmFeatureEnabled(false)
}
assertThat(
@@ -334,7 +305,7 @@
fun tryAutoConfirm_withoutCorrectPassword_returnsNull() =
testScope.runTest {
utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.Password
+ AuthenticationMethodModel.Password
)
assertThat(underTest.authenticate("password".toList(), tryAutoConfirm = true))
@@ -346,9 +317,7 @@
testScope.runTest {
val throttling by collectLastValue(underTest.throttling)
val isThrottled by collectLastValue(underTest.isThrottled)
- utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.Pin
- )
+ utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
underTest.authenticate(FakeAuthenticationRepository.DEFAULT_PIN)
assertThat(isThrottled).isFalse()
assertThat(throttling).isEqualTo(AuthenticationThrottlingModel())
@@ -429,7 +398,7 @@
testScope.runTest {
val hintedPinLength by collectLastValue(underTest.hintedPinLength)
utils.authenticationRepository.apply {
- setAuthenticationMethod(DataLayerAuthenticationMethodModel.Pin)
+ setAuthenticationMethod(AuthenticationMethodModel.Pin)
setAutoConfirmFeatureEnabled(false)
}
@@ -441,7 +410,7 @@
testScope.runTest {
val hintedPinLength by collectLastValue(underTest.hintedPinLength)
utils.authenticationRepository.apply {
- setAuthenticationMethod(DataLayerAuthenticationMethodModel.Pin)
+ setAuthenticationMethod(AuthenticationMethodModel.Pin)
overrideCredential(
buildList {
repeat(utils.authenticationRepository.hintedPinLength - 1) { add(it + 1) }
@@ -458,7 +427,7 @@
testScope.runTest {
val hintedPinLength by collectLastValue(underTest.hintedPinLength)
utils.authenticationRepository.apply {
- setAuthenticationMethod(DataLayerAuthenticationMethodModel.Pin)
+ setAuthenticationMethod(AuthenticationMethodModel.Pin)
setAutoConfirmFeatureEnabled(true)
overrideCredential(
buildList {
@@ -475,7 +444,7 @@
testScope.runTest {
val hintedPinLength by collectLastValue(underTest.hintedPinLength)
utils.authenticationRepository.apply {
- setAuthenticationMethod(DataLayerAuthenticationMethodModel.Pin)
+ setAuthenticationMethod(AuthenticationMethodModel.Pin)
overrideCredential(
buildList {
repeat(utils.authenticationRepository.hintedPinLength + 1) { add(it + 1) }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorTest.kt
index 8a7c362..6ead0e9 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/bouncer/domain/interactor/BouncerInteractorTest.kt
@@ -19,16 +19,14 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel
import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository
import com.android.systemui.authentication.domain.interactor.AuthenticationResult
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.authentication.shared.model.AuthenticationPatternCoordinate
import com.android.systemui.authentication.shared.model.AuthenticationThrottlingModel
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.res.R
import com.android.systemui.scene.SceneTestUtils
-import com.android.systemui.scene.shared.model.SceneKey
-import com.android.systemui.scene.shared.model.SceneModel
import com.google.common.truth.Truth.assertThat
import kotlin.math.ceil
import kotlin.time.Duration.Companion.milliseconds
@@ -43,17 +41,14 @@
@OptIn(ExperimentalCoroutinesApi::class)
@SmallTest
@RunWith(AndroidJUnit4::class)
-class
-BouncerInteractorTest : SysuiTestCase() {
+class BouncerInteractorTest : SysuiTestCase() {
private val utils = SceneTestUtils(this)
private val testScope = utils.testScope
private val authenticationInteractor = utils.authenticationInteractor()
- private val sceneInteractor = utils.sceneInteractor()
private val underTest =
utils.bouncerInteractor(
authenticationInteractor = authenticationInteractor,
- sceneInteractor = sceneInteractor,
)
@Before
@@ -69,7 +64,6 @@
@Test
fun pinAuthMethod() =
testScope.runTest {
- val currentScene by collectLastValue(sceneInteractor.desiredScene)
val message by collectLastValue(underTest.message)
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
@@ -124,7 +118,6 @@
@Test
fun pinAuthMethod_tryAutoConfirm_withoutAutoConfirmPin() =
testScope.runTest {
- val currentScene by collectLastValue(sceneInteractor.desiredScene)
val message by collectLastValue(underTest.message)
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
@@ -174,7 +167,6 @@
@Test
fun patternAuthMethod() =
testScope.runTest {
- val currentScene by collectLastValue(sceneInteractor.desiredScene)
val message by collectLastValue(underTest.message)
utils.authenticationRepository.setAuthenticationMethod(
AuthenticationMethodModel.Pattern
@@ -223,7 +215,6 @@
val isThrottled by collectLastValue(underTest.isThrottled)
val throttling by collectLastValue(underTest.throttling)
val message by collectLastValue(underTest.message)
- val currentScene by collectLastValue(sceneInteractor.desiredScene)
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
assertThat(isThrottled).isFalse()
assertThat(throttling).isEqualTo(AuthenticationThrottlingModel())
@@ -289,31 +280,15 @@
}
@Test
- fun hide_whenOnBouncerScene_hidesBouncerAndGoesToLockscreenScene() =
+ fun imeHiddenEvent_isTriggered() =
testScope.runTest {
- sceneInteractor.changeScene(SceneModel(SceneKey.Bouncer), "")
- sceneInteractor.onSceneChanged(SceneModel(SceneKey.Bouncer), "")
- val currentScene by collectLastValue(sceneInteractor.desiredScene)
- val bouncerSceneKey = currentScene?.key
- assertThat(bouncerSceneKey).isEqualTo(SceneKey.Bouncer)
+ val imeHiddenEvent by collectLastValue(underTest.onImeHidden)
+ runCurrent()
underTest.onImeHidden()
+ runCurrent()
- assertThat(currentScene?.key).isEqualTo(SceneKey.Lockscreen)
- }
-
- @Test
- fun hide_whenNotOnBouncerScene_doesNothing() =
- testScope.runTest {
- sceneInteractor.changeScene(SceneModel(SceneKey.Shade), "")
- sceneInteractor.onSceneChanged(SceneModel(SceneKey.Shade), "")
- val currentScene by collectLastValue(sceneInteractor.desiredScene)
- val notBouncerSceneKey = currentScene?.key
- assertThat(notBouncerSceneKey).isNotEqualTo(SceneKey.Bouncer)
-
- underTest.onImeHidden()
-
- assertThat(currentScene?.key).isEqualTo(notBouncerSceneKey)
+ assertThat(imeHiddenEvent).isNotNull()
}
private fun assertTryAgainMessage(
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModelTest.kt
index db64ba2..cfcb545 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModelTest.kt
@@ -19,8 +19,8 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel
import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.scene.SceneTestUtils
import com.android.systemui.scene.shared.model.SceneKey
@@ -37,17 +37,16 @@
private val utils = SceneTestUtils(this)
private val testScope = utils.testScope
- private val authenticationInteractor = utils.authenticationInteractor()
private val sceneInteractor = utils.sceneInteractor()
+ private val bouncerInteractor =
+ utils.bouncerInteractor(
+ authenticationInteractor = utils.authenticationInteractor(),
+ )
private val underTest =
PinBouncerViewModel(
applicationContext = context,
viewModelScope = testScope.backgroundScope,
- interactor =
- utils.bouncerInteractor(
- authenticationInteractor = authenticationInteractor,
- sceneInteractor = sceneInteractor,
- ),
+ interactor = bouncerInteractor,
isInputEnabled = MutableStateFlow(true),
)
@@ -79,18 +78,14 @@
@Test
fun onImeVisibilityChanged() =
testScope.runTest {
- val desiredScene by collectLastValue(sceneInteractor.desiredScene)
sceneInteractor.changeScene(SceneModel(SceneKey.Bouncer), "")
sceneInteractor.onSceneChanged(SceneModel(SceneKey.Bouncer), "")
- assertThat(desiredScene?.key).isEqualTo(SceneKey.Bouncer)
-
- underTest.onImeVisibilityChanged(false)
- assertThat(desiredScene?.key).isEqualTo(SceneKey.Bouncer)
+ val onImeHidden by collectLastValue(bouncerInteractor.onImeHidden)
underTest.onImeVisibilityChanged(true)
- assertThat(desiredScene?.key).isEqualTo(SceneKey.Bouncer)
+ assertThat(onImeHidden).isNull()
underTest.onImeVisibilityChanged(false)
- assertThat(desiredScene?.key).isEqualTo(SceneKey.Lockscreen)
+ assertThat(onImeHidden).isNotNull()
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModelTest.kt
index 382e284..f4346b5 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/BouncerViewModelTest.kt
@@ -19,10 +19,8 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel as DataLayerAuthenticationMethodModel
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel
import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel as DomainLayerAuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.flags.Flags
import com.android.systemui.scene.SceneTestUtils
@@ -51,7 +49,6 @@
private val bouncerInteractor =
utils.bouncerInteractor(
authenticationInteractor = authenticationInteractor,
- sceneInteractor = utils.sceneInteractor(),
)
private val underTest =
utils.bouncerViewModel(
@@ -90,8 +87,7 @@
@Test
fun authMethodChanged_doesNotReuseInstances() =
testScope.runTest {
- val seen =
- mutableMapOf<DomainLayerAuthenticationMethodModel, AuthMethodBouncerViewModel>()
+ val seen = mutableMapOf<AuthenticationMethodModel, AuthMethodBouncerViewModel>()
val authMethodViewModel: AuthMethodBouncerViewModel? by
collectLastValue(underTest.authMethodViewModel)
@@ -131,7 +127,7 @@
@Test
fun authMethodsToTest_returnsCompleteSampleOfAllAuthMethodTypes() {
assertThat(authMethodsToTest().map { it::class }.toSet())
- .isEqualTo(DomainLayerAuthenticationMethodModel::class.sealedSubclasses.toSet())
+ .isEqualTo(AuthenticationMethodModel::class.sealedSubclasses.toSet())
}
@Test
@@ -139,9 +135,7 @@
testScope.runTest {
val message by collectLastValue(underTest.message)
val throttling by collectLastValue(bouncerInteractor.throttling)
- utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.Pin
- )
+ utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
assertThat(message?.isUpdateAnimated).isTrue()
repeat(FakeAuthenticationRepository.MAX_FAILED_AUTH_TRIES_BEFORE_THROTTLING) {
@@ -164,9 +158,7 @@
}
)
val throttling by collectLastValue(bouncerInteractor.throttling)
- utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.Pin
- )
+ utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
assertThat(isInputEnabled).isTrue()
repeat(FakeAuthenticationRepository.MAX_FAILED_AUTH_TRIES_BEFORE_THROTTLING) {
@@ -183,9 +175,7 @@
fun throttlingDialogMessage() =
testScope.runTest {
val throttlingDialogMessage by collectLastValue(underTest.throttlingDialogMessage)
- utils.authenticationRepository.setAuthenticationMethod(
- DataLayerAuthenticationMethodModel.Pin
- )
+ utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
repeat(FakeAuthenticationRepository.MAX_FAILED_AUTH_TRIES_BEFORE_THROTTLING) {
// Wrong PIN.
@@ -237,34 +227,12 @@
assertThat(isFoldSplitRequired).isTrue()
}
- private fun authMethodsToTest(): List<DomainLayerAuthenticationMethodModel> {
+ private fun authMethodsToTest(): List<AuthenticationMethodModel> {
return listOf(
- DomainLayerAuthenticationMethodModel.None,
- DomainLayerAuthenticationMethodModel.Swipe,
- DomainLayerAuthenticationMethodModel.Pin,
- DomainLayerAuthenticationMethodModel.Password,
- DomainLayerAuthenticationMethodModel.Pattern,
- )
- }
-
- private fun FakeAuthenticationRepository.setAuthenticationMethod(
- model: DomainLayerAuthenticationMethodModel,
- ) {
- setAuthenticationMethod(
- when (model) {
- is DomainLayerAuthenticationMethodModel.None,
- is DomainLayerAuthenticationMethodModel.Swipe ->
- DataLayerAuthenticationMethodModel.None
- is DomainLayerAuthenticationMethodModel.Pin ->
- DataLayerAuthenticationMethodModel.Pin
- is DomainLayerAuthenticationMethodModel.Password ->
- DataLayerAuthenticationMethodModel.Password
- is DomainLayerAuthenticationMethodModel.Pattern ->
- DataLayerAuthenticationMethodModel.Pattern
- }
- )
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(
- model !is DomainLayerAuthenticationMethodModel.None
+ AuthenticationMethodModel.None,
+ AuthenticationMethodModel.Pin,
+ AuthenticationMethodModel.Password,
+ AuthenticationMethodModel.Pattern,
)
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModelTest.kt
index 23eba82..c498edf 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModelTest.kt
@@ -19,8 +19,7 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel as DomainAuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.res.R
import com.android.systemui.scene.SceneTestUtils
@@ -49,7 +48,6 @@
private val bouncerInteractor =
utils.bouncerInteractor(
authenticationInteractor = authenticationInteractor,
- sceneInteractor = sceneInteractor,
)
private val bouncerViewModel =
utils.bouncerViewModel(
@@ -82,8 +80,7 @@
assertThat(message?.text).isEqualTo(ENTER_YOUR_PASSWORD)
assertThat(password).isEqualTo("")
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
- assertThat(underTest.authenticationMethod)
- .isEqualTo(DomainAuthenticationMethodModel.Password)
+ assertThat(underTest.authenticationMethod).isEqualTo(AuthenticationMethodModel.Password)
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModelTest.kt
index b106d55..3f5ddba 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModelTest.kt
@@ -19,9 +19,8 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel
import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel as DomainAuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.authentication.shared.model.AuthenticationPatternCoordinate as Point
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.res.R
@@ -52,7 +51,6 @@
private val bouncerInteractor =
utils.bouncerInteractor(
authenticationInteractor = authenticationInteractor,
- sceneInteractor = sceneInteractor,
)
private val bouncerViewModel =
utils.bouncerViewModel(
@@ -90,8 +88,7 @@
assertThat(selectedDots).isEmpty()
assertThat(currentDot).isNull()
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
- assertThat(underTest.authenticationMethod)
- .isEqualTo(DomainAuthenticationMethodModel.Pattern)
+ assertThat(underTest.authenticationMethod).isEqualTo(AuthenticationMethodModel.Pattern)
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModelTest.kt
index 69f855d..6da6951 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModelTest.kt
@@ -19,9 +19,8 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel
import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel as DomainAuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.res.R
import com.android.systemui.scene.SceneTestUtils
@@ -51,7 +50,6 @@
private val bouncerInteractor =
utils.bouncerInteractor(
authenticationInteractor = authenticationInteractor,
- sceneInteractor = sceneInteractor,
)
private val bouncerViewModel =
utils.bouncerViewModel(
@@ -90,8 +88,7 @@
assertThat(message?.text).ignoringCase().isEqualTo(ENTER_YOUR_PIN)
assertThat(pin).isEmpty()
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Bouncer))
- assertThat(underTest.authenticationMethod)
- .isEqualTo(DomainAuthenticationMethodModel.Pin)
+ assertThat(underTest.authenticationMethod).isEqualTo(AuthenticationMethodModel.Pin)
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryRepositoryTest.kt
index 0eb8982..97ac8c6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryRepositoryTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryRepositoryTest.kt
@@ -83,16 +83,16 @@
}
@Test
- fun isInsecureLockscreenEnabled() =
+ fun isLockscreenEnabled() =
testScope.runTest {
whenever(lockPatternUtils.isLockScreenDisabled(USER_INFOS[0].id)).thenReturn(false)
whenever(lockPatternUtils.isLockScreenDisabled(USER_INFOS[1].id)).thenReturn(true)
userRepository.setSelectedUserInfo(USER_INFOS[0])
- assertThat(underTest.isInsecureLockscreenEnabled()).isTrue()
+ assertThat(underTest.isLockscreenEnabled()).isTrue()
userRepository.setSelectedUserInfo(USER_INFOS[1])
- assertThat(underTest.isInsecureLockscreenEnabled()).isFalse()
+ assertThat(underTest.isLockscreenEnabled()).isFalse()
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt
index 81251d6..abd9f28 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt
@@ -19,7 +19,7 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.deviceentry.data.repository.FakeDeviceEntryRepository
import com.android.systemui.keyguard.data.repository.FakeDeviceEntryFaceAuthRepository
@@ -60,7 +60,7 @@
testScope.runTest {
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.None)
utils.deviceEntryRepository.apply {
- setInsecureLockscreenEnabled(false)
+ setLockscreenEnabled(false)
// Toggle isUnlocked, twice.
//
@@ -83,8 +83,7 @@
@Test
fun isUnlocked_whenAuthMethodIsNoneAndLockscreenEnabled_isTrue() =
testScope.runTest {
- utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.None)
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(true)
+ setupSwipeDeviceEntryMethod()
val isUnlocked by collectLastValue(underTest.isUnlocked)
assertThat(isUnlocked).isTrue()
@@ -94,8 +93,7 @@
fun isDeviceEntered_onLockscreenWithSwipe_isFalse() =
testScope.runTest {
val isDeviceEntered by collectLastValue(underTest.isDeviceEntered)
- utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.None)
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(true)
+ setupSwipeDeviceEntryMethod()
switchToScene(SceneKey.Lockscreen)
assertThat(isDeviceEntered).isFalse()
@@ -105,8 +103,7 @@
fun isDeviceEntered_onShadeBeforeDismissingLockscreenWithSwipe_isFalse() =
testScope.runTest {
val isDeviceEntered by collectLastValue(underTest.isDeviceEntered)
- utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.None)
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(true)
+ setupSwipeDeviceEntryMethod()
switchToScene(SceneKey.Lockscreen)
runCurrent()
switchToScene(SceneKey.Shade)
@@ -118,8 +115,7 @@
fun isDeviceEntered_afterDismissingLockscreenWithSwipe_isTrue() =
testScope.runTest {
val isDeviceEntered by collectLastValue(underTest.isDeviceEntered)
- utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.None)
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(true)
+ setupSwipeDeviceEntryMethod()
switchToScene(SceneKey.Lockscreen)
runCurrent()
switchToScene(SceneKey.Gone)
@@ -131,8 +127,7 @@
fun isDeviceEntered_onShadeAfterDismissingLockscreenWithSwipe_isTrue() =
testScope.runTest {
val isDeviceEntered by collectLastValue(underTest.isDeviceEntered)
- utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.None)
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(true)
+ setupSwipeDeviceEntryMethod()
switchToScene(SceneKey.Lockscreen)
runCurrent()
switchToScene(SceneKey.Gone)
@@ -148,7 +143,7 @@
utils.authenticationRepository.setAuthenticationMethod(
AuthenticationMethodModel.Pattern
)
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(true)
+ utils.deviceEntryRepository.setLockscreenEnabled(true)
switchToScene(SceneKey.Lockscreen)
runCurrent()
switchToScene(SceneKey.Bouncer)
@@ -160,8 +155,7 @@
@Test
fun canSwipeToEnter_onLockscreenWithSwipe_isTrue() =
testScope.runTest {
- utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.None)
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(true)
+ setupSwipeDeviceEntryMethod()
switchToScene(SceneKey.Lockscreen)
val canSwipeToEnter by collectLastValue(underTest.canSwipeToEnter)
@@ -172,7 +166,7 @@
fun canSwipeToEnter_onLockscreenWithPin_isFalse() =
testScope.runTest {
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(true)
+ utils.deviceEntryRepository.setLockscreenEnabled(true)
switchToScene(SceneKey.Lockscreen)
val canSwipeToEnter by collectLastValue(underTest.canSwipeToEnter)
@@ -182,8 +176,7 @@
@Test
fun canSwipeToEnter_afterLockscreenDismissedInSwipeMode_isFalse() =
testScope.runTest {
- utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.None)
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(true)
+ setupSwipeDeviceEntryMethod()
switchToScene(SceneKey.Lockscreen)
runCurrent()
switchToScene(SceneKey.Gone)
@@ -192,6 +185,11 @@
assertThat(canSwipeToEnter).isFalse()
}
+ private fun setupSwipeDeviceEntryMethod() {
+ utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.None)
+ utils.deviceEntryRepository.setLockscreenEnabled(true)
+ }
+
@Test
fun canSwipeToEnter_whenTrustedByTrustManager_isTrue() =
testScope.runTest {
@@ -314,7 +312,7 @@
switchToScene(SceneKey.Lockscreen)
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Lockscreen))
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(true)
+ utils.deviceEntryRepository.setLockscreenEnabled(true)
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.None)
underTest.attemptDeviceEntry()
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenSceneViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenSceneViewModelTest.kt
index 7de28de..0b3bc9d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenSceneViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenSceneViewModelTest.kt
@@ -19,7 +19,7 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.scene.SceneTestUtils
import com.android.systemui.scene.shared.model.SceneKey
@@ -45,7 +45,7 @@
testScope.runTest {
val upTransitionSceneKey by collectLastValue(underTest.upDestinationSceneKey)
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.None)
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(true)
+ utils.deviceEntryRepository.setLockscreenEnabled(true)
utils.deviceEntryRepository.setUnlocked(true)
sceneInteractor.changeScene(SceneModel(SceneKey.Lockscreen), "reason")
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModelTest.kt
index 2f93c73..d582b9e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModelTest.kt
@@ -19,7 +19,7 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.flags.FakeFeatureFlagsClassic
import com.android.systemui.flags.Flags
diff --git a/packages/SystemUI/tests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt b/packages/SystemUI/tests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt
index 790f5fb..d1db9c1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt
@@ -26,7 +26,7 @@
import com.android.internal.util.EmergencyAffordanceManager
import com.android.systemui.SysuiTestCase
import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel as DomainLayerAuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.bouncer.domain.interactor.BouncerActionButtonInteractor
import com.android.systemui.bouncer.ui.viewmodel.BouncerViewModel
import com.android.systemui.bouncer.ui.viewmodel.PinBouncerViewModel
@@ -39,7 +39,6 @@
import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAsleepForTest
import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAwakeForTest
import com.android.systemui.power.domain.interactor.PowerInteractorFactory
-import com.android.systemui.scene.SceneTestUtils.Companion.toDataLayer
import com.android.systemui.scene.domain.startable.SceneContainerStartable
import com.android.systemui.scene.shared.model.ObservableTransitionState
import com.android.systemui.scene.shared.model.SceneKey
@@ -60,6 +59,7 @@
import com.android.systemui.util.mockito.whenever
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.assertWithMessage
+import junit.framework.Assert.assertTrue
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.MutableStateFlow
@@ -72,7 +72,6 @@
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
-import org.mockito.Mockito.times
import org.mockito.Mockito.verify
import org.mockito.MockitoAnnotations
@@ -136,7 +135,6 @@
private val bouncerInteractor =
utils.bouncerInteractor(
authenticationInteractor = authenticationInteractor,
- sceneInteractor = sceneInteractor,
)
private lateinit var mobileConnectionsRepository: FakeMobileConnectionsRepository
@@ -245,7 +243,6 @@
applicationScope = testScope.backgroundScope,
sceneInteractor = sceneInteractor,
deviceEntryInteractor = deviceEntryInteractor,
- authenticationInteractor = authenticationInteractor,
keyguardInteractor = keyguardInteractor,
flags = utils.sceneContainerFlags,
sysUiState = sysUiState,
@@ -253,6 +250,7 @@
sceneLogger = mock(),
falsingCollector = utils.falsingCollector(),
powerInteractor = powerInteractor,
+ bouncerInteractor = bouncerInteractor,
)
startable.start()
@@ -296,7 +294,7 @@
@Test
fun swipeUpOnLockscreen_withAuthMethodSwipe_dismissesLockscreen() =
testScope.runTest {
- setAuthMethod(DomainLayerAuthenticationMethodModel.Swipe)
+ setAuthMethod(AuthenticationMethodModel.None, enableLockscreen = true)
val upDestinationSceneKey by
collectLastValue(lockscreenSceneViewModel.upDestinationSceneKey)
@@ -310,7 +308,7 @@
fun swipeUpOnShadeScene_withAuthMethodSwipe_lockscreenNotDismissed_goesToLockscreen() =
testScope.runTest {
val upDestinationSceneKey by collectLastValue(shadeSceneViewModel.upDestinationSceneKey)
- setAuthMethod(DomainLayerAuthenticationMethodModel.Swipe)
+ setAuthMethod(AuthenticationMethodModel.None, enableLockscreen = true)
assertCurrentScene(SceneKey.Lockscreen)
// Emulate a user swipe to the shade scene.
@@ -327,7 +325,8 @@
fun swipeUpOnShadeScene_withAuthMethodSwipe_lockscreenDismissed_goesToGone() =
testScope.runTest {
val upDestinationSceneKey by collectLastValue(shadeSceneViewModel.upDestinationSceneKey)
- setAuthMethod(DomainLayerAuthenticationMethodModel.Swipe)
+ setAuthMethod(AuthenticationMethodModel.None, enableLockscreen = true)
+ assertTrue(deviceEntryInteractor.canSwipeToEnter.value)
assertCurrentScene(SceneKey.Lockscreen)
// Emulate a user swipe to dismiss the lockscreen.
@@ -347,7 +346,7 @@
@Test
fun withAuthMethodNone_deviceWakeUp_skipsLockscreen() =
testScope.runTest {
- setAuthMethod(DomainLayerAuthenticationMethodModel.None)
+ setAuthMethod(AuthenticationMethodModel.None, enableLockscreen = false)
putDeviceToSleep(instantlyLockDevice = false)
assertCurrentScene(SceneKey.Lockscreen)
@@ -358,7 +357,7 @@
@Test
fun withAuthMethodSwipe_deviceWakeUp_doesNotSkipLockscreen() =
testScope.runTest {
- setAuthMethod(DomainLayerAuthenticationMethodModel.Swipe)
+ setAuthMethod(AuthenticationMethodModel.None, enableLockscreen = true)
putDeviceToSleep(instantlyLockDevice = false)
assertCurrentScene(SceneKey.Lockscreen)
@@ -426,7 +425,7 @@
@Test
fun dismissingIme_whileOnPasswordBouncer_navigatesToLockscreen() =
testScope.runTest {
- setAuthMethod(DomainLayerAuthenticationMethodModel.Password)
+ setAuthMethod(AuthenticationMethodModel.Password)
val upDestinationSceneKey by
collectLastValue(lockscreenSceneViewModel.upDestinationSceneKey)
assertThat(upDestinationSceneKey).isEqualTo(SceneKey.Bouncer)
@@ -443,7 +442,7 @@
@Test
fun bouncerActionButtonClick_opensEmergencyServicesDialer() =
testScope.runTest {
- setAuthMethod(DomainLayerAuthenticationMethodModel.Password)
+ setAuthMethod(AuthenticationMethodModel.Password)
val upDestinationSceneKey by
collectLastValue(lockscreenSceneViewModel.upDestinationSceneKey)
assertThat(upDestinationSceneKey).isEqualTo(SceneKey.Bouncer)
@@ -462,7 +461,7 @@
@Test
fun bouncerActionButtonClick_duringCall_returnsToCall() =
testScope.runTest {
- setAuthMethod(DomainLayerAuthenticationMethodModel.Password)
+ setAuthMethod(AuthenticationMethodModel.Password)
startPhoneCall()
val upDestinationSceneKey by
collectLastValue(lockscreenSceneViewModel.upDestinationSceneKey)
@@ -506,19 +505,19 @@
/** Updates the current authentication method and related states in the data layer. */
private fun TestScope.setAuthMethod(
- authMethod: DomainLayerAuthenticationMethodModel,
+ authMethod: AuthenticationMethodModel,
+ enableLockscreen: Boolean = true
) {
+ if (authMethod.isSecure) {
+ assert(enableLockscreen) {
+ "Lockscreen cannot be disabled with a secure authentication method."
+ }
+ }
// Set the lockscreen enabled bit _before_ set the auth method as the code picks up on the
// lockscreen enabled bit _after_ the auth method is changed and the lockscreen enabled bit
// is not an observable that can trigger a new evaluation.
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(
- authMethod !is DomainLayerAuthenticationMethodModel.None
- )
- utils.authenticationRepository.setAuthenticationMethod(authMethod.toDataLayer())
- if (!authMethod.isSecure) {
- // When the auth method is not secure, the device is never considered locked.
- utils.deviceEntryRepository.setUnlocked(true)
- }
+ utils.deviceEntryRepository.setLockscreenEnabled(enableLockscreen)
+ utils.authenticationRepository.setAuthenticationMethod(authMethod)
runCurrent()
}
@@ -708,7 +707,7 @@
}
/** Emulates the dismissal of the IME (soft keyboard). */
- private fun TestScope.dismissIme(
+ private suspend fun TestScope.dismissIme(
showImeBeforeDismissing: Boolean = true,
) {
bouncerViewModel.authMethodViewModel.value?.apply {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt b/packages/SystemUI/tests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
index f6362fe..2f654e2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt
@@ -24,16 +24,15 @@
import androidx.test.filters.SmallTest
import com.android.systemui.Flags as AconfigFlags
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.classifier.FalsingCollector
import com.android.systemui.coroutines.collectLastValue
-import com.android.systemui.kosmos.testScope
+import com.android.systemui.keyguard.data.repository.FakeDeviceEntryFaceAuthRepository
import com.android.systemui.model.SysUiState
import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAsleepForTest
import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAwakeForTest
import com.android.systemui.power.domain.interactor.PowerInteractorFactory
import com.android.systemui.scene.SceneTestUtils
-import com.android.systemui.scene.SceneTestUtils.Companion.toDataLayer
import com.android.systemui.scene.shared.model.ObservableTransitionState
import com.android.systemui.scene.shared.model.SceneKey
import com.android.systemui.scene.shared.model.SceneModel
@@ -63,8 +62,12 @@
private val sceneInteractor = utils.sceneInteractor()
private val sceneContainerFlags = utils.sceneContainerFlags
private val authenticationInteractor = utils.authenticationInteractor()
+ private val bouncerInteractor =
+ utils.bouncerInteractor(authenticationInteractor = authenticationInteractor)
+ private val faceAuthRepository = FakeDeviceEntryFaceAuthRepository()
private val deviceEntryInteractor =
utils.deviceEntryInteractor(
+ faceAuthRepository = faceAuthRepository,
authenticationInteractor = authenticationInteractor,
sceneInteractor = sceneInteractor,
)
@@ -78,7 +81,6 @@
applicationScope = testScope.backgroundScope,
sceneInteractor = sceneInteractor,
deviceEntryInteractor = deviceEntryInteractor,
- authenticationInteractor = authenticationInteractor,
keyguardInteractor = keyguardInteractor,
flags = sceneContainerFlags,
sysUiState = sysUiState,
@@ -86,6 +88,7 @@
sceneLogger = mock(),
falsingCollector = falsingCollector,
powerInteractor = powerInteractor,
+ bouncerInteractor = bouncerInteractor,
)
@Before
@@ -198,12 +201,55 @@
assertThat(currentSceneKey).isEqualTo(SceneKey.Lockscreen)
underTest.start()
+ // Authenticate using a passive auth method like face auth while bypass is disabled.
+ faceAuthRepository.isAuthenticated.value = true
utils.deviceEntryRepository.setUnlocked(true)
assertThat(currentSceneKey).isEqualTo(SceneKey.Lockscreen)
}
@Test
+ fun stayOnCurrentSceneWhenDeviceIsUnlockedAndUserIsNotOnLockscreen() =
+ testScope.runTest {
+ val currentSceneKey by collectLastValue(sceneInteractor.desiredScene.map { it.key })
+ val transitionStateFlowValue =
+ prepareState(
+ isBypassEnabled = true,
+ authenticationMethod = AuthenticationMethodModel.Pin,
+ initialSceneKey = SceneKey.Lockscreen,
+ )
+ underTest.start()
+ runCurrent()
+
+ sceneInteractor.changeScene(SceneModel(SceneKey.Shade), "switch to shade")
+ transitionStateFlowValue.value = ObservableTransitionState.Idle(SceneKey.Shade)
+ assertThat(currentSceneKey).isEqualTo(SceneKey.Shade)
+
+ utils.deviceEntryRepository.setUnlocked(true)
+ runCurrent()
+
+ assertThat(currentSceneKey).isEqualTo(SceneKey.Shade)
+ }
+
+ @Test
+ fun switchToGoneWhenDeviceIsUnlockedAndUserIsOnBouncerWithBypassDisabled() =
+ testScope.runTest {
+ val currentSceneKey by collectLastValue(sceneInteractor.desiredScene.map { it.key })
+ prepareState(
+ isBypassEnabled = false,
+ initialSceneKey = SceneKey.Bouncer,
+ )
+ assertThat(currentSceneKey).isEqualTo(SceneKey.Bouncer)
+ underTest.start()
+
+ // Authenticate using a passive auth method like face auth while bypass is disabled.
+ faceAuthRepository.isAuthenticated.value = true
+ utils.deviceEntryRepository.setUnlocked(true)
+
+ assertThat(currentSceneKey).isEqualTo(SceneKey.Gone)
+ }
+
+ @Test
fun switchToLockscreenWhenDeviceSleepsLocked() =
testScope.runTest {
val currentSceneKey by collectLastValue(sceneInteractor.desiredScene.map { it.key })
@@ -255,6 +301,7 @@
prepareState(
initialSceneKey = SceneKey.Lockscreen,
authenticationMethod = AuthenticationMethodModel.None,
+ isLockscreenEnabled = false,
)
assertThat(currentSceneKey).isEqualTo(SceneKey.Lockscreen)
underTest.start()
@@ -269,7 +316,8 @@
val currentSceneKey by collectLastValue(sceneInteractor.desiredScene.map { it.key })
prepareState(
initialSceneKey = SceneKey.Lockscreen,
- authenticationMethod = AuthenticationMethodModel.Swipe,
+ authenticationMethod = AuthenticationMethodModel.None,
+ isLockscreenEnabled = true,
)
assertThat(currentSceneKey).isEqualTo(SceneKey.Lockscreen)
underTest.start()
@@ -406,6 +454,24 @@
}
@Test
+ fun bouncerImeHidden_shouldTransitionBackToLockscreen() =
+ testScope.runTest {
+ val currentSceneKey by collectLastValue(sceneInteractor.desiredScene.map { it.key })
+ prepareState(
+ initialSceneKey = SceneKey.Lockscreen,
+ authenticationMethod = AuthenticationMethodModel.Password,
+ isDeviceUnlocked = false,
+ )
+ underTest.start()
+ runCurrent()
+
+ bouncerInteractor.onImeHidden()
+ runCurrent()
+
+ assertThat(currentSceneKey).isEqualTo(SceneKey.Lockscreen)
+ }
+
+ @Test
fun collectFalsingSignals_screenOnAndOff_aodUnavailable() =
testScope.runTest {
utils.keyguardRepository.setAodAvailable(false)
@@ -526,8 +592,14 @@
isBypassEnabled: Boolean = false,
initialSceneKey: SceneKey? = null,
authenticationMethod: AuthenticationMethodModel? = null,
+ isLockscreenEnabled: Boolean = true,
startsAwake: Boolean = true,
): MutableStateFlow<ObservableTransitionState> {
+ if (authenticationMethod?.isSecure == true) {
+ assert(isLockscreenEnabled) {
+ "Lockscreen cannot be disabled while having a secure authentication method"
+ }
+ }
sceneContainerFlags.enabled = true
utils.deviceEntryRepository.setUnlocked(isDeviceUnlocked)
utils.deviceEntryRepository.setBypassEnabled(isBypassEnabled)
@@ -542,11 +614,9 @@
sceneInteractor.onSceneChanged(SceneModel(it), "reason")
}
authenticationMethod?.let {
- utils.authenticationRepository.setAuthenticationMethod(
- authenticationMethod.toDataLayer()
- )
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(
- authenticationMethod != AuthenticationMethodModel.None
+ utils.authenticationRepository.setAuthenticationMethod(authenticationMethod)
+ utils.deviceEntryRepository.setLockscreenEnabled(
+ isLockscreenEnabled = isLockscreenEnabled
)
}
if (startsAwake) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneViewModelTest.kt
index 2de927a..fa849fe 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/ui/viewmodel/ShadeSceneViewModelTest.kt
@@ -19,7 +19,7 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.flags.FakeFeatureFlagsClassic
import com.android.systemui.flags.Flags
@@ -124,7 +124,7 @@
fun upTransitionSceneKey_authMethodSwipe_lockscreenNotDismissed_goesToLockscreen() =
testScope.runTest {
val upTransitionSceneKey by collectLastValue(underTest.upDestinationSceneKey)
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(true)
+ utils.deviceEntryRepository.setLockscreenEnabled(true)
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.None)
sceneInteractor.changeScene(SceneModel(SceneKey.Lockscreen), "reason")
sceneInteractor.onSceneChanged(SceneModel(SceneKey.Lockscreen), "reason")
@@ -136,7 +136,7 @@
fun upTransitionSceneKey_authMethodSwipe_lockscreenDismissed_goesToGone() =
testScope.runTest {
val upTransitionSceneKey by collectLastValue(underTest.upDestinationSceneKey)
- utils.deviceEntryRepository.setInsecureLockscreenEnabled(true)
+ utils.deviceEntryRepository.setLockscreenEnabled(true)
utils.authenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.None)
sceneInteractor.changeScene(SceneModel(SceneKey.Gone), "reason")
sceneInteractor.onSceneChanged(SceneModel(SceneKey.Gone), "reason")
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/authentication/data/repository/FakeAuthenticationRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/authentication/data/repository/FakeAuthenticationRepository.kt
index 1ec1939..6e9363b 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/authentication/data/repository/FakeAuthenticationRepository.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/authentication/data/repository/FakeAuthenticationRepository.kt
@@ -20,7 +20,7 @@
import com.android.internal.widget.LockPatternView
import com.android.internal.widget.LockscreenCredential
import com.android.keyguard.KeyguardSecurityModel.SecurityMode
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel
+import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.authentication.shared.model.AuthenticationPatternCoordinate
import com.android.systemui.authentication.shared.model.AuthenticationResultModel
import com.android.systemui.authentication.shared.model.AuthenticationThrottlingModel
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/data/repository/FakeDeviceEntryRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/data/repository/FakeDeviceEntryRepository.kt
index 5ae210b..ba70d46 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/data/repository/FakeDeviceEntryRepository.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/data/repository/FakeDeviceEntryRepository.kt
@@ -27,7 +27,7 @@
@SysUISingleton
class FakeDeviceEntryRepository @Inject constructor() : DeviceEntryRepository {
- private var isInsecureLockscreenEnabled = true
+ private var isLockscreenEnabled = true
private val _isBypassEnabled = MutableStateFlow(false)
override val isBypassEnabled: StateFlow<Boolean> = _isBypassEnabled
@@ -35,8 +35,8 @@
private val _isUnlocked = MutableStateFlow(false)
override val isUnlocked: StateFlow<Boolean> = _isUnlocked.asStateFlow()
- override suspend fun isInsecureLockscreenEnabled(): Boolean {
- return isInsecureLockscreenEnabled
+ override suspend fun isLockscreenEnabled(): Boolean {
+ return isLockscreenEnabled
}
override fun reportSuccessfulAuthentication() {
@@ -47,8 +47,8 @@
_isUnlocked.value = isUnlocked
}
- fun setInsecureLockscreenEnabled(isLockscreenEnabled: Boolean) {
- this.isInsecureLockscreenEnabled = isLockscreenEnabled
+ fun setLockscreenEnabled(isLockscreenEnabled: Boolean) {
+ this.isLockscreenEnabled = isLockscreenEnabled
}
fun setBypassEnabled(isBypassEnabled: Boolean) {
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneTestUtils.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneTestUtils.kt
index 6afca15..72cc08f 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneTestUtils.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/scene/SceneTestUtils.kt
@@ -26,11 +26,9 @@
import com.android.internal.logging.MetricsLogger
import com.android.internal.util.EmergencyAffordanceManager
import com.android.systemui.SysuiTestCase
-import com.android.systemui.authentication.data.model.AuthenticationMethodModel as DataLayerAuthenticationMethodModel
import com.android.systemui.authentication.data.repository.AuthenticationRepository
import com.android.systemui.authentication.data.repository.FakeAuthenticationRepository
import com.android.systemui.authentication.domain.interactor.AuthenticationInteractor
-import com.android.systemui.authentication.domain.model.AuthenticationMethodModel as DomainLayerAuthenticationMethodModel
import com.android.systemui.bouncer.data.repository.BouncerRepository
import com.android.systemui.bouncer.data.repository.EmergencyServicesRepository
import com.android.systemui.bouncer.data.repository.FakeKeyguardBouncerRepository
@@ -192,7 +190,6 @@
repository = repository,
backgroundDispatcher = testDispatcher,
userRepository = userRepository,
- deviceEntryRepository = deviceEntryRepository,
clock = mock { whenever(elapsedRealtime()).thenAnswer { testScope.currentTime } }
)
}
@@ -222,14 +219,12 @@
fun bouncerInteractor(
authenticationInteractor: AuthenticationInteractor,
- sceneInteractor: SceneInteractor,
): BouncerInteractor {
return BouncerInteractor(
applicationScope = applicationScope(),
applicationContext = context,
repository = BouncerRepository(featureFlags),
authenticationInteractor = authenticationInteractor,
- sceneInteractor = sceneInteractor,
flags = sceneContainerFlags,
falsingInteractor = falsingInteractor(),
)
@@ -343,19 +338,4 @@
dozeLogger = dozeLogger,
)
}
-
- companion object {
- fun DomainLayerAuthenticationMethodModel.toDataLayer(): DataLayerAuthenticationMethodModel {
- return when (this) {
- DomainLayerAuthenticationMethodModel.None -> DataLayerAuthenticationMethodModel.None
- DomainLayerAuthenticationMethodModel.Swipe ->
- DataLayerAuthenticationMethodModel.None
- DomainLayerAuthenticationMethodModel.Pin -> DataLayerAuthenticationMethodModel.Pin
- DomainLayerAuthenticationMethodModel.Password ->
- DataLayerAuthenticationMethodModel.Password
- DomainLayerAuthenticationMethodModel.Pattern ->
- DataLayerAuthenticationMethodModel.Pattern
- }
- }
- }
}