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

Commit 9be04e0c authored by Jesse Dai's avatar Jesse Dai
Browse files

New user setting for double tap to sleep

Bug: 396151336
Test: local build and presubmit
Flag: com.android.systemui.double_tap_to_sleep
Change-Id: Id1168916ecd4a1ef88ebad2996714f7c1aace472
parent 48d08ba1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -11124,6 +11124,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
@@ -134,6 +134,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
@@ -4077,7 +4077,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;

@@ -6316,6 +6316,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) {