Loading core/java/android/provider/Settings.java +16 −0 Original line number Diff line number Diff line Loading @@ -7813,6 +7813,19 @@ public final class Settings { private static final Validator FACE_UNLOCK_APP_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; /** * Whether or not face unlock always requires user confirmation, meaning {@link * android.hardware.biometrics.BiometricPrompt.Builder#setRequireConfirmation(boolean)} * is always 'true'. This overrides the behavior that apps choose in the * setRequireConfirmation API. * @hide */ public static final String FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION = "face_unlock_always_require_confirmation"; private static final Validator FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION_VALIDATOR = BOOLEAN_VALIDATOR; /** * Whether the assist gesture should be enabled. * Loading Loading @@ -8410,6 +8423,7 @@ public final class Settings { AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN, FACE_UNLOCK_KEYGUARD_ENABLED, FACE_UNLOCK_APP_ENABLED, FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, ASSIST_GESTURE_ENABLED, ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, ASSIST_GESTURE_WAKE_ENABLED, Loading Loading @@ -8563,6 +8577,8 @@ public final class Settings { AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_VALIDATOR); VALIDATORS.put(FACE_UNLOCK_KEYGUARD_ENABLED, FACE_UNLOCK_KEYGUARD_ENABLED_VALIDATOR); VALIDATORS.put(FACE_UNLOCK_APP_ENABLED, FACE_UNLOCK_APP_ENABLED_VALIDATOR); VALIDATORS.put(FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION_VALIDATOR); VALIDATORS.put(ASSIST_GESTURE_ENABLED, ASSIST_GESTURE_ENABLED_VALIDATOR); VALIDATORS.put(ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, ASSIST_GESTURE_SILENCE_ALERTS_ENABLED_VALIDATOR); Loading services/core/java/com/android/server/biometrics/BiometricService.java +23 −1 Original line number Diff line number Diff line Loading @@ -132,10 +132,13 @@ public class BiometricService extends SystemService { Settings.Secure.getUriFor(Settings.Secure.FACE_UNLOCK_KEYGUARD_ENABLED); private final Uri FACE_UNLOCK_APP_ENABLED = Settings.Secure.getUriFor(Settings.Secure.FACE_UNLOCK_APP_ENABLED); private final Uri FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION = Settings.Secure.getUriFor(Settings.Secure.FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION); private final ContentResolver mContentResolver; private boolean mFaceEnabledOnKeyguard; private boolean mFaceEnabledForApps; private boolean mFaceAlwaysRequireConfirmation; /** * Creates a content observer. Loading @@ -158,10 +161,15 @@ public class BiometricService extends SystemService { false /* notifyForDescendents */, this /* observer */, UserHandle.USER_CURRENT); mContentResolver.registerContentObserver(FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, false /* notifyForDescendents */, this /* observer */, UserHandle.USER_CURRENT); // Update the value immediately onChange(true /* selfChange */, FACE_UNLOCK_KEYGUARD_ENABLED); onChange(true /* selfChange */, FACE_UNLOCK_APP_ENABLED); onChange(true /* selfChange */, FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION); } @Override Loading @@ -185,6 +193,13 @@ public class BiometricService extends SystemService { Settings.Secure.FACE_UNLOCK_APP_ENABLED, 1 /* default */, UserHandle.USER_CURRENT) != 0; } else if (FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION.equals(uri)) { mFaceAlwaysRequireConfirmation = Settings.Secure.getIntForUser( mContentResolver, Settings.Secure.FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, 0 /* default */, UserHandle.USER_CURRENT) != 0; } } Loading @@ -195,6 +210,10 @@ public class BiometricService extends SystemService { boolean getFaceEnabledForApps() { return mFaceEnabledForApps; } boolean getFaceAlwaysRequireConfirmation() { return mFaceAlwaysRequireConfirmation; } } private final class EnabledOnKeyguardCallback implements IBinder.DeathRecipient { Loading Loading @@ -731,7 +750,7 @@ public class BiometricService extends SystemService { IBiometricServiceReceiver receiver, String opPackageName, Bundle bundle, int callingUid, int callingPid, int callingUserId, int modality) { try { final boolean requireConfirmation = bundle.getBoolean( boolean requireConfirmation = bundle.getBoolean( BiometricPrompt.KEY_REQUIRE_CONFIRMATION, true /* default */); // Generate random cookies to pass to the services that should prepare to start Loading @@ -757,6 +776,9 @@ public class BiometricService extends SystemService { Slog.w(TAG, "Iris unsupported"); } if ((modality & TYPE_FACE) != 0) { // Check if the user has forced confirmation to be required in Settings. requireConfirmation = requireConfirmation || mSettingObserver.getFaceAlwaysRequireConfirmation(); mFaceService.prepareForAuthentication(requireConfirmation, token, sessionId, userId, mInternalReceiver, opPackageName, cookie, callingUid, callingPid, callingUserId); Loading Loading
core/java/android/provider/Settings.java +16 −0 Original line number Diff line number Diff line Loading @@ -7813,6 +7813,19 @@ public final class Settings { private static final Validator FACE_UNLOCK_APP_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; /** * Whether or not face unlock always requires user confirmation, meaning {@link * android.hardware.biometrics.BiometricPrompt.Builder#setRequireConfirmation(boolean)} * is always 'true'. This overrides the behavior that apps choose in the * setRequireConfirmation API. * @hide */ public static final String FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION = "face_unlock_always_require_confirmation"; private static final Validator FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION_VALIDATOR = BOOLEAN_VALIDATOR; /** * Whether the assist gesture should be enabled. * Loading Loading @@ -8410,6 +8423,7 @@ public final class Settings { AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN, FACE_UNLOCK_KEYGUARD_ENABLED, FACE_UNLOCK_APP_ENABLED, FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, ASSIST_GESTURE_ENABLED, ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, ASSIST_GESTURE_WAKE_ENABLED, Loading Loading @@ -8563,6 +8577,8 @@ public final class Settings { AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_VALIDATOR); VALIDATORS.put(FACE_UNLOCK_KEYGUARD_ENABLED, FACE_UNLOCK_KEYGUARD_ENABLED_VALIDATOR); VALIDATORS.put(FACE_UNLOCK_APP_ENABLED, FACE_UNLOCK_APP_ENABLED_VALIDATOR); VALIDATORS.put(FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION_VALIDATOR); VALIDATORS.put(ASSIST_GESTURE_ENABLED, ASSIST_GESTURE_ENABLED_VALIDATOR); VALIDATORS.put(ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, ASSIST_GESTURE_SILENCE_ALERTS_ENABLED_VALIDATOR); Loading
services/core/java/com/android/server/biometrics/BiometricService.java +23 −1 Original line number Diff line number Diff line Loading @@ -132,10 +132,13 @@ public class BiometricService extends SystemService { Settings.Secure.getUriFor(Settings.Secure.FACE_UNLOCK_KEYGUARD_ENABLED); private final Uri FACE_UNLOCK_APP_ENABLED = Settings.Secure.getUriFor(Settings.Secure.FACE_UNLOCK_APP_ENABLED); private final Uri FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION = Settings.Secure.getUriFor(Settings.Secure.FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION); private final ContentResolver mContentResolver; private boolean mFaceEnabledOnKeyguard; private boolean mFaceEnabledForApps; private boolean mFaceAlwaysRequireConfirmation; /** * Creates a content observer. Loading @@ -158,10 +161,15 @@ public class BiometricService extends SystemService { false /* notifyForDescendents */, this /* observer */, UserHandle.USER_CURRENT); mContentResolver.registerContentObserver(FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, false /* notifyForDescendents */, this /* observer */, UserHandle.USER_CURRENT); // Update the value immediately onChange(true /* selfChange */, FACE_UNLOCK_KEYGUARD_ENABLED); onChange(true /* selfChange */, FACE_UNLOCK_APP_ENABLED); onChange(true /* selfChange */, FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION); } @Override Loading @@ -185,6 +193,13 @@ public class BiometricService extends SystemService { Settings.Secure.FACE_UNLOCK_APP_ENABLED, 1 /* default */, UserHandle.USER_CURRENT) != 0; } else if (FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION.equals(uri)) { mFaceAlwaysRequireConfirmation = Settings.Secure.getIntForUser( mContentResolver, Settings.Secure.FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, 0 /* default */, UserHandle.USER_CURRENT) != 0; } } Loading @@ -195,6 +210,10 @@ public class BiometricService extends SystemService { boolean getFaceEnabledForApps() { return mFaceEnabledForApps; } boolean getFaceAlwaysRequireConfirmation() { return mFaceAlwaysRequireConfirmation; } } private final class EnabledOnKeyguardCallback implements IBinder.DeathRecipient { Loading Loading @@ -731,7 +750,7 @@ public class BiometricService extends SystemService { IBiometricServiceReceiver receiver, String opPackageName, Bundle bundle, int callingUid, int callingPid, int callingUserId, int modality) { try { final boolean requireConfirmation = bundle.getBoolean( boolean requireConfirmation = bundle.getBoolean( BiometricPrompt.KEY_REQUIRE_CONFIRMATION, true /* default */); // Generate random cookies to pass to the services that should prepare to start Loading @@ -757,6 +776,9 @@ public class BiometricService extends SystemService { Slog.w(TAG, "Iris unsupported"); } if ((modality & TYPE_FACE) != 0) { // Check if the user has forced confirmation to be required in Settings. requireConfirmation = requireConfirmation || mSettingObserver.getFaceAlwaysRequireConfirmation(); mFaceService.prepareForAuthentication(requireConfirmation, token, sessionId, userId, mInternalReceiver, opPackageName, cookie, callingUid, callingPid, callingUserId); Loading