From 668fe20d73530d76c9bbc7f1e3e1dec9e2b248da Mon Sep 17 00:00:00 2001 From: Bruno Martins Date: Tue, 20 Feb 2024 12:09:03 +0000 Subject: [PATCH] FingerprintSettings: Add proximity check awareness if supported Fingerprint authentication when screen is off doesn't nativelly support checking the proximity sensor status to prevent accidental unlocks. However, some devices implement this feature, so account for that. The only thing really needed is just to adapt the descriptions shown to the users. Change-Id: I635f7b1a2970c0364b6cd22dfe20e69d009a3f91 --- res/values/cm_strings.xml | 4 ++++ .../biometrics/fingerprint/FingerprintSettings.java | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index 88315e41c1a..b2ff42ede42 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -105,6 +105,10 @@ Touch the sensor on the side of your device. Touch the sensor on the side of your phone. + + Touch the sensor to unlock, even when the screen is off. Proximity sensor prevents accidental unlocking. + Navigation hint Show navigation hint bar at the bottom of the screen diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java index e3c4015878c..37cc2df9d5e 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java @@ -329,6 +329,7 @@ public class FingerprintSettings extends SubSettings { private PreferenceCategory mFingerprintsEnrolledCategory; private PreferenceCategory mFingerprintUnlockCategory; private PreferenceCategory mFingerprintUnlockFooter; + private boolean mProximityCheckOnFingerprintUnlock; private FingerprintManager mFingerprintManager; private FingerprintUpdater mFingerprintUpdater; @@ -567,6 +568,8 @@ public class FingerprintSettings extends SubSettings { mFingerprintManager = Utils.getFingerprintManagerOrNull(activity); mFingerprintUpdater = new FingerprintUpdater(activity, mFingerprintManager); mSensorProperties = mFingerprintManager.getSensorPropertiesInternal(); + mProximityCheckOnFingerprintUnlock = getContext().getResources().getBoolean( + org.lineageos.platform.internal.R.bool.config_proximityCheckOnFpsUnlock); mToken = getIntent().getByteArrayExtra( ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN); @@ -953,6 +956,10 @@ public class FingerprintSettings extends SubSettings { mRequireScreenOnToAuthPreferenceController.setChecked(!isChecked); return true; }); + if (mProximityCheckOnFingerprintUnlock) { + mRequireScreenOnToAuthPreference.setSummary(R.string. + security_settings_require_screen_on_to_auth_with_proximity_description); + } } private void setupFingerprintUnlockCategoryPreferencesForScreenOffUnlock() {