From 176f1a630a6c86cea2c51efb4c322d346219eff3 Mon Sep 17 00:00:00 2001 From: Jigar Thakkar Date: Fri, 24 May 2024 15:11:46 +0000 Subject: [PATCH] Do not request confirmation by default for private space unlocks Fix face unlock confirmation button behavior to respect "always require confirmation" setting. Adjust the description of the confirmation toggle in private space face unlock settings to reflect this change. Screenshot: https://screenshot.googleplex.com/4uHfm9Z3ZE56ZaT.png Bug: 342383195 Test: Tested manually by flashing local build Change-Id: I0f742839a862fe66cacad9f5704dbe8b0df3a0c2 --- res/values/strings.xml | 2 ++ .../face/FaceSettingsConfirmPreferenceController.java | 6 ++++++ .../settings/password/ConfirmDeviceCredentialActivity.java | 7 ++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index fa90d072fb3..8c7c84fcd29 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1262,6 +1262,8 @@ To unlock private space, your eyes must be open. For best results, take off sunglasses. Use your face to unlock your private space.\n\nKeep in mind:\nYou can only have one face set up at a time. To add another face, delete the current one.\n\nLooking at the phone can unlock it when you don\u2019t intend to.\n\nYour private space can be unlocked by someone else if your device is held up to your face.\n\nYour private space can be unlocked by someone who looks a lot like you, like an identical sibling. + + When using Face Unlock, always require confirmation step Ways to unlock diff --git a/src/com/android/settings/biometrics/face/FaceSettingsConfirmPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsConfirmPreferenceController.java index f71e2febccd..d8205339c67 100644 --- a/src/com/android/settings/biometrics/face/FaceSettingsConfirmPreferenceController.java +++ b/src/com/android/settings/biometrics/face/FaceSettingsConfirmPreferenceController.java @@ -26,6 +26,7 @@ import android.provider.Settings; import androidx.preference.Preference; +import com.android.settings.R; import com.android.settings.Utils; import java.util.List; @@ -76,6 +77,11 @@ public class FaceSettingsConfirmPreferenceController extends FaceSettingsPrefere preference.setEnabled(false); } else { preference.setEnabled(true); + // Update summary for private space face settings toggle + if (Utils.isPrivateProfile(getUserId(), mContext)) { + preference.setSummary(mContext.getString( + R.string.private_space_face_settings_require_confirmation_details)); + } } } diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java index dc9c2ec98b8..069f910adc0 100644 --- a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java +++ b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java @@ -313,7 +313,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity { mForceVerifyPath = userProperties.isCredentialShareableWithParent(); if (android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace() && isBiometricAllowed(effectiveUserId, mUserId)) { - promptInfo.setUseParentProfileForDeviceCredential(true); + setBiometricPromptPropertiesForPrivateProfile(promptInfo); showBiometricPrompt(promptInfo, effectiveUserId); launchedBiometric = true; } else { @@ -344,6 +344,11 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity { } } + private static void setBiometricPromptPropertiesForPrivateProfile(PromptInfo promptInfo) { + promptInfo.setUseParentProfileForDeviceCredential(true); + promptInfo.setConfirmationRequested(false); + } + private String getTitleFromCredentialType(@LockPatternUtils.CredentialType int credentialType, boolean isEffectiveUserManagedProfile) { switch (credentialType) {