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

Unverified Commit 7b625132 authored by Terminator-J's avatar Terminator-J Committed by Michael Bestas
Browse files

Settings: Show single-touch wakeup setting on rear & front fps devices

Not sure why Google assumed that showing this setting is only useful
for devices with FP sensor built into a side-mounted power button.

Change logic to preserve check for side mounted (really, power-button
mounted) FP sensors, but allow any device which has a a rear or front
mounted sensor to show the relevant setting; so users can toggle it.

Bug: Enchilada (Oneplus 6, capacitive FP sensor on the back) no longer
wakes & unlocks from screen-off with FP sensor touch after QPR3 merge.

Test: Apply commit. "Touch to unlock anytime" setting is now visible;
enabling once again allows one-touch wakeup-and-unlock-on-successful-
FP-auth, does nothing with failed FP auth, while disabling toggle
requires pressing power button to wake screen first before FP auth
will unlock.

Change-Id: I4d8204b5fed7d43baa93d6793e7280260ae404d6
parent c56b2191
Loading
Loading
Loading
Loading
+21 −8
Original line number Diff line number Diff line
@@ -175,7 +175,16 @@ public class FingerprintSettings extends SubSettings {
            if (manager == null || !manager.isHardwareDetected()) {
                return null;
            }
            if (manager.isPowerbuttonFps() && context.getResources().getBoolean(
            List<FingerprintSensorPropertiesInternal> sensorProperties =
                    manager.getSensorPropertiesInternal();
            boolean isUdfps = false;
            for (FingerprintSensorPropertiesInternal prop : sensorProperties) {
                if (prop.isAnyUdfpsType()) {
                    isUdfps = true;
                    break;
                }
            }
            if (!isUdfps && context.getResources().getBoolean(
                    org.lineageos.platform.internal.R.bool.config_fingerprintWakeAndUnlock)) {
                controllers.add(
                        new FingerprintUnlockCategoryController(
@@ -330,7 +339,7 @@ public class FingerprintSettings extends SubSettings {
                    case MSG_REFRESH_FINGERPRINT_TEMPLATES:
                        removeFingerprintPreference(msg.arg1);
                        updateAddPreference();
                        if (isSfps() && mFingerprintWakeAndUnlock) {
                        if (!isUdfps() && mFingerprintWakeAndUnlock) {
                            updateFingerprintUnlockCategoryVisibility();
                        }
                        updatePreferences();
@@ -523,7 +532,7 @@ public class FingerprintSettings extends SubSettings {
                        R.string.security_fingerprint_disclaimer_lockscreen_disabled_2
                );
                if (helpIntent != null) {
                    if (isSfps() && mFingerprintWakeAndUnlock) {
                    if (!isUdfps() && mFingerprintWakeAndUnlock) {
                        column2.mLearnMoreOverrideText = getText(
                                R.string.security_settings_fingerprint_settings_footer_learn_more);
                    }
@@ -546,11 +555,15 @@ public class FingerprintSettings extends SubSettings {
        }

        private boolean isUdfps() {
            mFingerprintManager = Utils.getFingerprintManagerOrNull(getActivity());
            if (mFingerprintManager != null) {
                mSensorProperties = mFingerprintManager.getSensorPropertiesInternal();
                for (FingerprintSensorPropertiesInternal prop : mSensorProperties) {
                    if (prop.isAnyUdfpsType()) {
                        return true;
                    }
                }
            }
            return false;
        }

@@ -605,7 +618,7 @@ public class FingerprintSettings extends SubSettings {
            // This needs to be after setting ids, otherwise
            // |mRequireScreenOnToAuthPreferenceController.isChecked| is always checking the primary
            // user instead of the user with |mUserId|.
            if (isSfps() && mFingerprintWakeAndUnlock) {
            if (!isUdfps() && mFingerprintWakeAndUnlock) {
                scrollToPreference(fpPrefKey);
                addFingerprintUnlockCategory();
            }
@@ -928,7 +941,7 @@ public class FingerprintSettings extends SubSettings {
        private List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
            final List<AbstractPreferenceController> controllers =
                    createThePreferenceControllers(context);
            if (isSfps() && context.getResources().getBoolean(
            if (!isUdfps() && context.getResources().getBoolean(
                    org.lineageos.platform.internal.R.bool.config_fingerprintWakeAndUnlock)) {
                for (AbstractPreferenceController controller : controllers) {
                    if (controller.getPreferenceKey() == KEY_FINGERPRINT_UNLOCK_CATEGORY) {
+1 −2
Original line number Diff line number Diff line
@@ -96,8 +96,7 @@ public class FingerprintSettingsRequireScreenOnToAuthPreferenceController
    @Override
    public int getAvailabilityStatus() {
        if (mFingerprintManager != null
                && mFingerprintManager.isHardwareDetected()
                && mFingerprintManager.isPowerbuttonFps()) {
                && mFingerprintManager.isHardwareDetected()) {
            return mFingerprintManager.hasEnrolledTemplates(getUserId())
                    ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
        } else {
+1 −2
Original line number Diff line number Diff line
@@ -41,8 +41,7 @@ public class FingerprintUnlockCategoryController extends BasePreferenceControlle
    @Override
    public int getAvailabilityStatus() {
        if (mFingerprintManager != null
                && mFingerprintManager.isHardwareDetected()
                && mFingerprintManager.isPowerbuttonFps()) {
                && mFingerprintManager.isHardwareDetected()) {
            return mFingerprintManager.hasEnrolledTemplates(getUserId())
                    ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
        } else {