Set the default value for Secure Settings: SKIP_GESTURE & SILENCE_GESTURE

Bug: 131127449
Test: rebuild & manual test
Change-Id: I57ca610937a52419a6782d9bfa2a05a3daf27bb1
This commit is contained in:
Edgar Wang
2019-05-07 18:53:31 +08:00
parent 4f4df1d755
commit dabc41e734
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

@@ -3237,7 +3237,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;
@@ -4356,6 +4356,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.