Merge "1/ Add ONE_HANDED_MODE_ACTIVATED secure settings for shortcut" into sc-dev
This commit is contained in:
@@ -8514,6 +8514,12 @@ public final class Settings {
|
||||
public static final String SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED =
|
||||
"swipe_bottom_to_notification_enabled";
|
||||
|
||||
/**
|
||||
* Controls whether One-Handed mode is currently activated.
|
||||
* @hide
|
||||
*/
|
||||
public static final String ONE_HANDED_MODE_ACTIVATED = "one_handed_mode_activated";
|
||||
|
||||
/**
|
||||
* For user preference if One-Handed Mode enabled.
|
||||
* @hide
|
||||
|
||||
@@ -430,6 +430,7 @@ message SecureSettingsProto {
|
||||
optional SettingProto one_handed_mode_enabled = 1 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||
optional SettingProto one_handed_mode_timeout = 2 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||
optional SettingProto taps_app_to_exit = 3 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||
optional SettingProto one_handed_mode_activated = 4 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||
}
|
||||
optional OneHanded onehanded = 80;
|
||||
|
||||
|
||||
@@ -256,4 +256,7 @@
|
||||
<!-- Default for Settings.Secure.ACCESSIBILITY_BUTTON_MODE -->
|
||||
<integer name="def_accessibility_button_mode">1</integer>
|
||||
|
||||
<!-- Default for Settings.Secure.ONE_HANDED_MODE_ACTIVATED -->
|
||||
<bool name="def_one_handed_mode_activated">false</bool>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -173,6 +173,7 @@ public class SecureSettings {
|
||||
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE,
|
||||
Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS,
|
||||
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY,
|
||||
Settings.Secure.ONE_HANDED_MODE_ACTIVATED,
|
||||
Settings.Secure.ONE_HANDED_MODE_ENABLED,
|
||||
Settings.Secure.ONE_HANDED_MODE_TIMEOUT,
|
||||
Settings.Secure.TAPS_APP_TO_EXIT,
|
||||
|
||||
@@ -262,6 +262,7 @@ public class SecureSettingsValidators {
|
||||
VALIDATORS.put(
|
||||
Secure.ACCESSIBILITY_BUTTON_TARGETS,
|
||||
ACCESSIBILITY_SHORTCUT_TARGET_LIST_VALIDATOR);
|
||||
VALIDATORS.put(Secure.ONE_HANDED_MODE_ACTIVATED, BOOLEAN_VALIDATOR);
|
||||
VALIDATORS.put(Secure.ONE_HANDED_MODE_ENABLED, BOOLEAN_VALIDATOR);
|
||||
VALIDATORS.put(Secure.ONE_HANDED_MODE_TIMEOUT, ANY_INTEGER_VALIDATOR);
|
||||
VALIDATORS.put(Secure.TAPS_APP_TO_EXIT, BOOLEAN_VALIDATOR);
|
||||
|
||||
@@ -3401,7 +3401,7 @@ public class SettingsProvider extends ContentProvider {
|
||||
}
|
||||
|
||||
private final class UpgradeController {
|
||||
private static final int SETTINGS_VERSION = 201;
|
||||
private static final int SETTINGS_VERSION = 202;
|
||||
|
||||
private final int mUserId;
|
||||
|
||||
@@ -4959,6 +4959,22 @@ public class SettingsProvider extends ContentProvider {
|
||||
currentVersion = 201;
|
||||
}
|
||||
|
||||
if (currentVersion == 201) {
|
||||
// Version 201: Set the default value for Secure Settings:
|
||||
final SettingsState secureSettings = getSecureSettingsLocked(userId);
|
||||
final Setting oneHandedModeActivated = secureSettings.getSettingLocked(
|
||||
Secure.ONE_HANDED_MODE_ACTIVATED);
|
||||
if (oneHandedModeActivated.isNull()) {
|
||||
final boolean defOneHandedModeActivated = getContext().getResources()
|
||||
.getBoolean(R.bool.def_one_handed_mode_activated);
|
||||
secureSettings.insertSettingLocked(
|
||||
Secure.ONE_HANDED_MODE_ACTIVATED,
|
||||
defOneHandedModeActivated ? "1" : "0", null, true,
|
||||
SettingsState.SYSTEM_PACKAGE_NAME);
|
||||
}
|
||||
currentVersion = 202;
|
||||
}
|
||||
|
||||
// vXXX: Add new settings above this point.
|
||||
|
||||
if (currentVersion != newVersion) {
|
||||
|
||||
Reference in New Issue
Block a user