Merge "[DO NOT MERGE] Add setting for power menu in lock screen privacy" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
eab14fca5d
@@ -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";
|
||||
|
||||
@@ -8606,6 +8606,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.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user