Loading packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/data/repository/AuthenticationRepositoryTest.kt +8 −15 Original line number Original line Diff line number Diff line Loading @@ -31,7 +31,8 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectValues import com.android.systemui.coroutines.collectValues import com.android.systemui.kosmos.testDispatcher import com.android.systemui.kosmos.testDispatcher import com.android.systemui.kosmos.testScope import com.android.systemui.kosmos.testScope import com.android.systemui.statusbar.pipeline.mobile.data.repository.fakeMobileConnectionsRepository import com.android.systemui.statusbar.pipeline.mobile.data.repository.fake import com.android.systemui.statusbar.pipeline.mobile.data.repository.mobileConnectionsRepository import com.android.systemui.testKosmos import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.FakeUserRepository import com.android.systemui.user.data.repository.FakeUserRepository import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.whenever Loading Loading @@ -62,7 +63,7 @@ class AuthenticationRepositoryTest : SysuiTestCase() { private val testScope = kosmos.testScope private val testScope = kosmos.testScope private val clock = FakeSystemClock() private val clock = FakeSystemClock() private val userRepository = FakeUserRepository() private val userRepository = FakeUserRepository() private val mobileConnectionsRepository = kosmos.fakeMobileConnectionsRepository private val mobileConnectionsRepository = kosmos.mobileConnectionsRepository private lateinit var underTest: AuthenticationRepository private lateinit var underTest: AuthenticationRepository Loading Loading @@ -110,7 +111,7 @@ class AuthenticationRepositoryTest : SysuiTestCase() { .isEqualTo(AuthenticationMethodModel.None) .isEqualTo(AuthenticationMethodModel.None) currentSecurityMode = KeyguardSecurityModel.SecurityMode.SimPin currentSecurityMode = KeyguardSecurityModel.SecurityMode.SimPin mobileConnectionsRepository.isAnySimSecure.value = true mobileConnectionsRepository.fake.isAnySimSecure.value = true assertThat(authMethod).isEqualTo(AuthenticationMethodModel.Sim) assertThat(authMethod).isEqualTo(AuthenticationMethodModel.Sim) assertThat(underTest.getAuthenticationMethod()).isEqualTo(AuthenticationMethodModel.Sim) assertThat(underTest.getAuthenticationMethod()).isEqualTo(AuthenticationMethodModel.Sim) } } Loading Loading @@ -199,7 +200,7 @@ class AuthenticationRepositoryTest : SysuiTestCase() { } } private fun setSecurityModeAndDispatchBroadcast( private fun setSecurityModeAndDispatchBroadcast( securityMode: KeyguardSecurityModel.SecurityMode, securityMode: KeyguardSecurityModel.SecurityMode ) { ) { currentSecurityMode = securityMode currentSecurityMode = securityMode dispatchBroadcast() dispatchBroadcast() Loading @@ -208,23 +209,15 @@ class AuthenticationRepositoryTest : SysuiTestCase() { private fun dispatchBroadcast() { private fun dispatchBroadcast() { fakeBroadcastDispatcher.sendIntentToMatchingReceiversOnly( fakeBroadcastDispatcher.sendIntentToMatchingReceiversOnly( context, context, Intent(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED) Intent(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED), ) ) } } companion object { companion object { private val USER_INFOS = private val USER_INFOS = listOf( listOf( UserInfo( UserInfo(/* id= */ 100, /* name= */ "First user", /* flags= */ 0), /* id= */ 100, UserInfo(/* id= */ 101, /* name= */ "Second user", /* flags= */ 0), /* name= */ "First user", /* flags= */ 0, ), UserInfo( /* id= */ 101, /* name= */ "Second user", /* flags= */ 0, ), ) ) } } } } packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerActionButtonInteractorTest.kt +3 −2 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,8 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.pipeline.mobile.data.repository.FakeMobileConnectionsRepository import com.android.systemui.statusbar.pipeline.mobile.data.repository.FakeMobileConnectionsRepository import com.android.systemui.statusbar.pipeline.mobile.data.repository.fakeMobileConnectionsRepository import com.android.systemui.statusbar.pipeline.mobile.data.repository.fake import com.android.systemui.statusbar.pipeline.mobile.data.repository.mobileConnectionsRepository import com.android.systemui.telephony.data.repository.fakeTelephonyRepository import com.android.systemui.telephony.data.repository.fakeTelephonyRepository import com.android.systemui.testKosmos import com.android.systemui.testKosmos import com.android.systemui.user.domain.interactor.SelectedUserInteractor import com.android.systemui.user.domain.interactor.SelectedUserInteractor Loading Loading @@ -78,7 +79,7 @@ class BouncerActionButtonInteractorTest : SysuiTestCase() { fun setUp() { fun setUp() { MockitoAnnotations.initMocks(this) MockitoAnnotations.initMocks(this) mobileConnectionsRepository = kosmos.fakeMobileConnectionsRepository mobileConnectionsRepository = kosmos.mobileConnectionsRepository.fake overrideResource(R.string.lockscreen_emergency_call, MESSAGE_EMERGENCY_CALL) overrideResource(R.string.lockscreen_emergency_call, MESSAGE_EMERGENCY_CALL) overrideResource(R.string.lockscreen_return_to_call, MESSAGE_RETURN_TO_CALL) overrideResource(R.string.lockscreen_return_to_call, MESSAGE_RETURN_TO_CALL) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/BiometricSettingsRepositoryTest.kt +17 −16 Original line number Original line Diff line number Diff line Loading @@ -47,7 +47,8 @@ import com.android.systemui.keyguard.data.repository.BiometricType.SIDE_FINGERPR import com.android.systemui.keyguard.data.repository.BiometricType.UNDER_DISPLAY_FINGERPRINT import com.android.systemui.keyguard.data.repository.BiometricType.UNDER_DISPLAY_FINGERPRINT import com.android.systemui.keyguard.shared.model.DevicePosture import com.android.systemui.keyguard.shared.model.DevicePosture import com.android.systemui.res.R import com.android.systemui.res.R import com.android.systemui.statusbar.pipeline.mobile.data.repository.fakeMobileConnectionsRepository import com.android.systemui.statusbar.pipeline.mobile.data.repository.fake import com.android.systemui.statusbar.pipeline.mobile.data.repository.mobileConnectionsRepository import com.android.systemui.statusbar.policy.DevicePostureController import com.android.systemui.statusbar.policy.DevicePostureController import com.android.systemui.testKosmos import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.FakeUserRepository import com.android.systemui.user.data.repository.FakeUserRepository Loading Loading @@ -99,7 +100,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { private lateinit var devicePostureRepository: FakeDevicePostureRepository private lateinit var devicePostureRepository: FakeDevicePostureRepository private lateinit var facePropertyRepository: FakeFacePropertyRepository private lateinit var facePropertyRepository: FakeFacePropertyRepository private lateinit var fingerprintPropertyRepository: FakeFingerprintPropertyRepository private lateinit var fingerprintPropertyRepository: FakeFingerprintPropertyRepository private val mobileConnectionsRepository = kosmos.fakeMobileConnectionsRepository private val mobileConnectionsRepository = kosmos.mobileConnectionsRepository private lateinit var testDispatcher: TestDispatcher private lateinit var testDispatcher: TestDispatcher private lateinit var testScope: TestScope private lateinit var testScope: TestScope Loading Loading @@ -142,7 +143,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { 1, 1, SensorStrength.STRONG, SensorStrength.STRONG, FingerprintSensorType.UDFPS_OPTICAL, FingerprintSensorType.UDFPS_OPTICAL, emptyMap() emptyMap(), ) ) verify(lockPatternUtils).registerStrongAuthTracker(strongAuthTracker.capture()) verify(lockPatternUtils).registerStrongAuthTracker(strongAuthTracker.capture()) verify(authController, times(2)).addCallback(authControllerCallback.capture()) verify(authController, times(2)).addCallback(authControllerCallback.capture()) Loading Loading @@ -247,7 +248,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { private fun deviceIsInPostureThatSupportsFaceAuth() { private fun deviceIsInPostureThatSupportsFaceAuth() { overrideResource( overrideResource( R.integer.config_face_auth_supported_posture, R.integer.config_face_auth_supported_posture, DevicePostureController.DEVICE_POSTURE_FLIPPED DevicePostureController.DEVICE_POSTURE_FLIPPED, ) ) devicePostureRepository.setCurrentPosture(DevicePosture.FLIPPED) devicePostureRepository.setCurrentPosture(DevicePosture.FLIPPED) } } Loading Loading @@ -459,7 +460,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { biometricsAreEnabledBySettings() biometricsAreEnabledBySettings() doNotDisableKeyguardAuthFeatures() doNotDisableKeyguardAuthFeatures() mobileConnectionsRepository.isAnySimSecure.value = false mobileConnectionsRepository.fake.isAnySimSecure.value = false runCurrent() runCurrent() val isFaceAuthEnabledAndEnrolled by val isFaceAuthEnabledAndEnrolled by Loading @@ -467,7 +468,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { assertThat(isFaceAuthEnabledAndEnrolled).isTrue() assertThat(isFaceAuthEnabledAndEnrolled).isTrue() mobileConnectionsRepository.isAnySimSecure.value = true mobileConnectionsRepository.fake.isAnySimSecure.value = true runCurrent() runCurrent() assertThat(isFaceAuthEnabledAndEnrolled).isFalse() assertThat(isFaceAuthEnabledAndEnrolled).isFalse() Loading @@ -485,13 +486,13 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { doNotDisableKeyguardAuthFeatures() doNotDisableKeyguardAuthFeatures() faceAuthIsStrongBiometric() faceAuthIsStrongBiometric() biometricsAreEnabledBySettings() biometricsAreEnabledBySettings() mobileConnectionsRepository.isAnySimSecure.value = false mobileConnectionsRepository.fake.isAnySimSecure.value = false onStrongAuthChanged(STRONG_AUTH_NOT_REQUIRED, PRIMARY_USER_ID) onStrongAuthChanged(STRONG_AUTH_NOT_REQUIRED, PRIMARY_USER_ID) onNonStrongAuthChanged(false, PRIMARY_USER_ID) onNonStrongAuthChanged(false, PRIMARY_USER_ID) assertThat(isFaceAuthCurrentlyAllowed).isTrue() assertThat(isFaceAuthCurrentlyAllowed).isTrue() mobileConnectionsRepository.isAnySimSecure.value = true mobileConnectionsRepository.fake.isAnySimSecure.value = true assertThat(isFaceAuthCurrentlyAllowed).isFalse() assertThat(isFaceAuthCurrentlyAllowed).isFalse() } } Loading Loading @@ -584,7 +585,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { testScope.runTest { testScope.runTest { overrideResource( overrideResource( R.integer.config_face_auth_supported_posture, R.integer.config_face_auth_supported_posture, DevicePostureController.DEVICE_POSTURE_UNKNOWN DevicePostureController.DEVICE_POSTURE_UNKNOWN, ) ) createBiometricSettingsRepository() createBiometricSettingsRepository() Loading @@ -597,7 +598,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { testScope.runTest { testScope.runTest { overrideResource( overrideResource( R.integer.config_face_auth_supported_posture, R.integer.config_face_auth_supported_posture, DevicePostureController.DEVICE_POSTURE_FLIPPED DevicePostureController.DEVICE_POSTURE_FLIPPED, ) ) createBiometricSettingsRepository() createBiometricSettingsRepository() Loading Loading @@ -749,7 +750,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { 1, 1, SensorStrength.STRONG, SensorStrength.STRONG, FingerprintSensorType.UDFPS_OPTICAL, FingerprintSensorType.UDFPS_OPTICAL, emptyMap() emptyMap(), ) ) // Non strong auth is not allowed now, FP is marked strong // Non strong auth is not allowed now, FP is marked strong onStrongAuthChanged(STRONG_AUTH_NOT_REQUIRED, PRIMARY_USER_ID) onStrongAuthChanged(STRONG_AUTH_NOT_REQUIRED, PRIMARY_USER_ID) Loading @@ -761,7 +762,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { 1, 1, SensorStrength.CONVENIENCE, SensorStrength.CONVENIENCE, FingerprintSensorType.UDFPS_OPTICAL, FingerprintSensorType.UDFPS_OPTICAL, emptyMap() emptyMap(), ) ) assertThat(isFingerprintCurrentlyAllowed).isFalse() assertThat(isFingerprintCurrentlyAllowed).isFalse() Loading @@ -769,7 +770,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { 1, 1, SensorStrength.WEAK, SensorStrength.WEAK, FingerprintSensorType.UDFPS_OPTICAL, FingerprintSensorType.UDFPS_OPTICAL, emptyMap() emptyMap(), ) ) assertThat(isFingerprintCurrentlyAllowed).isFalse() assertThat(isFingerprintCurrentlyAllowed).isFalse() } } Loading @@ -791,7 +792,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { 1, 1, SensorStrength.STRONG, SensorStrength.STRONG, FingerprintSensorType.UDFPS_OPTICAL, FingerprintSensorType.UDFPS_OPTICAL, emptyMap() emptyMap(), ) ) // Non strong auth is not allowed now, FP is marked strong // Non strong auth is not allowed now, FP is marked strong onStrongAuthChanged(STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN, PRIMARY_USER_ID) onStrongAuthChanged(STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN, PRIMARY_USER_ID) Loading Loading @@ -830,7 +831,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { UserInfo( UserInfo( /* id= */ PRIMARY_USER_ID, /* id= */ PRIMARY_USER_ID, /* name= */ "primary user", /* name= */ "primary user", /* flags= */ UserInfo.FLAG_PRIMARY /* flags= */ UserInfo.FLAG_PRIMARY, ) ) private const val ANOTHER_USER_ID = 1 private const val ANOTHER_USER_ID = 1 Loading @@ -838,7 +839,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { UserInfo( UserInfo( /* id= */ ANOTHER_USER_ID, /* id= */ ANOTHER_USER_ID, /* name= */ "another user", /* name= */ "another user", /* flags= */ UserInfo.FLAG_PRIMARY /* flags= */ UserInfo.FLAG_PRIMARY, ) ) } } } } packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt +107 −121 File changed.Preview size limit exceeded, changes collapsed. Show changes packages/SystemUI/tests/utils/src/com/android/systemui/flags/FakeFeatureFlags.kt +8 −5 Original line number Original line Diff line number Diff line Loading @@ -23,13 +23,13 @@ import java.io.PrintWriter class FakeFeatureFlagsClassic : FakeFeatureFlags() class FakeFeatureFlagsClassic : FakeFeatureFlags() val FeatureFlagsClassic.fake get() = this as FakeFeatureFlagsClassic @Deprecated( @Deprecated( message = "Use FakeFeatureFlagsClassic instead.", message = "Use FakeFeatureFlagsClassic instead.", replaceWith = replaceWith = ReplaceWith( ReplaceWith("FakeFeatureFlagsClassic", "com.android.systemui.flags.FakeFeatureFlagsClassic"), "FakeFeatureFlagsClassic", "com.android.systemui.flags.FakeFeatureFlagsClassic", ), ) ) open class FakeFeatureFlags : FeatureFlagsClassic { open class FakeFeatureFlags : FeatureFlagsClassic { private val booleanFlags = mutableMapOf<String, Boolean>() private val booleanFlags = mutableMapOf<String, Boolean>() Loading Loading @@ -105,6 +105,7 @@ open class FakeFeatureFlags : FeatureFlagsClassic { listener.onFlagChanged( listener.onFlagChanged( object : FlagListenable.FlagEvent { object : FlagListenable.FlagEvent { override val flagName = flag.name override val flagName = flag.name override fun requestNoRestart() {} override fun requestNoRestart() {} } } ) ) Loading Loading @@ -165,7 +166,7 @@ open class FakeFeatureFlags : FeatureFlagsClassic { @Module(includes = [FakeFeatureFlagsClassicModule.Bindings::class]) @Module(includes = [FakeFeatureFlagsClassicModule.Bindings::class]) class FakeFeatureFlagsClassicModule( class FakeFeatureFlagsClassicModule( @get:Provides val fakeFeatureFlagsClassic: FakeFeatureFlagsClassic = FakeFeatureFlagsClassic(), @get:Provides val fakeFeatureFlagsClassic: FakeFeatureFlagsClassic = FakeFeatureFlagsClassic() ) { ) { constructor( constructor( Loading @@ -175,7 +176,9 @@ class FakeFeatureFlagsClassicModule( @Module @Module interface Bindings { interface Bindings { @Binds fun bindFake(fake: FakeFeatureFlagsClassic): FeatureFlagsClassic @Binds fun bindFake(fake: FakeFeatureFlagsClassic): FeatureFlagsClassic @Binds fun bindClassic(classic: FeatureFlagsClassic): FeatureFlags @Binds fun bindClassic(classic: FeatureFlagsClassic): FeatureFlags @Binds fun bindFakeClassic(fake: FakeFeatureFlagsClassic): FakeFeatureFlags @Binds fun bindFakeClassic(fake: FakeFeatureFlagsClassic): FakeFeatureFlags } } } } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/data/repository/AuthenticationRepositoryTest.kt +8 −15 Original line number Original line Diff line number Diff line Loading @@ -31,7 +31,8 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectValues import com.android.systemui.coroutines.collectValues import com.android.systemui.kosmos.testDispatcher import com.android.systemui.kosmos.testDispatcher import com.android.systemui.kosmos.testScope import com.android.systemui.kosmos.testScope import com.android.systemui.statusbar.pipeline.mobile.data.repository.fakeMobileConnectionsRepository import com.android.systemui.statusbar.pipeline.mobile.data.repository.fake import com.android.systemui.statusbar.pipeline.mobile.data.repository.mobileConnectionsRepository import com.android.systemui.testKosmos import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.FakeUserRepository import com.android.systemui.user.data.repository.FakeUserRepository import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.whenever Loading Loading @@ -62,7 +63,7 @@ class AuthenticationRepositoryTest : SysuiTestCase() { private val testScope = kosmos.testScope private val testScope = kosmos.testScope private val clock = FakeSystemClock() private val clock = FakeSystemClock() private val userRepository = FakeUserRepository() private val userRepository = FakeUserRepository() private val mobileConnectionsRepository = kosmos.fakeMobileConnectionsRepository private val mobileConnectionsRepository = kosmos.mobileConnectionsRepository private lateinit var underTest: AuthenticationRepository private lateinit var underTest: AuthenticationRepository Loading Loading @@ -110,7 +111,7 @@ class AuthenticationRepositoryTest : SysuiTestCase() { .isEqualTo(AuthenticationMethodModel.None) .isEqualTo(AuthenticationMethodModel.None) currentSecurityMode = KeyguardSecurityModel.SecurityMode.SimPin currentSecurityMode = KeyguardSecurityModel.SecurityMode.SimPin mobileConnectionsRepository.isAnySimSecure.value = true mobileConnectionsRepository.fake.isAnySimSecure.value = true assertThat(authMethod).isEqualTo(AuthenticationMethodModel.Sim) assertThat(authMethod).isEqualTo(AuthenticationMethodModel.Sim) assertThat(underTest.getAuthenticationMethod()).isEqualTo(AuthenticationMethodModel.Sim) assertThat(underTest.getAuthenticationMethod()).isEqualTo(AuthenticationMethodModel.Sim) } } Loading Loading @@ -199,7 +200,7 @@ class AuthenticationRepositoryTest : SysuiTestCase() { } } private fun setSecurityModeAndDispatchBroadcast( private fun setSecurityModeAndDispatchBroadcast( securityMode: KeyguardSecurityModel.SecurityMode, securityMode: KeyguardSecurityModel.SecurityMode ) { ) { currentSecurityMode = securityMode currentSecurityMode = securityMode dispatchBroadcast() dispatchBroadcast() Loading @@ -208,23 +209,15 @@ class AuthenticationRepositoryTest : SysuiTestCase() { private fun dispatchBroadcast() { private fun dispatchBroadcast() { fakeBroadcastDispatcher.sendIntentToMatchingReceiversOnly( fakeBroadcastDispatcher.sendIntentToMatchingReceiversOnly( context, context, Intent(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED) Intent(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED), ) ) } } companion object { companion object { private val USER_INFOS = private val USER_INFOS = listOf( listOf( UserInfo( UserInfo(/* id= */ 100, /* name= */ "First user", /* flags= */ 0), /* id= */ 100, UserInfo(/* id= */ 101, /* name= */ "Second user", /* flags= */ 0), /* name= */ "First user", /* flags= */ 0, ), UserInfo( /* id= */ 101, /* name= */ "Second user", /* flags= */ 0, ), ) ) } } } }
packages/SystemUI/multivalentTests/src/com/android/systemui/bouncer/domain/interactor/BouncerActionButtonInteractorTest.kt +3 −2 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,8 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.pipeline.mobile.data.repository.FakeMobileConnectionsRepository import com.android.systemui.statusbar.pipeline.mobile.data.repository.FakeMobileConnectionsRepository import com.android.systemui.statusbar.pipeline.mobile.data.repository.fakeMobileConnectionsRepository import com.android.systemui.statusbar.pipeline.mobile.data.repository.fake import com.android.systemui.statusbar.pipeline.mobile.data.repository.mobileConnectionsRepository import com.android.systemui.telephony.data.repository.fakeTelephonyRepository import com.android.systemui.telephony.data.repository.fakeTelephonyRepository import com.android.systemui.testKosmos import com.android.systemui.testKosmos import com.android.systemui.user.domain.interactor.SelectedUserInteractor import com.android.systemui.user.domain.interactor.SelectedUserInteractor Loading Loading @@ -78,7 +79,7 @@ class BouncerActionButtonInteractorTest : SysuiTestCase() { fun setUp() { fun setUp() { MockitoAnnotations.initMocks(this) MockitoAnnotations.initMocks(this) mobileConnectionsRepository = kosmos.fakeMobileConnectionsRepository mobileConnectionsRepository = kosmos.mobileConnectionsRepository.fake overrideResource(R.string.lockscreen_emergency_call, MESSAGE_EMERGENCY_CALL) overrideResource(R.string.lockscreen_emergency_call, MESSAGE_EMERGENCY_CALL) overrideResource(R.string.lockscreen_return_to_call, MESSAGE_RETURN_TO_CALL) overrideResource(R.string.lockscreen_return_to_call, MESSAGE_RETURN_TO_CALL) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/BiometricSettingsRepositoryTest.kt +17 −16 Original line number Original line Diff line number Diff line Loading @@ -47,7 +47,8 @@ import com.android.systemui.keyguard.data.repository.BiometricType.SIDE_FINGERPR import com.android.systemui.keyguard.data.repository.BiometricType.UNDER_DISPLAY_FINGERPRINT import com.android.systemui.keyguard.data.repository.BiometricType.UNDER_DISPLAY_FINGERPRINT import com.android.systemui.keyguard.shared.model.DevicePosture import com.android.systemui.keyguard.shared.model.DevicePosture import com.android.systemui.res.R import com.android.systemui.res.R import com.android.systemui.statusbar.pipeline.mobile.data.repository.fakeMobileConnectionsRepository import com.android.systemui.statusbar.pipeline.mobile.data.repository.fake import com.android.systemui.statusbar.pipeline.mobile.data.repository.mobileConnectionsRepository import com.android.systemui.statusbar.policy.DevicePostureController import com.android.systemui.statusbar.policy.DevicePostureController import com.android.systemui.testKosmos import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.FakeUserRepository import com.android.systemui.user.data.repository.FakeUserRepository Loading Loading @@ -99,7 +100,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { private lateinit var devicePostureRepository: FakeDevicePostureRepository private lateinit var devicePostureRepository: FakeDevicePostureRepository private lateinit var facePropertyRepository: FakeFacePropertyRepository private lateinit var facePropertyRepository: FakeFacePropertyRepository private lateinit var fingerprintPropertyRepository: FakeFingerprintPropertyRepository private lateinit var fingerprintPropertyRepository: FakeFingerprintPropertyRepository private val mobileConnectionsRepository = kosmos.fakeMobileConnectionsRepository private val mobileConnectionsRepository = kosmos.mobileConnectionsRepository private lateinit var testDispatcher: TestDispatcher private lateinit var testDispatcher: TestDispatcher private lateinit var testScope: TestScope private lateinit var testScope: TestScope Loading Loading @@ -142,7 +143,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { 1, 1, SensorStrength.STRONG, SensorStrength.STRONG, FingerprintSensorType.UDFPS_OPTICAL, FingerprintSensorType.UDFPS_OPTICAL, emptyMap() emptyMap(), ) ) verify(lockPatternUtils).registerStrongAuthTracker(strongAuthTracker.capture()) verify(lockPatternUtils).registerStrongAuthTracker(strongAuthTracker.capture()) verify(authController, times(2)).addCallback(authControllerCallback.capture()) verify(authController, times(2)).addCallback(authControllerCallback.capture()) Loading Loading @@ -247,7 +248,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { private fun deviceIsInPostureThatSupportsFaceAuth() { private fun deviceIsInPostureThatSupportsFaceAuth() { overrideResource( overrideResource( R.integer.config_face_auth_supported_posture, R.integer.config_face_auth_supported_posture, DevicePostureController.DEVICE_POSTURE_FLIPPED DevicePostureController.DEVICE_POSTURE_FLIPPED, ) ) devicePostureRepository.setCurrentPosture(DevicePosture.FLIPPED) devicePostureRepository.setCurrentPosture(DevicePosture.FLIPPED) } } Loading Loading @@ -459,7 +460,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { biometricsAreEnabledBySettings() biometricsAreEnabledBySettings() doNotDisableKeyguardAuthFeatures() doNotDisableKeyguardAuthFeatures() mobileConnectionsRepository.isAnySimSecure.value = false mobileConnectionsRepository.fake.isAnySimSecure.value = false runCurrent() runCurrent() val isFaceAuthEnabledAndEnrolled by val isFaceAuthEnabledAndEnrolled by Loading @@ -467,7 +468,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { assertThat(isFaceAuthEnabledAndEnrolled).isTrue() assertThat(isFaceAuthEnabledAndEnrolled).isTrue() mobileConnectionsRepository.isAnySimSecure.value = true mobileConnectionsRepository.fake.isAnySimSecure.value = true runCurrent() runCurrent() assertThat(isFaceAuthEnabledAndEnrolled).isFalse() assertThat(isFaceAuthEnabledAndEnrolled).isFalse() Loading @@ -485,13 +486,13 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { doNotDisableKeyguardAuthFeatures() doNotDisableKeyguardAuthFeatures() faceAuthIsStrongBiometric() faceAuthIsStrongBiometric() biometricsAreEnabledBySettings() biometricsAreEnabledBySettings() mobileConnectionsRepository.isAnySimSecure.value = false mobileConnectionsRepository.fake.isAnySimSecure.value = false onStrongAuthChanged(STRONG_AUTH_NOT_REQUIRED, PRIMARY_USER_ID) onStrongAuthChanged(STRONG_AUTH_NOT_REQUIRED, PRIMARY_USER_ID) onNonStrongAuthChanged(false, PRIMARY_USER_ID) onNonStrongAuthChanged(false, PRIMARY_USER_ID) assertThat(isFaceAuthCurrentlyAllowed).isTrue() assertThat(isFaceAuthCurrentlyAllowed).isTrue() mobileConnectionsRepository.isAnySimSecure.value = true mobileConnectionsRepository.fake.isAnySimSecure.value = true assertThat(isFaceAuthCurrentlyAllowed).isFalse() assertThat(isFaceAuthCurrentlyAllowed).isFalse() } } Loading Loading @@ -584,7 +585,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { testScope.runTest { testScope.runTest { overrideResource( overrideResource( R.integer.config_face_auth_supported_posture, R.integer.config_face_auth_supported_posture, DevicePostureController.DEVICE_POSTURE_UNKNOWN DevicePostureController.DEVICE_POSTURE_UNKNOWN, ) ) createBiometricSettingsRepository() createBiometricSettingsRepository() Loading @@ -597,7 +598,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { testScope.runTest { testScope.runTest { overrideResource( overrideResource( R.integer.config_face_auth_supported_posture, R.integer.config_face_auth_supported_posture, DevicePostureController.DEVICE_POSTURE_FLIPPED DevicePostureController.DEVICE_POSTURE_FLIPPED, ) ) createBiometricSettingsRepository() createBiometricSettingsRepository() Loading Loading @@ -749,7 +750,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { 1, 1, SensorStrength.STRONG, SensorStrength.STRONG, FingerprintSensorType.UDFPS_OPTICAL, FingerprintSensorType.UDFPS_OPTICAL, emptyMap() emptyMap(), ) ) // Non strong auth is not allowed now, FP is marked strong // Non strong auth is not allowed now, FP is marked strong onStrongAuthChanged(STRONG_AUTH_NOT_REQUIRED, PRIMARY_USER_ID) onStrongAuthChanged(STRONG_AUTH_NOT_REQUIRED, PRIMARY_USER_ID) Loading @@ -761,7 +762,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { 1, 1, SensorStrength.CONVENIENCE, SensorStrength.CONVENIENCE, FingerprintSensorType.UDFPS_OPTICAL, FingerprintSensorType.UDFPS_OPTICAL, emptyMap() emptyMap(), ) ) assertThat(isFingerprintCurrentlyAllowed).isFalse() assertThat(isFingerprintCurrentlyAllowed).isFalse() Loading @@ -769,7 +770,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { 1, 1, SensorStrength.WEAK, SensorStrength.WEAK, FingerprintSensorType.UDFPS_OPTICAL, FingerprintSensorType.UDFPS_OPTICAL, emptyMap() emptyMap(), ) ) assertThat(isFingerprintCurrentlyAllowed).isFalse() assertThat(isFingerprintCurrentlyAllowed).isFalse() } } Loading @@ -791,7 +792,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { 1, 1, SensorStrength.STRONG, SensorStrength.STRONG, FingerprintSensorType.UDFPS_OPTICAL, FingerprintSensorType.UDFPS_OPTICAL, emptyMap() emptyMap(), ) ) // Non strong auth is not allowed now, FP is marked strong // Non strong auth is not allowed now, FP is marked strong onStrongAuthChanged(STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN, PRIMARY_USER_ID) onStrongAuthChanged(STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN, PRIMARY_USER_ID) Loading Loading @@ -830,7 +831,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { UserInfo( UserInfo( /* id= */ PRIMARY_USER_ID, /* id= */ PRIMARY_USER_ID, /* name= */ "primary user", /* name= */ "primary user", /* flags= */ UserInfo.FLAG_PRIMARY /* flags= */ UserInfo.FLAG_PRIMARY, ) ) private const val ANOTHER_USER_ID = 1 private const val ANOTHER_USER_ID = 1 Loading @@ -838,7 +839,7 @@ class BiometricSettingsRepositoryTest : SysuiTestCase() { UserInfo( UserInfo( /* id= */ ANOTHER_USER_ID, /* id= */ ANOTHER_USER_ID, /* name= */ "another user", /* name= */ "another user", /* flags= */ UserInfo.FLAG_PRIMARY /* flags= */ UserInfo.FLAG_PRIMARY, ) ) } } } }
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/domain/interactor/MobileIconsInteractorTest.kt +107 −121 File changed.Preview size limit exceeded, changes collapsed. Show changes
packages/SystemUI/tests/utils/src/com/android/systemui/flags/FakeFeatureFlags.kt +8 −5 Original line number Original line Diff line number Diff line Loading @@ -23,13 +23,13 @@ import java.io.PrintWriter class FakeFeatureFlagsClassic : FakeFeatureFlags() class FakeFeatureFlagsClassic : FakeFeatureFlags() val FeatureFlagsClassic.fake get() = this as FakeFeatureFlagsClassic @Deprecated( @Deprecated( message = "Use FakeFeatureFlagsClassic instead.", message = "Use FakeFeatureFlagsClassic instead.", replaceWith = replaceWith = ReplaceWith( ReplaceWith("FakeFeatureFlagsClassic", "com.android.systemui.flags.FakeFeatureFlagsClassic"), "FakeFeatureFlagsClassic", "com.android.systemui.flags.FakeFeatureFlagsClassic", ), ) ) open class FakeFeatureFlags : FeatureFlagsClassic { open class FakeFeatureFlags : FeatureFlagsClassic { private val booleanFlags = mutableMapOf<String, Boolean>() private val booleanFlags = mutableMapOf<String, Boolean>() Loading Loading @@ -105,6 +105,7 @@ open class FakeFeatureFlags : FeatureFlagsClassic { listener.onFlagChanged( listener.onFlagChanged( object : FlagListenable.FlagEvent { object : FlagListenable.FlagEvent { override val flagName = flag.name override val flagName = flag.name override fun requestNoRestart() {} override fun requestNoRestart() {} } } ) ) Loading Loading @@ -165,7 +166,7 @@ open class FakeFeatureFlags : FeatureFlagsClassic { @Module(includes = [FakeFeatureFlagsClassicModule.Bindings::class]) @Module(includes = [FakeFeatureFlagsClassicModule.Bindings::class]) class FakeFeatureFlagsClassicModule( class FakeFeatureFlagsClassicModule( @get:Provides val fakeFeatureFlagsClassic: FakeFeatureFlagsClassic = FakeFeatureFlagsClassic(), @get:Provides val fakeFeatureFlagsClassic: FakeFeatureFlagsClassic = FakeFeatureFlagsClassic() ) { ) { constructor( constructor( Loading @@ -175,7 +176,9 @@ class FakeFeatureFlagsClassicModule( @Module @Module interface Bindings { interface Bindings { @Binds fun bindFake(fake: FakeFeatureFlagsClassic): FeatureFlagsClassic @Binds fun bindFake(fake: FakeFeatureFlagsClassic): FeatureFlagsClassic @Binds fun bindClassic(classic: FeatureFlagsClassic): FeatureFlags @Binds fun bindClassic(classic: FeatureFlagsClassic): FeatureFlags @Binds fun bindFakeClassic(fake: FakeFeatureFlagsClassic): FakeFeatureFlags @Binds fun bindFakeClassic(fake: FakeFeatureFlagsClassic): FakeFeatureFlags } } } }