Merge "Set the default value for Secure Settings: SKIP_GESTURE & SILENCE_GESTURE" into qt-dev

am: fa3034615f

Change-Id: I6cf12e05fd6fa7faff872fa208ac6dc9535011a1
This commit is contained in:
Edgar Wang
2019-05-09 04:12:00 -07:00
committed by android-build-merger
2 changed files with 38 additions and 1 deletions

View File

@@ -229,4 +229,10 @@
<!-- Default for Settings.Secure.AWARE_ENABLED -->
<bool name="def_aware_enabled">false</bool>
<!-- Default for Settings.Secure.SKIP_GESTURE -->
<bool name="def_skip_gesture">false</bool>
<!-- Default for Settings.Secure.SILENCE_GESTURE -->
<bool name="def_silence_gesture">false</bool>
</resources>

View File

@@ -3240,7 +3240,7 @@ public class SettingsProvider extends ContentProvider {
}
private final class UpgradeController {
private static final int SETTINGS_VERSION = 178;
private static final int SETTINGS_VERSION = 179;
private final int mUserId;
@@ -4359,6 +4359,37 @@ public class SettingsProvider extends ContentProvider {
currentVersion = 178;
}
if (currentVersion == 178) {
// Version 178: Set the default value for Secure Settings:
// SKIP_GESTURE & SILENCE_GESTURE
final SettingsState secureSettings = getSecureSettingsLocked(userId);
final Setting skipGesture = secureSettings.getSettingLocked(
Secure.SKIP_GESTURE);
if (skipGesture.isNull()) {
final boolean defSkipGesture = getContext().getResources().getBoolean(
R.bool.def_skip_gesture);
secureSettings.insertSettingLocked(
Secure.SKIP_GESTURE, defSkipGesture ? "1" : "0",
null, true, SettingsState.SYSTEM_PACKAGE_NAME);
}
final Setting silenceGesture = secureSettings.getSettingLocked(
Secure.SILENCE_GESTURE);
if (silenceGesture.isNull()) {
final boolean defSilenceGesture = getContext().getResources().getBoolean(
R.bool.def_silence_gesture);
secureSettings.insertSettingLocked(
Secure.SILENCE_GESTURE, defSilenceGesture ? "1" : "0",
null, true, SettingsState.SYSTEM_PACKAGE_NAME);
}
currentVersion = 179;
}
// vXXX: Add new settings above this point.