Loading packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryBiometricSettingsInteractorTest.kt 0 → 100644 +62 −0 Original line number Diff line number Diff line /* * 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.deviceentry.domain.interactor import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.keyguard.data.repository.biometricSettingsRepository import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith @OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntryBiometricSettingsInteractorTest : SysuiTestCase() { private val kosmos = testKosmos() private val biometricSettingsRepository = kosmos.biometricSettingsRepository private val underTest = kosmos.deviceEntryBiometricSettingsInteractor @Test fun isCoex_true() = runTest { val isCoex by collectLastValue(underTest.fingerprintAndFaceEnrolledAndEnabled) biometricSettingsRepository.setIsFaceAuthEnrolledAndEnabled(true) biometricSettingsRepository.setIsFingerprintAuthEnrolledAndEnabled(true) assertThat(isCoex).isTrue() } @Test fun isCoex_faceOnly() = runTest { val isCoex by collectLastValue(underTest.fingerprintAndFaceEnrolledAndEnabled) biometricSettingsRepository.setIsFaceAuthEnrolledAndEnabled(true) biometricSettingsRepository.setIsFingerprintAuthEnrolledAndEnabled(false) assertThat(isCoex).isFalse() } @Test fun isCoex_fingerprintOnly() = runTest { val isCoex by collectLastValue(underTest.fingerprintAndFaceEnrolledAndEnabled) biometricSettingsRepository.setIsFaceAuthEnrolledAndEnabled(false) biometricSettingsRepository.setIsFingerprintAuthEnrolledAndEnabled(true) assertThat(isCoex).isFalse() } } packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModelTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ class PrimaryBouncerToGoneTransitionViewModelTest : SysuiTestCase() { val keyguardTransitionRepository = kosmos.fakeKeyguardTransitionRepository val primaryBouncerInteractor = kosmos.mockPrimaryBouncerInteractor val sysuiStatusBarStateController = kosmos.sysuiStatusBarStateController private val sysuiStatusBarStateController = kosmos.sysuiStatusBarStateController val underTest by lazy { kosmos.primaryBouncerToGoneTransitionViewModel } @Before Loading packages/SystemUI/res-keyguard/layout/alternate_bouncer.xml +20 −0 Original line number Diff line number Diff line Loading @@ -32,4 +32,24 @@ android:importantForAccessibility="no" sysui:ignoreRightInset="true" /> <!-- Keyguard messages --> <LinearLayout android:id="@+id/alternate_bouncer_message_area_container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:layout_marginTop="@dimen/status_bar_height" android:layout_gravity="top|center_horizontal" android:gravity="center_horizontal"> <com.android.keyguard.AuthKeyguardMessageArea android:id="@+id/alternate_bouncer_message_area" style="@style/Keyguard.TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/keyguard_lock_padding" android:gravity="center" android:singleLine="true" android:ellipsize="marquee" android:focusable="true"/> </LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout> packages/SystemUI/src/com/android/systemui/biometrics/FaceHelpMessageDeferral.kt +20 −6 Original line number Diff line number Diff line Loading @@ -20,23 +20,37 @@ import android.content.res.Resources import com.android.keyguard.logging.BiometricMessageDeferralLogger import com.android.keyguard.logging.FaceMessageDeferralLogger import com.android.systemui.Dumpable import com.android.systemui.res.R import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.dump.DumpManager import com.android.systemui.res.R import java.io.PrintWriter import java.util.Objects import javax.inject.Inject @SysUISingleton class FaceHelpMessageDeferralFactory @Inject constructor( @Main private val resources: Resources, private val logBuffer: FaceMessageDeferralLogger, private val dumpManager: DumpManager ) { fun create(): FaceHelpMessageDeferral { return FaceHelpMessageDeferral( resources = resources, logBuffer = logBuffer, dumpManager = dumpManager, ) } } /** * Provides whether a face acquired help message should be shown immediately when its received or * should be shown when face auth times out. See [updateMessage] and [getDeferredMessage]. */ @SysUISingleton class FaceHelpMessageDeferral @Inject constructor( @Main resources: Resources, class FaceHelpMessageDeferral( resources: Resources, logBuffer: FaceMessageDeferralLogger, dumpManager: DumpManager ) : Loading packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/FingerprintPropertyInteractor.kt +2 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,8 @@ constructor( configurationInteractor: ConfigurationInteractor, displayStateInteractor: DisplayStateInteractor, ) { val isUdfps: Flow<Boolean> = repository.sensorType.map { it.isUdfps() } /** * Devices with multiple physical displays use unique display ids to determine which sensor is * on the active physical display. This value represents a unique physical display id. Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryBiometricSettingsInteractorTest.kt 0 → 100644 +62 −0 Original line number Diff line number Diff line /* * 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.deviceentry.domain.interactor import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.keyguard.data.repository.biometricSettingsRepository import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith @OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DeviceEntryBiometricSettingsInteractorTest : SysuiTestCase() { private val kosmos = testKosmos() private val biometricSettingsRepository = kosmos.biometricSettingsRepository private val underTest = kosmos.deviceEntryBiometricSettingsInteractor @Test fun isCoex_true() = runTest { val isCoex by collectLastValue(underTest.fingerprintAndFaceEnrolledAndEnabled) biometricSettingsRepository.setIsFaceAuthEnrolledAndEnabled(true) biometricSettingsRepository.setIsFingerprintAuthEnrolledAndEnabled(true) assertThat(isCoex).isTrue() } @Test fun isCoex_faceOnly() = runTest { val isCoex by collectLastValue(underTest.fingerprintAndFaceEnrolledAndEnabled) biometricSettingsRepository.setIsFaceAuthEnrolledAndEnabled(true) biometricSettingsRepository.setIsFingerprintAuthEnrolledAndEnabled(false) assertThat(isCoex).isFalse() } @Test fun isCoex_fingerprintOnly() = runTest { val isCoex by collectLastValue(underTest.fingerprintAndFaceEnrolledAndEnabled) biometricSettingsRepository.setIsFaceAuthEnrolledAndEnabled(false) biometricSettingsRepository.setIsFingerprintAuthEnrolledAndEnabled(true) assertThat(isCoex).isFalse() } }
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModelTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ class PrimaryBouncerToGoneTransitionViewModelTest : SysuiTestCase() { val keyguardTransitionRepository = kosmos.fakeKeyguardTransitionRepository val primaryBouncerInteractor = kosmos.mockPrimaryBouncerInteractor val sysuiStatusBarStateController = kosmos.sysuiStatusBarStateController private val sysuiStatusBarStateController = kosmos.sysuiStatusBarStateController val underTest by lazy { kosmos.primaryBouncerToGoneTransitionViewModel } @Before Loading
packages/SystemUI/res-keyguard/layout/alternate_bouncer.xml +20 −0 Original line number Diff line number Diff line Loading @@ -32,4 +32,24 @@ android:importantForAccessibility="no" sysui:ignoreRightInset="true" /> <!-- Keyguard messages --> <LinearLayout android:id="@+id/alternate_bouncer_message_area_container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:layout_marginTop="@dimen/status_bar_height" android:layout_gravity="top|center_horizontal" android:gravity="center_horizontal"> <com.android.keyguard.AuthKeyguardMessageArea android:id="@+id/alternate_bouncer_message_area" style="@style/Keyguard.TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/keyguard_lock_padding" android:gravity="center" android:singleLine="true" android:ellipsize="marquee" android:focusable="true"/> </LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>
packages/SystemUI/src/com/android/systemui/biometrics/FaceHelpMessageDeferral.kt +20 −6 Original line number Diff line number Diff line Loading @@ -20,23 +20,37 @@ import android.content.res.Resources import com.android.keyguard.logging.BiometricMessageDeferralLogger import com.android.keyguard.logging.FaceMessageDeferralLogger import com.android.systemui.Dumpable import com.android.systemui.res.R import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.dump.DumpManager import com.android.systemui.res.R import java.io.PrintWriter import java.util.Objects import javax.inject.Inject @SysUISingleton class FaceHelpMessageDeferralFactory @Inject constructor( @Main private val resources: Resources, private val logBuffer: FaceMessageDeferralLogger, private val dumpManager: DumpManager ) { fun create(): FaceHelpMessageDeferral { return FaceHelpMessageDeferral( resources = resources, logBuffer = logBuffer, dumpManager = dumpManager, ) } } /** * Provides whether a face acquired help message should be shown immediately when its received or * should be shown when face auth times out. See [updateMessage] and [getDeferredMessage]. */ @SysUISingleton class FaceHelpMessageDeferral @Inject constructor( @Main resources: Resources, class FaceHelpMessageDeferral( resources: Resources, logBuffer: FaceMessageDeferralLogger, dumpManager: DumpManager ) : Loading
packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/FingerprintPropertyInteractor.kt +2 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,8 @@ constructor( configurationInteractor: ConfigurationInteractor, displayStateInteractor: DisplayStateInteractor, ) { val isUdfps: Flow<Boolean> = repository.sensorType.map { it.isUdfps() } /** * Devices with multiple physical displays use unique display ids to determine which sensor is * on the active physical display. This value represents a unique physical display id. Loading