Merge "Add Aware Lock Settings" into qt-dev
am: a491cc4cd0
Change-Id: I7dd3de25fe1f1bd681cdfefd33bc9b134937827d
This commit is contained in:
@@ -8836,6 +8836,15 @@ public final class Settings {
|
|||||||
public static final String AWARE_ENABLED = "aware_enabled";
|
public static final String AWARE_ENABLED = "aware_enabled";
|
||||||
|
|
||||||
private static final Validator AWARE_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
|
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.
|
* This are the settings to be backed up.
|
||||||
*
|
*
|
||||||
@@ -8970,7 +8979,8 @@ public final class Settings {
|
|||||||
SILENCE_CALL_GESTURE_COUNT,
|
SILENCE_CALL_GESTURE_COUNT,
|
||||||
SILENCE_TIMER_GESTURE_COUNT,
|
SILENCE_TIMER_GESTURE_COUNT,
|
||||||
DARK_MODE_DIALOG_SEEN,
|
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(DARK_MODE_DIALOG_SEEN, BOOLEAN_VALIDATOR);
|
||||||
VALIDATORS.put(UI_NIGHT_MODE, UI_NIGHT_MODE_VALIDATOR);
|
VALIDATORS.put(UI_NIGHT_MODE, UI_NIGHT_MODE_VALIDATOR);
|
||||||
VALIDATORS.put(GLOBAL_ACTIONS_PANEL_ENABLED, GLOBAL_ACTIONS_PANEL_ENABLED_VALIDATOR);
|
VALIDATORS.put(GLOBAL_ACTIONS_PANEL_ENABLED, GLOBAL_ACTIONS_PANEL_ENABLED_VALIDATOR);
|
||||||
|
VALIDATORS.put(AWARE_LOCK_ENABLED, AWARE_LOCK_ENABLED_VALIDATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -235,4 +235,7 @@
|
|||||||
|
|
||||||
<!-- Default for Settings.Secure.SILENCE_GESTURE -->
|
<!-- Default for Settings.Secure.SILENCE_GESTURE -->
|
||||||
<bool name="def_silence_gesture">false</bool>
|
<bool name="def_silence_gesture">false</bool>
|
||||||
|
|
||||||
|
<!-- Default for Settings.Secure.AWARE_LOCK_ENABLED -->
|
||||||
|
<bool name="def_aware_lock_enabled">false</bool>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -3240,7 +3240,7 @@ public class SettingsProvider extends ContentProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final class UpgradeController {
|
private final class UpgradeController {
|
||||||
private static final int SETTINGS_VERSION = 180;
|
private static final int SETTINGS_VERSION = 181;
|
||||||
|
|
||||||
private final int mUserId;
|
private final int mUserId;
|
||||||
|
|
||||||
@@ -4404,6 +4404,25 @@ public class SettingsProvider extends ContentProvider {
|
|||||||
currentVersion = 180;
|
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.
|
// vXXX: Add new settings above this point.
|
||||||
|
|
||||||
if (currentVersion != newVersion) {
|
if (currentVersion != newVersion) {
|
||||||
|
|||||||
Reference in New Issue
Block a user