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

Commit ee56b49f authored by Beverly's avatar Beverly Committed by Automerger Merge Worker
Browse files

RESTRICT AUTOMERGE Add activeUnlock config to force dismissKeyguard am: 0011ed15

parents 482b7f0a 0011ed15
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -9922,7 +9922,7 @@ public final class Settings {
        /**
         * If active unlock triggers on unlock intents, then also request active unlock on
         * these wake-up reasons. See PowerManager.WakeReason for value mappings.
         * these wake-up reasons. See {@link PowerManager.WakeReason} for value mappings.
         * WakeReasons should be separated by a pipe. For example: "0|3" or "0". If this
         * setting should be disabled, then this should be set to an empty string. A null value
         * will use the system default value (WAKE_REASON_UNFOLD_DEVICE).
@@ -9931,6 +9931,17 @@ public final class Settings {
        public static final String ACTIVE_UNLOCK_WAKEUPS_CONSIDERED_UNLOCK_INTENTS =
                "active_unlock_wakeups_considered_unlock_intents";
        /**
         * If active unlock triggers and succeeds on these wakeups, force dismiss keyguard on
         * these wake reasons. See {@link PowerManager#WakeReason} for value mappings.
         * WakeReasons should be separated by a pipe. For example: "0|3" or "0". If this
         * setting should be disabled, then this should be set to an empty string. A null value
         * will use the system default value (WAKE_REASON_UNFOLD_DEVICE).
         * @hide
         */
        public static final String ACTIVE_UNLOCK_WAKEUPS_TO_FORCE_DISMISS_KEYGUARD =
                "active_unlock_wakeups_to_force_dismiss_keyguard";
        /**
         * Whether the assist gesture should be enabled.
         *
+1 −0
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ public class SecureSettings {
        Settings.Secure.ACTIVE_UNLOCK_ON_FACE_ACQUIRE_INFO,
        Settings.Secure.ACTIVE_UNLOCK_ON_UNLOCK_INTENT_WHEN_BIOMETRIC_ENROLLED,
        Settings.Secure.ACTIVE_UNLOCK_WAKEUPS_CONSIDERED_UNLOCK_INTENTS,
        Settings.Secure.ACTIVE_UNLOCK_WAKEUPS_TO_FORCE_DISMISS_KEYGUARD,
        Settings.Secure.VR_DISPLAY_MODE,
        Settings.Secure.NOTIFICATION_BADGING,
        Settings.Secure.NOTIFICATION_DISMISS_RTL,
+2 −0
Original line number Diff line number Diff line
@@ -191,6 +191,8 @@ public class SecureSettingsValidators {
                ANY_STRING_VALIDATOR);
        VALIDATORS.put(Secure.ACTIVE_UNLOCK_WAKEUPS_CONSIDERED_UNLOCK_INTENTS,
                ANY_STRING_VALIDATOR);
        VALIDATORS.put(Secure.ACTIVE_UNLOCK_WAKEUPS_TO_FORCE_DISMISS_KEYGUARD,
                ANY_STRING_VALIDATOR);
        VALIDATORS.put(Secure.ASSIST_GESTURE_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ASSIST_GESTURE_WAKE_ENABLED, BOOLEAN_VALIDATOR);
+44 −1
Original line number Diff line number Diff line
@@ -29,8 +29,9 @@ 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_WHEN_BIOMETRIC_ENROLLED
import android.provider.Settings.Secure.ACTIVE_UNLOCK_WAKEUPS_CONSIDERED_UNLOCK_INTENTS
import android.provider.Settings.Secure.ACTIVE_UNLOCK_ON_WAKE
import android.provider.Settings.Secure.ACTIVE_UNLOCK_WAKEUPS_CONSIDERED_UNLOCK_INTENTS
import android.provider.Settings.Secure.ACTIVE_UNLOCK_WAKEUPS_TO_FORCE_DISMISS_KEYGUARD
import android.util.Log
import com.android.keyguard.KeyguardUpdateMonitor.getCurrentUser
import com.android.systemui.Dumpable
@@ -60,9 +61,27 @@ class ActiveUnlockConfig @Inject constructor(
     * Indicates the origin for an active unlock request.
     */
    enum class ActiveUnlockRequestOrigin {
        /**
         * Trigger ActiveUnlock on wake ups that'd trigger FaceAuth, see [FaceWakeUpTriggersConfig]
         */
        WAKE,

        /**
         * Trigger ActiveUnlock on unlock intents. This includes the bouncer showing or tapping on
         * a notification. May also include wakeups: [wakeupsConsideredUnlockIntents].
         */
        UNLOCK_INTENT,

        /**
         * Trigger ActiveUnlock on biometric failures. This may include soft errors depending on
         * the other settings. See: [faceErrorsToTriggerBiometricFailOn],
         * [faceAcquireInfoToTriggerBiometricFailOn].
         */
        BIOMETRIC_FAIL,

        /**
         * Trigger ActiveUnlock when the assistant is triggered.
         */
        ASSISTANT,
    }

@@ -85,6 +104,7 @@ class ActiveUnlockConfig @Inject constructor(
    private var faceAcquireInfoToTriggerBiometricFailOn = mutableSetOf<Int>()
    private var onUnlockIntentWhenBiometricEnrolled = mutableSetOf<Int>()
    private var wakeupsConsideredUnlockIntents = mutableSetOf<Int>()
    private var wakeupsToForceDismissKeyguard = mutableSetOf<Int>()

    private val settingsObserver = object : ContentObserver(handler) {
        private val wakeUri = secureSettings.getUriFor(ACTIVE_UNLOCK_ON_WAKE)
@@ -97,6 +117,8 @@ class ActiveUnlockConfig @Inject constructor(
                secureSettings.getUriFor(ACTIVE_UNLOCK_ON_UNLOCK_INTENT_WHEN_BIOMETRIC_ENROLLED)
        private val wakeupsConsideredUnlockIntentsUri =
            secureSettings.getUriFor(ACTIVE_UNLOCK_WAKEUPS_CONSIDERED_UNLOCK_INTENTS)
        private val wakeupsToForceDismissKeyguardUri =
            secureSettings.getUriFor(ACTIVE_UNLOCK_WAKEUPS_TO_FORCE_DISMISS_KEYGUARD)

        fun register() {
            registerUri(
@@ -108,6 +130,7 @@ class ActiveUnlockConfig @Inject constructor(
                        faceAcquireInfoUri,
                        unlockIntentWhenBiometricEnrolledUri,
                        wakeupsConsideredUnlockIntentsUri,
                        wakeupsToForceDismissKeyguardUri,
                    )
            )

@@ -182,6 +205,15 @@ class ActiveUnlockConfig @Inject constructor(
                    wakeupsConsideredUnlockIntents,
                    setOf(WAKE_REASON_UNFOLD_DEVICE))
            }

            if (selfChange || uris.contains(wakeupsToForceDismissKeyguardUri)) {
                processStringArray(
                    secureSettings.getStringForUser(
                        ACTIVE_UNLOCK_WAKEUPS_TO_FORCE_DISMISS_KEYGUARD,
                        getCurrentUser()),
                    wakeupsToForceDismissKeyguard,
                    setOf(WAKE_REASON_UNFOLD_DEVICE))
            }
        }

        /**
@@ -248,6 +280,14 @@ class ActiveUnlockConfig @Inject constructor(
        return wakeupsConsideredUnlockIntents.contains(pmWakeReason)
    }

    /**
     * Whether the PowerManager wake reason should force dismiss the keyguard if active
     * unlock is successful.
     */
    fun shouldWakeupForceDismissKeyguard(pmWakeReason: Int): Boolean {
        return wakeupsToForceDismissKeyguard.contains(pmWakeReason)
    }

    /**
     * Whether to trigger active unlock based on where the request is coming from and
     * the current settings.
@@ -321,6 +361,9 @@ class ActiveUnlockConfig @Inject constructor(
        pw.println("   activeUnlockWakeupsConsideredUnlockIntents=${
            wakeupsConsideredUnlockIntents.map { PowerManager.wakeReasonToString(it) }
        }")
        pw.println("   activeUnlockFromWakeupsToAlwaysDismissKeyguard=${
            wakeupsToForceDismissKeyguard.map { PowerManager.wakeReasonToString(it) }
        }")

        pw.println("Current state:")
        keyguardUpdateMonitor?.let {
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ import java.io.PrintWriter
import java.util.stream.Collectors
import javax.inject.Inject

/** Determines which device wake-ups should trigger face authentication. */
/** Determines which device wake-ups should trigger passive authentication. */
@SysUISingleton
class FaceWakeUpTriggersConfig
@Inject
Loading