From 072a487b00658d8934e80cc0da02966a727af9be 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 788823acf95..3ebebdcd894 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 465408f4aef..3236fec6880 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java @@ -298,6 +298,7 @@ public class FingerprintSettings extends SubSettings { private PreferenceCategory mFingerprintUnlockCategory; private PreferenceCategory mFingerprintUnlockFooter; private boolean mFingerprintWakeAndUnlock; + private boolean mProximityCheckOnFingerprintUnlock; private FingerprintManager mFingerprintManager; private FingerprintUpdater mFingerprintUpdater; @@ -477,6 +478,8 @@ public class FingerprintSettings extends SubSettings { mSensorProperties = mFingerprintManager.getSensorPropertiesInternal(); mFingerprintWakeAndUnlock = getContext().getResources().getBoolean( org.lineageos.platform.internal.R.bool.config_fingerprintWakeAndUnlock); + mProximityCheckOnFingerprintUnlock = getContext().getResources().getBoolean( + org.lineageos.platform.internal.R.bool.config_proximityCheckOnFpsUnlock); mToken = getIntent().getByteArrayExtra( ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN); @@ -789,6 +792,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() {