Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aaf2384f authored by Bruno Martins's avatar Bruno Martins
Browse files

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
parent d776005a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -109,6 +109,10 @@
    <string name="fingerprint_enroll_touch_dialog_message_side" product="device">Touch the sensor on the side of your device.</string>
    <string name="fingerprint_enroll_touch_dialog_message_side" product="default">Touch the sensor on the side of your phone.</string>

    <!-- Description for require screen on to auth toggle shown in fingerprint enrollment dialog once enrollment is completed.
         Only for devices that support checking proximity prior to allowing fingerprint unlock. -->
    <string name="security_settings_require_screen_on_to_auth_with_proximity_description">Touch the sensor to unlock, even when the screen is off. Proximity sensor prevents accidental unlocking.</string>

    <!-- Navigation bar hint -->
    <string name="show_navbar_hint_title">Navigation hint</string>
    <string name="show_navbar_hint_summary">Show navigation hint bar at the bottom of the screen</string>
+7 −0
Original line number Diff line number Diff line
@@ -205,6 +205,7 @@ public class FingerprintSettings extends SubSettings {
        private PreferenceCategory mFingerprintUnlockCategory;
        private PreferenceCategory mFingerprintUnlockFooter;
        private boolean mFingerprintWakeAndUnlock;
        private boolean mProximityCheckOnFingerprintUnlock;

        private FingerprintManager mFingerprintManager;
        private FingerprintUpdater mFingerprintUpdater;
@@ -378,6 +379,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);
@@ -637,6 +640,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 updateAddPreference() {