Loading packages/SystemUI/src/com/android/systemui/biometrics/FingerprintInteractiveToAuthProvider.kt +10 −4 Original line number Diff line number Diff line Loading @@ -16,14 +16,20 @@ package com.android.systemui.biometrics import android.hardware.biometrics.common.AuthenticateReason import kotlinx.coroutines.flow.Flow /** Provides the status of the interactive to auth feature. */ /** * Provides the status of the interactive to auth feature. * * This controls whether fingerprint authentication can be used to unlock the device any time versus * only when the device is interactive. This is controlled by the user through a settings toggle. */ interface FingerprintInteractiveToAuthProvider { /** * @param userId the user Id. * @return true if the InteractiveToAuthFeature is enabled, false if disabled. * Whether the setting is enabled for the current user. This is the opposite of the "Touch to * Unlock" settings toggle. */ fun isEnabled(userId: Int): Boolean val enabledForCurrentUser: Flow<Boolean> /** * @param userId the user Id. Loading packages/SystemUI/src/com/android/systemui/user/domain/interactor/SelectedUserInteractor.kt +5 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ import com.android.systemui.flags.FeatureFlagsClassic import com.android.systemui.flags.Flags.REFACTOR_GETCURRENTUSER import com.android.systemui.user.data.repository.UserRepository import javax.inject.Inject import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map /** Encapsulates business logic to interact the selected user */ @SysUISingleton Loading @@ -17,6 +19,9 @@ constructor( private val flags: FeatureFlagsClassic, ) { /** Flow providing the ID of the currently selected user. */ val selectedUser = repository.selectedUserInfo.map { it.id }.distinctUntilChanged() /** * Returns the ID of the currently-selected user. * Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +0 −30 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import static android.hardware.biometrics.SensorProperties.STRENGTH_CONVENIENCE; import static android.hardware.biometrics.SensorProperties.STRENGTH_STRONG; import static android.hardware.face.FaceAuthenticateOptions.AUTHENTICATE_REASON_PRIMARY_BOUNCER_SHOWN; import static android.hardware.face.FaceAuthenticateOptions.AUTHENTICATE_REASON_STARTED_WAKING_UP; import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_POWER_BUTTON; import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFPS_OPTICAL; import static android.telephony.SubscriptionManager.DATA_ROAMING_DISABLE; import static android.telephony.SubscriptionManager.NAME_SOURCE_CARRIER_ID; Loading Loading @@ -1690,35 +1689,6 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(true)).isEqualTo(true); } @Test public void listeningForSfps_whenGoingToSleep_ifRequireInteractiveToAuthDisabled() throws RemoteException { // GIVEN SFPS supported and enrolled final ArrayList<FingerprintSensorPropertiesInternal> props = new ArrayList<>(); props.add(createFingerprintSensorPropertiesInternal(TYPE_POWER_BUTTON, /* isClass3 */ true)); when(mAuthController.getSfpsProps()).thenReturn(props); when(mAuthController.isSfpsEnrolled(anyInt())).thenReturn(true); // GIVEN Preconditions for sfps auth to run keyguardNotGoingAway(); currentUserIsSystem(); currentUserDoesNotHaveTrust(); biometricsNotDisabledThroughDevicePolicyManager(); biometricsEnabledForCurrentUser(); userNotCurrentlySwitching(); statusBarShadeIsLocked(); // WHEN require interactive to auth is disabled & keyguard is going to sleep when(mInteractiveToAuthProvider.isEnabled(anyInt())).thenReturn(false); deviceGoingToSleep(); mTestableLooper.processAllMessages(); // THEN we should listen for sfps because screen on to auth is disabled assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isTrue(); } @Test public void testShouldNotListenForUdfps_whenTrustEnabled() { // GIVEN a "we should listen for udfps" state Loading Loading
packages/SystemUI/src/com/android/systemui/biometrics/FingerprintInteractiveToAuthProvider.kt +10 −4 Original line number Diff line number Diff line Loading @@ -16,14 +16,20 @@ package com.android.systemui.biometrics import android.hardware.biometrics.common.AuthenticateReason import kotlinx.coroutines.flow.Flow /** Provides the status of the interactive to auth feature. */ /** * Provides the status of the interactive to auth feature. * * This controls whether fingerprint authentication can be used to unlock the device any time versus * only when the device is interactive. This is controlled by the user through a settings toggle. */ interface FingerprintInteractiveToAuthProvider { /** * @param userId the user Id. * @return true if the InteractiveToAuthFeature is enabled, false if disabled. * Whether the setting is enabled for the current user. This is the opposite of the "Touch to * Unlock" settings toggle. */ fun isEnabled(userId: Int): Boolean val enabledForCurrentUser: Flow<Boolean> /** * @param userId the user Id. Loading
packages/SystemUI/src/com/android/systemui/user/domain/interactor/SelectedUserInteractor.kt +5 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ import com.android.systemui.flags.FeatureFlagsClassic import com.android.systemui.flags.Flags.REFACTOR_GETCURRENTUSER import com.android.systemui.user.data.repository.UserRepository import javax.inject.Inject import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map /** Encapsulates business logic to interact the selected user */ @SysUISingleton Loading @@ -17,6 +19,9 @@ constructor( private val flags: FeatureFlagsClassic, ) { /** Flow providing the ID of the currently selected user. */ val selectedUser = repository.selectedUserInfo.map { it.id }.distinctUntilChanged() /** * Returns the ID of the currently-selected user. * Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +0 −30 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import static android.hardware.biometrics.SensorProperties.STRENGTH_CONVENIENCE; import static android.hardware.biometrics.SensorProperties.STRENGTH_STRONG; import static android.hardware.face.FaceAuthenticateOptions.AUTHENTICATE_REASON_PRIMARY_BOUNCER_SHOWN; import static android.hardware.face.FaceAuthenticateOptions.AUTHENTICATE_REASON_STARTED_WAKING_UP; import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_POWER_BUTTON; import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFPS_OPTICAL; import static android.telephony.SubscriptionManager.DATA_ROAMING_DISABLE; import static android.telephony.SubscriptionManager.NAME_SOURCE_CARRIER_ID; Loading Loading @@ -1690,35 +1689,6 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(true)).isEqualTo(true); } @Test public void listeningForSfps_whenGoingToSleep_ifRequireInteractiveToAuthDisabled() throws RemoteException { // GIVEN SFPS supported and enrolled final ArrayList<FingerprintSensorPropertiesInternal> props = new ArrayList<>(); props.add(createFingerprintSensorPropertiesInternal(TYPE_POWER_BUTTON, /* isClass3 */ true)); when(mAuthController.getSfpsProps()).thenReturn(props); when(mAuthController.isSfpsEnrolled(anyInt())).thenReturn(true); // GIVEN Preconditions for sfps auth to run keyguardNotGoingAway(); currentUserIsSystem(); currentUserDoesNotHaveTrust(); biometricsNotDisabledThroughDevicePolicyManager(); biometricsEnabledForCurrentUser(); userNotCurrentlySwitching(); statusBarShadeIsLocked(); // WHEN require interactive to auth is disabled & keyguard is going to sleep when(mInteractiveToAuthProvider.isEnabled(anyInt())).thenReturn(false); deviceGoingToSleep(); mTestableLooper.processAllMessages(); // THEN we should listen for sfps because screen on to auth is disabled assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isTrue(); } @Test public void testShouldNotListenForUdfps_whenTrustEnabled() { // GIVEN a "we should listen for udfps" state Loading