diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/onehanded/OneHandedSettingsUtil.java b/libs/WindowManager/Shell/src/com/android/wm/shell/onehanded/OneHandedSettingsUtil.java index 4d66f2961a293..f8217c64e53d3 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/onehanded/OneHandedSettingsUtil.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/onehanded/OneHandedSettingsUtil.java @@ -126,7 +126,7 @@ public final class OneHandedSettingsUtil { */ public static boolean getSettingsSwipeToNotificationEnabled(ContentResolver resolver) { return Settings.Secure.getInt(resolver, - Settings.Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, 0) == 1; + Settings.Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, 1) == 1; } protected static void dump(PrintWriter pw, String prefix, ContentResolver resolver) { diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index 846efa78decfb..6c51f2f42bd47 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -241,6 +241,12 @@ false + + true + + + false + 3 diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index c9e3b6f631354..edb5506cb8ccf 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -3342,7 +3342,7 @@ public class SettingsProvider extends ContentProvider { } private final class UpgradeController { - private static final int SETTINGS_VERSION = 196; + private static final int SETTINGS_VERSION = 197; private final int mUserId; @@ -4786,6 +4786,35 @@ public class SettingsProvider extends ContentProvider { currentVersion = 196; } + if (currentVersion == 196) { + // Version 196: Set the default value for Secure Settings: + // SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED & ONE_HANDED_MODE_ENABLED + final SettingsState secureSettings = getSecureSettingsLocked(userId); + final Setting swipeNotification = secureSettings.getSettingLocked( + Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED); + if (swipeNotification.isNull()) { + final boolean defSwipeNotification = getContext().getResources() + .getBoolean(R.bool.def_swipe_bottom_to_notification_enabled); + secureSettings.insertSettingLocked( + Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, + defSwipeNotification ? "1" : "0", null, true, + SettingsState.SYSTEM_PACKAGE_NAME); + } + + final Setting oneHandedModeEnabled = secureSettings.getSettingLocked( + Secure.ONE_HANDED_MODE_ENABLED); + if (oneHandedModeEnabled.isNull()) { + final boolean defOneHandedModeEnabled = getContext().getResources() + .getBoolean(R.bool.def_one_handed_mode_enabled); + secureSettings.insertSettingLocked( + Secure.ONE_HANDED_MODE_ENABLED, + defOneHandedModeEnabled ? "1" : "0", null, true, + SettingsState.SYSTEM_PACKAGE_NAME); + } + + currentVersion = 197; + } + // vXXX: Add new settings above this point. if (currentVersion != newVersion) {