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

Commit ef86cf2a authored by Jesse Dai's avatar Jesse Dai Committed by Android (Google) Code Review
Browse files

Merge "New user setting for double tap to sleep" into main

parents e5899b07 9be04e0c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -11131,6 +11131,12 @@ public final class Settings {
        @Readable
        public static final String DOUBLE_TAP_TO_WAKE = "double_tap_to_wake";
        /**
         * Controls whether double tap to sleep is enabled.
         * @hide
         */
        public static final String DOUBLE_TAP_TO_SLEEP = "double_tap_to_sleep";
        /**
         * The current assistant component. It could be a voice interaction service,
         * or an activity that handles ACTION_ASSIST, or empty which means using the default
+3 −0
Original line number Diff line number Diff line
@@ -187,6 +187,9 @@
    <!-- Default state of tap to wake -->
    <bool name="def_double_tap_to_wake">true</bool>

    <!-- Default setting for double tap to sleep (Settings.Secure.DOUBLE_TAP_TO_SLEEP) -->
    <bool name="def_double_tap_to_sleep">false</bool>

    <!-- Default for Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT -->
    <string name="def_nfc_payment_component"></string>

+1 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ public class SecureSettings {
        Settings.Secure.MOUNT_UMS_PROMPT,
        Settings.Secure.MOUNT_UMS_NOTIFY_ENABLED,
        Settings.Secure.DOUBLE_TAP_TO_WAKE,
        Settings.Secure.DOUBLE_TAP_TO_SLEEP,
        Settings.Secure.WAKE_GESTURE_ENABLED,
        Settings.Secure.LONG_PRESS_TIMEOUT,
        Settings.Secure.KEY_REPEAT_ENABLED,
+1 −0
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ public class SecureSettingsValidators {
        VALIDATORS.put(Secure.MOUNT_UMS_PROMPT, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.MOUNT_UMS_NOTIFY_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.DOUBLE_TAP_TO_WAKE, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.DOUBLE_TAP_TO_SLEEP, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.WAKE_GESTURE_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.LONG_PRESS_TIMEOUT, NON_NEGATIVE_INTEGER_VALIDATOR);
        VALIDATORS.put(Secure.KEY_REPEAT_ENABLED, BOOLEAN_VALIDATOR);
+18 −1
Original line number Diff line number Diff line
@@ -4080,7 +4080,7 @@ public class SettingsProvider extends ContentProvider {

        @VisibleForTesting
        final class UpgradeController {
            private static final int SETTINGS_VERSION = 227;
            private static final int SETTINGS_VERSION = 228;

            private final int mUserId;

@@ -6319,6 +6319,23 @@ public class SettingsProvider extends ContentProvider {
                    currentVersion = 227;
                }

                // Version 227: Add default value for DOUBLE_TAP_TO_SLEEP.
                if (currentVersion == 227) {
                    final SettingsState secureSettings = getSecureSettingsLocked(userId);
                    final Setting doubleTapToSleep = secureSettings.getSettingLocked(
                            Settings.Secure.DOUBLE_TAP_TO_SLEEP);
                    if (doubleTapToSleep.isNull()) {
                        secureSettings.insertSettingOverrideableByRestoreLocked(
                                Settings.Secure.DOUBLE_TAP_TO_SLEEP,
                                getContext().getResources().getBoolean(
                                        R.bool.def_double_tap_to_sleep) ? "1" : "0",
                                null /* tag */,
                                true /* makeDefault */,
                                SettingsState.SYSTEM_PACKAGE_NAME);
                    }
                    currentVersion = 228;
                }

                // vXXX: Add new settings above this point.

                if (currentVersion != newVersion) {