Merge "1/ Add ONE_HANDED_MODE_ACTIVATED secure settings for shortcut" into sc-dev

This commit is contained in:
Bill Lin
2021-04-29 04:49:42 +00:00
committed by Android (Google) Code Review
6 changed files with 29 additions and 1 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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>

View File

@@ -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,

View File

@@ -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);

View File

@@ -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) {