Merge "Set the default value for Secure Settings: AWARE_ENABLED" into qt-dev

This commit is contained in:
TreeHugger Robot
2019-04-26 17:12:28 +00:00
committed by Android (Google) Code Review
2 changed files with 23 additions and 1 deletions

View File

@@ -226,4 +226,7 @@
<!-- Default for Settings.Secure.NOTIFICATION_BUBBLES -->
<bool name="def_notification_bubbles">true</bool>
<!-- Default for Settings.Secure.AWARE_ENABLED -->
<bool name="def_aware_enabled">false</bool>
</resources>

View File

@@ -3237,7 +3237,7 @@ public class SettingsProvider extends ContentProvider {
}
private final class UpgradeController {
private static final int SETTINGS_VERSION = 177;
private static final int SETTINGS_VERSION = 178;
private final int mUserId;
@@ -4337,6 +4337,25 @@ public class SettingsProvider extends ContentProvider {
currentVersion = 177;
}
if (currentVersion == 177) {
// Version 177: Set the default value for Secure Settings: AWARE_ENABLED
final SettingsState secureSettings = getSecureSettingsLocked(userId);
final Setting awareEnabled = secureSettings.getSettingLocked(
Secure.AWARE_ENABLED);
if (awareEnabled.isNull()) {
final boolean defAwareEnabled = getContext().getResources().getBoolean(
R.bool.def_aware_enabled);
secureSettings.insertSettingLocked(
Secure.AWARE_ENABLED, defAwareEnabled ? "1" : "0",
null, true, SettingsState.SYSTEM_PACKAGE_NAME);
}
currentVersion = 178;
}
// vXXX: Add new settings above this point.