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

Commit 427e206d authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Deprecate some active_unlock_unlock_intent triggers" into main

parents 3a53157e a0650873
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -11071,6 +11071,13 @@ public final class Settings {
        public static final String ACTIVE_UNLOCK_ON_BIOMETRIC_FAIL =
                "active_unlock_on_biometric_fail";
        /**
         * Whether or not active unlock triggers on legacy unlock intents.
         * @hide
         */
        public static final String ACTIVE_UNLOCK_ON_UNLOCK_INTENT_LEGACY =
                "active_unlock_on_unlock_intent_legacy";
        /**
         * If active unlock triggers on biometric failures, include the following error codes
         * as a biometric failure. See {@link android.hardware.biometrics.BiometricFaceConstants}.
+1 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ public class SecureSettings {
        Settings.Secure.SFPS_PERFORMANT_AUTH_ENABLED,
        Settings.Secure.ACTIVE_UNLOCK_ON_WAKE,
        Settings.Secure.ACTIVE_UNLOCK_ON_UNLOCK_INTENT,
        Settings.Secure.ACTIVE_UNLOCK_ON_UNLOCK_INTENT_LEGACY,
        Settings.Secure.ACTIVE_UNLOCK_ON_BIOMETRIC_FAIL,
        Settings.Secure.ACTIVE_UNLOCK_ON_FACE_ERRORS,
        Settings.Secure.ACTIVE_UNLOCK_ON_FACE_ACQUIRE_INFO,
+1 −0
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@ public class SecureSettingsValidators {
        VALIDATORS.put(Secure.ACTIVE_UNLOCK_ON_WAKE, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ACTIVE_UNLOCK_ON_UNLOCK_INTENT, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ACTIVE_UNLOCK_ON_BIOMETRIC_FAIL, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ACTIVE_UNLOCK_ON_UNLOCK_INTENT_LEGACY, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ACTIVE_UNLOCK_ON_FACE_ERRORS, ANY_STRING_VALIDATOR);
        VALIDATORS.put(Secure.ACTIVE_UNLOCK_ON_FACE_ACQUIRE_INFO, ANY_STRING_VALIDATOR);
        VALIDATORS.put(Secure.ACTIVE_UNLOCK_ON_UNLOCK_INTENT_WHEN_BIOMETRIC_ENROLLED,
+33 −8
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.provider.Settings.Secure.ACTIVE_UNLOCK_ON_BIOMETRIC_FAIL
import android.provider.Settings.Secure.ACTIVE_UNLOCK_ON_FACE_ACQUIRE_INFO
import android.provider.Settings.Secure.ACTIVE_UNLOCK_ON_FACE_ERRORS
import android.provider.Settings.Secure.ACTIVE_UNLOCK_ON_UNLOCK_INTENT
import android.provider.Settings.Secure.ACTIVE_UNLOCK_ON_UNLOCK_INTENT_LEGACY
import android.provider.Settings.Secure.ACTIVE_UNLOCK_ON_UNLOCK_INTENT_WHEN_BIOMETRIC_ENROLLED
import android.provider.Settings.Secure.ACTIVE_UNLOCK_ON_WAKE
import android.provider.Settings.Secure.ACTIVE_UNLOCK_WAKEUPS_CONSIDERED_UNLOCK_INTENTS
@@ -86,6 +87,12 @@ class ActiveUnlockConfig @Inject constructor(
         * Trigger ActiveUnlock when the assistant is triggered.
         */
        ASSISTANT,
        /**
         * Trigger ActiveUnlock on legacy unlock intents. This includes tapping on the empty space
         * of the notification shadse when face auth is enrolled and re-trying face auth on the
         * primary bouncer.
         */
        UNLOCK_INTENT_LEGACY,
    }

    /**
@@ -99,6 +106,7 @@ class ActiveUnlockConfig @Inject constructor(
    }

    private var requestActiveUnlockOnWakeup = false
    private var requestActiveUnlockOnUnlockIntentLegacy = false
    private var requestActiveUnlockOnUnlockIntent = false
    private var requestActiveUnlockOnBioFail = false

@@ -110,6 +118,8 @@ class ActiveUnlockConfig @Inject constructor(

    private val settingsObserver = object : ContentObserver(handler) {
        private val wakeUri = secureSettings.getUriFor(ACTIVE_UNLOCK_ON_WAKE)
        private val unlockIntentLegacyUri =
            secureSettings.getUriFor(ACTIVE_UNLOCK_ON_UNLOCK_INTENT_LEGACY)
        private val unlockIntentUri = secureSettings.getUriFor(ACTIVE_UNLOCK_ON_UNLOCK_INTENT)
        private val bioFailUri = secureSettings.getUriFor(ACTIVE_UNLOCK_ON_BIOMETRIC_FAIL)
        private val faceErrorsUri = secureSettings.getUriFor(ACTIVE_UNLOCK_ON_FACE_ERRORS)
@@ -164,6 +174,15 @@ class ActiveUnlockConfig @Inject constructor(
                        ACTIVE_UNLOCK_ON_WAKE, 0, selectedUserInteractor.getSelectedUserId()) == 1
            }

            if (selfChange || uris.contains(unlockIntentLegacyUri)) {
                requestActiveUnlockOnUnlockIntentLegacy =
                    secureSettings.getIntForUser(
                        ACTIVE_UNLOCK_ON_UNLOCK_INTENT_LEGACY,
                        0,
                        selectedUserInteractor.getSelectedUserId()
                    ) == 1
            }

            if (selfChange || uris.contains(unlockIntentUri)) {
                requestActiveUnlockOnUnlockIntent = secureSettings.getIntForUser(
                        ACTIVE_UNLOCK_ON_UNLOCK_INTENT, 0,
@@ -257,7 +276,7 @@ class ActiveUnlockConfig @Inject constructor(
     */
    fun isActiveUnlockEnabled(): Boolean {
        return requestActiveUnlockOnWakeup || requestActiveUnlockOnUnlockIntent ||
                requestActiveUnlockOnBioFail
            requestActiveUnlockOnBioFail || requestActiveUnlockOnUnlockIntentLegacy
    }

    /**
@@ -299,15 +318,18 @@ class ActiveUnlockConfig @Inject constructor(
    fun shouldAllowActiveUnlockFromOrigin(requestOrigin: ActiveUnlockRequestOrigin): Boolean {
        return when (requestOrigin) {
            ActiveUnlockRequestOrigin.WAKE -> requestActiveUnlockOnWakeup

            ActiveUnlockRequestOrigin.UNLOCK_INTENT_LEGACY ->
                requestActiveUnlockOnUnlockIntentLegacy
            ActiveUnlockRequestOrigin.UNLOCK_INTENT ->
                requestActiveUnlockOnUnlockIntent || requestActiveUnlockOnWakeup ||
                requestActiveUnlockOnUnlockIntent ||
                    requestActiveUnlockOnUnlockIntentLegacy ||
                    requestActiveUnlockOnWakeup ||
                    (shouldRequestActiveUnlockOnUnlockIntentFromBiometricEnrollment())

            ActiveUnlockRequestOrigin.BIOMETRIC_FAIL ->
                requestActiveUnlockOnBioFail || requestActiveUnlockOnUnlockIntent ||
                requestActiveUnlockOnBioFail ||
                    requestActiveUnlockOnUnlockIntentLegacy ||
                    requestActiveUnlockOnUnlockIntent ||
                    requestActiveUnlockOnWakeup

            ActiveUnlockRequestOrigin.ASSISTANT -> isActiveUnlockEnabled()
        }
    }
@@ -345,6 +367,9 @@ class ActiveUnlockConfig @Inject constructor(
    override fun dump(pw: PrintWriter, args: Array<out String>) {
        pw.println("Settings:")
        pw.println("   requestActiveUnlockOnWakeup=$requestActiveUnlockOnWakeup")
        pw.println(
            "   requestActiveUnlockOnUnlockIntentLegacy=$requestActiveUnlockOnUnlockIntentLegacy"
        )
        pw.println("   requestActiveUnlockOnUnlockIntent=$requestActiveUnlockOnUnlockIntent")
        pw.println("   requestActiveUnlockOnBioFail=$requestActiveUnlockOnBioFail")

+1 −1
Original line number Diff line number Diff line
@@ -351,7 +351,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
            mDeviceEntryFaceAuthInteractor.onSwipeUpOnBouncer();
            if (mDeviceEntryFaceAuthInteractor.isFaceAuthEnabledAndEnrolled()) {
                mUpdateMonitor.requestActiveUnlock(
                        ActiveUnlockConfig.ActiveUnlockRequestOrigin.UNLOCK_INTENT,
                        ActiveUnlockConfig.ActiveUnlockRequestOrigin.UNLOCK_INTENT_LEGACY,
                        "swipeUpOnBouncer");
            }
        }
Loading