Merge "Fix swipe for notification default should be on instead of off"

This commit is contained in:
Jason Chang
2020-12-18 09:29:06 +00:00
committed by Android (Google) Code Review
3 changed files with 37 additions and 2 deletions

View File

@@ -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) {

View File

@@ -241,6 +241,12 @@
<!-- Default for setting for Settings.Global.HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED -->
<bool name="def_hdmiControlAutoDeviceOff">false</bool>
<!-- Default for Settings.Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED -->
<bool name="def_swipe_bottom_to_notification_enabled">true</bool>
<!-- Default for Settings.Secure.ONE_HANDED_MODE_ENABLED -->
<bool name="def_one_handed_mode_enabled">false</bool>
<!-- Default for Settings.Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY -->
<integer name="def_accessibility_magnification_capabilities">3</integer>
</resources>

View File

@@ -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) {