summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/biometrics/FingerprintInteractiveToAuthProvider.kt14
-rw-r--r--packages/SystemUI/src/com/android/systemui/user/domain/interactor/SelectedUserInteractor.kt5
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java30
3 files changed, 15 insertions, 34 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/FingerprintInteractiveToAuthProvider.kt b/packages/SystemUI/src/com/android/systemui/biometrics/FingerprintInteractiveToAuthProvider.kt
index a25c87419d2c..6e29fa5e886d 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/FingerprintInteractiveToAuthProvider.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/FingerprintInteractiveToAuthProvider.kt
@@ -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.
diff --git a/packages/SystemUI/src/com/android/systemui/user/domain/interactor/SelectedUserInteractor.kt b/packages/SystemUI/src/com/android/systemui/user/domain/interactor/SelectedUserInteractor.kt
index 0e693d0c8622..78fb7a491534 100644
--- a/packages/SystemUI/src/com/android/systemui/user/domain/interactor/SelectedUserInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/user/domain/interactor/SelectedUserInteractor.kt
@@ -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
@@ -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.
*
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
index efb08876b4f3..6099ece161b8 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
@@ -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;
@@ -1691,35 +1690,6 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
}
@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
mStatusBarStateListener.onStateChanged(StatusBarState.KEYGUARD);