diff options
author | 2020-04-23 19:38:05 +0000 | |
---|---|---|
committer | 2020-04-23 19:38:05 +0000 | |
commit | eab14fca5dadd2b6f57ff37cce8ce2558c8b94f6 (patch) | |
tree | f07e6dc58baa9b6d2c0a5b97bc966d7cefa48967 | |
parent | 4a2288bf0e9fd87c815f7fc5cb69ecb882602513 (diff) | |
parent | 2095c43a25c0a8cb42dfb2493a1334bfb5984b0e (diff) |
Merge "[DO NOT MERGE] Add setting for power menu in lock screen privacy" into rvc-dev
7 files changed, 50 insertions, 2 deletions
diff --git a/api/test-current.txt b/api/test-current.txt index d8db1b930eb8..96cefe1afea4 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -3087,6 +3087,7 @@ package android.provider { field public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS = "lock_screen_show_notifications"; field public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component"; field public static final String NOTIFICATION_BADGING = "notification_badging"; + field public static final String POWER_MENU_LOCKED_SHOW_CONTENT = "power_menu_locked_show_content"; field @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds"; field public static final String USER_SETUP_COMPLETE = "user_setup_complete"; field public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service"; diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index fe340c46e3c4..ac1998a04016 100755 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -8607,6 +8607,16 @@ public final class Settings { public static final String CONTROLS_ENABLED = "controls_enabled"; /** + * Whether power menu content (cards, passes, controls) will be shown when device is locked. + * + * 0 indicates hide and 1 indicates show. A non existent value will be treated as hide. + * @hide + */ + @TestApi + public static final String POWER_MENU_LOCKED_SHOW_CONTENT = + "power_menu_locked_show_content"; + + /** * Specifies whether the web action API is enabled. * * @hide diff --git a/core/proto/android/providers/settings/secure.proto b/core/proto/android/providers/settings/secure.proto index 075aa97edb58..fe8a0f183546 100644 --- a/core/proto/android/providers/settings/secure.proto +++ b/core/proto/android/providers/settings/secure.proto @@ -397,6 +397,13 @@ message SecureSettingsProto { } optional ParentalControl parental_control = 43; + message PowerMenuPrivacy { + option (android.msg_privacy).dest = DEST_EXPLICIT; + + optional SettingProto show = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; + } + optional PowerMenuPrivacy power_menu_privacy = 81; + message PrintService { option (android.msg_privacy).dest = DEST_EXPLICIT; @@ -588,5 +595,5 @@ message SecureSettingsProto { // Please insert fields in alphabetical order and group them into messages // if possible (to avoid reaching the method limit). - // Next tag = 80; + // Next tag = 82; } diff --git a/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java b/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java index 736e995451cd..c04a1ba689b9 100644 --- a/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +++ b/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java @@ -97,6 +97,7 @@ public class SecureSettings { Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED, Settings.Secure.QS_TILES, Settings.Secure.CONTROLS_ENABLED, + Settings.Secure.POWER_MENU_LOCKED_SHOW_CONTENT, Settings.Secure.DOZE_ENABLED, Settings.Secure.DOZE_ALWAYS_ON, Settings.Secure.DOZE_PICK_UP_GESTURE, diff --git a/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java b/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java index b413e8e9dda2..76746e5488b6 100644 --- a/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +++ b/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java @@ -142,6 +142,7 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.SYSTEM_NAVIGATION_KEYS_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.QS_TILES, TILE_LIST_VALIDATOR); VALIDATORS.put(Secure.CONTROLS_ENABLED, BOOLEAN_VALIDATOR); + VALIDATORS.put(Secure.POWER_MENU_LOCKED_SHOW_CONTENT, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.DOZE_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.DOZE_ALWAYS_ON, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.DOZE_PICK_UP_GESTURE, BOOLEAN_VALIDATOR); diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java index 8a7b9134a5d9..a5dce6da348f 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java @@ -2278,6 +2278,12 @@ class SettingsProtoDumpUtil { SecureSettingsProto.ParentalControl.REDIRECT_URL); p.end(parentalControlToken); + final long powerMenuPrivacyToken = p.start(SecureSettingsProto.POWER_MENU_PRIVACY); + dumpSetting(s, p, + Settings.Secure.POWER_MENU_LOCKED_SHOW_CONTENT, + SecureSettingsProto.PowerMenuPrivacy.SHOW); + p.end(powerMenuPrivacyToken); + final long printServiceToken = p.start(SecureSettingsProto.PRINT_SERVICE); dumpSetting(s, p, Settings.Secure.PRINT_SERVICE_SEARCH_URI, diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index d3d04e5a31d0..74eee6300b2a 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -3437,7 +3437,7 @@ public class SettingsProvider extends ContentProvider { } private final class UpgradeController { - private static final int SETTINGS_VERSION = 189; + private static final int SETTINGS_VERSION = 190; private final int mUserId; @@ -4777,6 +4777,28 @@ public class SettingsProvider extends ContentProvider { currentVersion = 189; } + if (currentVersion == 189) { + final SettingsState secureSettings = getSecureSettingsLocked(userId); + final Setting showNotifications = secureSettings.getSettingLocked( + Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS); + final Setting allowPrivateNotifications = secureSettings.getSettingLocked( + Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS); + if ("1".equals(showNotifications.getValue()) + && "1".equals(allowPrivateNotifications.getValue())) { + secureSettings.insertSettingLocked( + Secure.POWER_MENU_LOCKED_SHOW_CONTENT, + "1", null /* tag */, false /* makeDefault */, + SettingsState.SYSTEM_PACKAGE_NAME); + } else if ("0".equals(showNotifications.getValue()) + || "0".equals(allowPrivateNotifications.getValue())) { + secureSettings.insertSettingLocked( + Secure.POWER_MENU_LOCKED_SHOW_CONTENT, + "0", null /* tag */, false /* makeDefault */, + SettingsState.SYSTEM_PACKAGE_NAME); + } + currentVersion = 190; + } + // vXXX: Add new settings above this point. if (currentVersion != newVersion) { |