Add Aware Lock Settings
Bug: 132106801 Test: rebuild & manual Change-Id: I9c0efdd195b367b0744685e5d001ff4e23b55408
This commit is contained in:
@@ -8836,6 +8836,15 @@ public final class Settings {
|
||||
public static final String AWARE_ENABLED = "aware_enabled";
|
||||
|
||||
private static final Validator AWARE_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
|
||||
|
||||
/**
|
||||
* Controls whether aware_lock is enabled.
|
||||
* @hide
|
||||
*/
|
||||
public static final String AWARE_LOCK_ENABLED = "aware_lock_enabled";
|
||||
|
||||
private static final Validator AWARE_LOCK_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
|
||||
|
||||
/**
|
||||
* This are the settings to be backed up.
|
||||
*
|
||||
@@ -8970,7 +8979,8 @@ public final class Settings {
|
||||
SILENCE_CALL_GESTURE_COUNT,
|
||||
SILENCE_TIMER_GESTURE_COUNT,
|
||||
DARK_MODE_DIALOG_SEEN,
|
||||
GLOBAL_ACTIONS_PANEL_ENABLED
|
||||
GLOBAL_ACTIONS_PANEL_ENABLED,
|
||||
AWARE_LOCK_ENABLED
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -9157,6 +9167,7 @@ public final class Settings {
|
||||
VALIDATORS.put(DARK_MODE_DIALOG_SEEN, BOOLEAN_VALIDATOR);
|
||||
VALIDATORS.put(UI_NIGHT_MODE, UI_NIGHT_MODE_VALIDATOR);
|
||||
VALIDATORS.put(GLOBAL_ACTIONS_PANEL_ENABLED, GLOBAL_ACTIONS_PANEL_ENABLED_VALIDATOR);
|
||||
VALIDATORS.put(AWARE_LOCK_ENABLED, AWARE_LOCK_ENABLED_VALIDATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -15382,4 +15393,4 @@ public final class Settings {
|
||||
}
|
||||
return packages[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,4 +235,7 @@
|
||||
|
||||
<!-- Default for Settings.Secure.SILENCE_GESTURE -->
|
||||
<bool name="def_silence_gesture">false</bool>
|
||||
|
||||
<!-- Default for Settings.Secure.AWARE_LOCK_ENABLED -->
|
||||
<bool name="def_aware_lock_enabled">false</bool>
|
||||
</resources>
|
||||
|
||||
@@ -3237,7 +3237,7 @@ public class SettingsProvider extends ContentProvider {
|
||||
}
|
||||
|
||||
private final class UpgradeController {
|
||||
private static final int SETTINGS_VERSION = 180;
|
||||
private static final int SETTINGS_VERSION = 181;
|
||||
|
||||
private final int mUserId;
|
||||
|
||||
@@ -4401,6 +4401,25 @@ public class SettingsProvider extends ContentProvider {
|
||||
currentVersion = 180;
|
||||
}
|
||||
|
||||
if (currentVersion == 180) {
|
||||
// Version 180: Set the default value for Secure Settings: AWARE_LOCK_ENABLED
|
||||
|
||||
final SettingsState secureSettings = getSecureSettingsLocked(userId);
|
||||
|
||||
final Setting awareLockEnabled = secureSettings.getSettingLocked(
|
||||
Secure.AWARE_LOCK_ENABLED);
|
||||
|
||||
if (awareLockEnabled.isNull()) {
|
||||
final boolean defAwareLockEnabled = getContext().getResources().getBoolean(
|
||||
R.bool.def_aware_lock_enabled);
|
||||
secureSettings.insertSettingLocked(
|
||||
Secure.AWARE_LOCK_ENABLED, defAwareLockEnabled ? "1" : "0",
|
||||
null, true, SettingsState.SYSTEM_PACKAGE_NAME);
|
||||
}
|
||||
|
||||
currentVersion = 181;
|
||||
}
|
||||
|
||||
// vXXX: Add new settings above this point.
|
||||
|
||||
if (currentVersion != newVersion) {
|
||||
|
||||
Reference in New Issue
Block a user