Loading core/java/android/provider/Settings.java +104 −9 Original line number Original line Diff line number Diff line Loading @@ -6030,6 +6030,57 @@ public final class Settings { private static final Validator MANUAL_RINGER_TOGGLE_COUNT_VALIDATOR = private static final Validator MANUAL_RINGER_TOGGLE_COUNT_VALIDATOR = NON_NEGATIVE_INTEGER_VALIDATOR; NON_NEGATIVE_INTEGER_VALIDATOR; /** * Whether to play a sound for charging events. * @hide */ public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled"; /** * Whether to vibrate for wireless charging events. * @hide */ public static final String CHARGING_VIBRATION_ENABLED = "charging_vibration_enabled"; /** * If 0, turning on dnd manually will last indefinitely. * Else if non-negative, turning on dnd manually will last for this many minutes. * Else (if negative), turning on dnd manually will surface a dialog that prompts * user to specify a duration. * @hide */ public static final String ZEN_DURATION = "zen_duration"; private static final Validator ZEN_DURATION_VALIDATOR = ANY_INTEGER_VALIDATOR; /** @hide */ public static final int ZEN_DURATION_PROMPT = -1; /** @hide */ public static final int ZEN_DURATION_FOREVER = 0; /** * If nonzero, will show the zen upgrade notification when the user toggles DND on/off. * @hide */ public static final String SHOW_ZEN_UPGRADE_NOTIFICATION = "show_zen_upgrade_notification"; /** * If nonzero, will show the zen update settings suggestion. * @hide */ public static final String SHOW_ZEN_SETTINGS_SUGGESTION = "show_zen_settings_suggestion"; /** * If nonzero, zen has not been updated to reflect new changes. * @hide */ public static final String ZEN_SETTINGS_UPDATED = "zen_settings_updated"; /** * If nonzero, zen setting suggestion has been viewed by user * @hide */ public static final String ZEN_SETTINGS_SUGGESTION_VIEWED = "zen_settings_suggestion_viewed"; /** /** * Whether the in call notification is enabled to play sound during calls. The value is * Whether the in call notification is enabled to play sound during calls. The value is * boolean (1 or 0). * boolean (1 or 0). Loading Loading @@ -8033,6 +8084,13 @@ public final class Settings { IN_CALL_NOTIFICATION_ENABLED, IN_CALL_NOTIFICATION_ENABLED, LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, LOCK_SCREEN_SHOW_NOTIFICATIONS, LOCK_SCREEN_SHOW_NOTIFICATIONS, ZEN_DURATION, SHOW_ZEN_UPGRADE_NOTIFICATION, SHOW_ZEN_SETTINGS_SUGGESTION, ZEN_SETTINGS_UPDATED, ZEN_SETTINGS_SUGGESTION_VIEWED, CHARGING_SOUNDS_ENABLED, CHARGING_VIBRATION_ENABLED, }; }; /** /** Loading Loading @@ -8178,6 +8236,13 @@ public final class Settings { VALIDATORS.put(IN_CALL_NOTIFICATION_ENABLED, IN_CALL_NOTIFICATION_ENABLED_VALIDATOR); VALIDATORS.put(IN_CALL_NOTIFICATION_ENABLED, IN_CALL_NOTIFICATION_ENABLED_VALIDATOR); VALIDATORS.put(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, BOOLEAN_VALIDATOR); VALIDATORS.put(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, BOOLEAN_VALIDATOR); VALIDATORS.put(LOCK_SCREEN_SHOW_NOTIFICATIONS, BOOLEAN_VALIDATOR); VALIDATORS.put(LOCK_SCREEN_SHOW_NOTIFICATIONS, BOOLEAN_VALIDATOR); VALIDATORS.put(ZEN_DURATION, ZEN_DURATION_VALIDATOR); VALIDATORS.put(SHOW_ZEN_UPGRADE_NOTIFICATION, BOOLEAN_VALIDATOR); VALIDATORS.put(SHOW_ZEN_SETTINGS_SUGGESTION, BOOLEAN_VALIDATOR); VALIDATORS.put(ZEN_SETTINGS_UPDATED, BOOLEAN_VALIDATOR); VALIDATORS.put(ZEN_SETTINGS_SUGGESTION_VIEWED, BOOLEAN_VALIDATOR); VALIDATORS.put(CHARGING_SOUNDS_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(CHARGING_VIBRATION_ENABLED, BOOLEAN_VALIDATOR); } } /** /** Loading Loading @@ -8651,16 +8716,20 @@ public final class Settings { /** /** * Whether to play a sound for charging events. * Whether to play a sound for charging events. * @deprecated Use {@link android.provider.Settings.Secure#CHARGING_SOUNDS_ENABLED} instead * @hide * @hide */ */ @Deprecated public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled"; public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled"; private static final Validator CHARGING_SOUNDS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; private static final Validator CHARGING_SOUNDS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; /** /** * Whether to vibrate for wireless charging events. * Whether to vibrate for wireless charging events. * @deprecated Use {@link android.provider.Settings.Secure#CHARGING_VIBRATION_ENABLED} * @hide * @hide */ */ @Deprecated public static final String CHARGING_VIBRATION_ENABLED = "charging_vibration_enabled"; public static final String CHARGING_VIBRATION_ENABLED = "charging_vibration_enabled"; private static final Validator CHARGING_VIBRATION_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; private static final Validator CHARGING_VIBRATION_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; Loading Loading @@ -11721,18 +11790,27 @@ public final class Settings { public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag"; public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag"; /** /** * If 0, turning on dnd manually will last indefinitely. * @deprecated Use {@link android.provider.Settings.Secure#ZEN_DURATION} instead * Else if non-negative, turning on dnd manually will last for this many minutes. * Else (if negative), turning on dnd manually will surface a dialog that prompts * user to specify a duration. * @hide * @hide */ */ @Deprecated public static final String ZEN_DURATION = "zen_duration"; public static final String ZEN_DURATION = "zen_duration"; private static final Validator ZEN_DURATION_VALIDATOR = ANY_INTEGER_VALIDATOR; private static final Validator ZEN_DURATION_VALIDATOR = ANY_INTEGER_VALIDATOR; /** @hide */ public static final int ZEN_DURATION_PROMPT = -1; /** /** @hide */ public static final int ZEN_DURATION_FOREVER = 0; * @deprecated Use {@link android.provider.Settings.Secure#ZEN_DURATION_PROMPT} instead * @hide */ @Deprecated public static final int ZEN_DURATION_PROMPT = -1; /** * @deprecated Use {@link android.provider.Settings.Secure#ZEN_DURATION_FOREVER} instead * @hide */ @Deprecated public static final int ZEN_DURATION_FOREVER = 0; /** /** * Defines global heads up toggle. One of HEADS_UP_OFF, HEADS_UP_ON. * Defines global heads up toggle. One of HEADS_UP_OFF, HEADS_UP_ON. Loading Loading @@ -12276,8 +12354,16 @@ public final class Settings { // Certain settings have been moved from global to the per-user secure namespace // Certain settings have been moved from global to the per-user secure namespace private static final HashSet<String> MOVED_TO_SECURE; private static final HashSet<String> MOVED_TO_SECURE; static { static { MOVED_TO_SECURE = new HashSet<>(1); MOVED_TO_SECURE = new HashSet<>(8); MOVED_TO_SECURE.add(Settings.Global.INSTALL_NON_MARKET_APPS); MOVED_TO_SECURE.add(Global.INSTALL_NON_MARKET_APPS); MOVED_TO_SECURE.add(Global.ZEN_DURATION); MOVED_TO_SECURE.add(Global.SHOW_ZEN_UPGRADE_NOTIFICATION); MOVED_TO_SECURE.add(Global.SHOW_ZEN_SETTINGS_SUGGESTION); MOVED_TO_SECURE.add(Global.ZEN_SETTINGS_UPDATED); MOVED_TO_SECURE.add(Global.ZEN_SETTINGS_SUGGESTION_VIEWED); MOVED_TO_SECURE.add(Global.CHARGING_SOUNDS_ENABLED); MOVED_TO_SECURE.add(Global.CHARGING_VIBRATION_ENABLED); } } /** @hide */ /** @hide */ Loading Loading @@ -12953,28 +13039,37 @@ public final class Settings { */ */ public static final String SHOW_MUTE_IN_CRASH_DIALOG = "show_mute_in_crash_dialog"; public static final String SHOW_MUTE_IN_CRASH_DIALOG = "show_mute_in_crash_dialog"; /** /** * If nonzero, will show the zen upgrade notification when the user toggles DND on/off. * If nonzero, will show the zen upgrade notification when the user toggles DND on/off. * @hide * @hide * @deprecated - Use {@link android.provider.Settings.Secure#SHOW_ZEN_UPGRADE_NOTIFICATION} */ */ @Deprecated public static final String SHOW_ZEN_UPGRADE_NOTIFICATION = "show_zen_upgrade_notification"; public static final String SHOW_ZEN_UPGRADE_NOTIFICATION = "show_zen_upgrade_notification"; /** /** * If nonzero, will show the zen update settings suggestion. * If nonzero, will show the zen update settings suggestion. * @hide * @hide * @deprecated - Use {@link android.provider.Settings.Secure#SHOW_ZEN_SETTINGS_SUGGESTION} */ */ @Deprecated public static final String SHOW_ZEN_SETTINGS_SUGGESTION = "show_zen_settings_suggestion"; public static final String SHOW_ZEN_SETTINGS_SUGGESTION = "show_zen_settings_suggestion"; /** /** * If nonzero, zen has not been updated to reflect new changes. * If nonzero, zen has not been updated to reflect new changes. * @deprecated - Use {@link android.provider.Settings.Secure#ZEN_SETTINGS_UPDATED} * @hide * @hide */ */ @Deprecated public static final String ZEN_SETTINGS_UPDATED = "zen_settings_updated"; public static final String ZEN_SETTINGS_UPDATED = "zen_settings_updated"; /** /** * If nonzero, zen setting suggestion has beem viewed by user * If nonzero, zen setting suggestion has been viewed by user * @hide * @hide * @deprecated - Use {@link android.provider.Settings.Secure#ZEN_SETTINGS_SUGGESTION_VIEWED} */ */ @Deprecated public static final String ZEN_SETTINGS_SUGGESTION_VIEWED = public static final String ZEN_SETTINGS_SUGGESTION_VIEWED = "zen_settings_suggestion_viewed"; "zen_settings_suggestion_viewed"; Loading core/proto/android/providers/settings/global.proto +3 −7 Original line number Original line Diff line number Diff line Loading @@ -745,7 +745,7 @@ message GlobalSettingsProto { optional SettingProto car_dock = 1; optional SettingProto car_dock = 1; optional SettingProto car_undock = 2; optional SettingProto car_undock = 2; optional SettingProto charging_sounds_enabled = 3 [ (android.privacy).dest = DEST_AUTOMATIC ]; reserved 3; // Moved to secure settings Sound.charging_sounds_enabled optional SettingProto charging_started = 4; optional SettingProto charging_started = 4; optional SettingProto desk_dock = 5; optional SettingProto desk_dock = 5; optional SettingProto desk_undock = 6; optional SettingProto desk_undock = 6; Loading Loading @@ -941,12 +941,8 @@ message GlobalSettingsProto { optional SettingProto mode = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto mode = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto mode_ringer_level = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto mode_ringer_level = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto mode_config_etag = 3; optional SettingProto mode_config_etag = 3; // If 0, turning on dnd manually will last indefinitely. Else if reserved 4; // Moved to secure settings Zen.duration // non-negative, turning on dnd manually will last for this many minutes. reserved 5; // Moved to secure settings Zen.show_zen_upgrade_notification // Else (if negative), turning on dnd manually will surface a dialog that // prompts user to specify a duration. optional SettingProto duration = 4 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto show_zen_upgrade_notification = 5 [ (android.privacy).dest = DEST_AUTOMATIC ]; } } optional Zen zen = 138; optional Zen zen = 138; Loading core/proto/android/providers/settings/secure.proto +26 −1 Original line number Original line Diff line number Diff line Loading @@ -300,6 +300,7 @@ message SecureSettingsProto { optional SettingProto enabled_policy_access_packages = 3 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto enabled_policy_access_packages = 3 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto badging = 4 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto badging = 4 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto show_note_about_notification_hiding = 5 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto show_note_about_notification_hiding = 5 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto in_call_notification_enabled = 6 [ (android.privacy).dest = DEST_AUTOMATIC ]; } } optional Notification notification = 41; optional Notification notification = 41; Loading Loading @@ -404,6 +405,15 @@ message SecureSettingsProto { optional SettingProto skip_first_use_hints = 52 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto skip_first_use_hints = 52 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto sleep_timeout = 53 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto sleep_timeout = 53 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto sms_default_application = 54 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto sms_default_application = 54 [ (android.privacy).dest = DEST_AUTOMATIC ]; message Sounds { option (android.msg_privacy).dest = DEST_EXPLICIT; optional SettingProto charging_sounds_enabled = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto charging_vibration_enabled = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; } optional Sounds sounds = 72; // Defines whether managed profile ringtones should be synced from its // Defines whether managed profile ringtones should be synced from its // parent profile. // parent profile. optional SettingProto sync_parent_sounds = 55 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto sync_parent_sounds = 55 [ (android.privacy).dest = DEST_AUTOMATIC ]; Loading Loading @@ -484,7 +494,22 @@ message SecureSettingsProto { optional SettingProto wake_gesture_enabled = 68 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto wake_gesture_enabled = 68 [ (android.privacy).dest = DEST_AUTOMATIC ]; message Zen { option (android.msg_privacy).dest = DEST_EXPLICIT; // If 0, turning on dnd manually will last indefinitely. Else if // non-negative, turning on dnd manually will last for this many minutes. // Else (if negative), turning on dnd manually will surface a dialog that // prompts user to specify a duration. optional SettingProto duration = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto show_zen_upgrade_notification = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto show_zen_settings_suggestion = 3 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto settings_updated = 4 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto settings_suggestion_viewed = 5 [ (android.privacy).dest = DEST_AUTOMATIC ]; } optional Zen zen = 71; // Please insert fields in alphabetical order and group them into messages // Please insert fields in alphabetical order and group them into messages // if possible (to avoid reaching the method limit). // if possible (to avoid reaching the method limit). // Next tag = 71; // Next tag = 73; } } core/tests/coretests/src/android/provider/SettingsBackupTest.java +1 −5 Original line number Original line Diff line number Diff line Loading @@ -389,10 +389,6 @@ public class SettingsBackupTest { Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, Settings.Global.SHOW_RESTART_IN_CRASH_DIALOG, Settings.Global.SHOW_RESTART_IN_CRASH_DIALOG, Settings.Global.SHOW_TEMPERATURE_WARNING, Settings.Global.SHOW_TEMPERATURE_WARNING, Settings.Global.SHOW_ZEN_UPGRADE_NOTIFICATION, Settings.Global.SHOW_ZEN_SETTINGS_SUGGESTION, Settings.Global.ZEN_SETTINGS_UPDATED, Settings.Global.ZEN_SETTINGS_SUGGESTION_VIEWED, Settings.Global.SMART_SELECTION_UPDATE_CONTENT_URL, Settings.Global.SMART_SELECTION_UPDATE_CONTENT_URL, Settings.Global.SMART_SELECTION_UPDATE_METADATA_URL, Settings.Global.SMART_SELECTION_UPDATE_METADATA_URL, Settings.Global.SMS_OUTGOING_CHECK_INTERVAL_MS, Settings.Global.SMS_OUTGOING_CHECK_INTERVAL_MS, Loading Loading @@ -495,8 +491,8 @@ public class SettingsBackupTest { Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED, Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED, Settings.Global.WIFI_WATCHDOG_ON, Settings.Global.WIFI_WATCHDOG_ON, Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON, Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON, Settings.Global.WINDOW_ANIMATION_SCALE, Settings.Global.CHARGING_STARTED_SOUND, Settings.Global.CHARGING_STARTED_SOUND, Settings.Global.WINDOW_ANIMATION_SCALE, Settings.Global.WTF_IS_FATAL, Settings.Global.WTF_IS_FATAL, Settings.Global.ZEN_MODE, Settings.Global.ZEN_MODE, Settings.Global.ZEN_MODE_CONFIG_ETAG, Settings.Global.ZEN_MODE_CONFIG_ETAG, Loading packages/SettingsLib/src/com/android/settingslib/notification/ZenDurationDialog.java +12 −11 Original line number Original line Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.content.DialogInterface; import android.provider.Settings; import android.provider.Settings; import android.service.notification.Condition; import android.service.notification.Condition; import android.service.notification.ZenModeConfig; import android.service.notification.ZenModeConfig; import androidx.annotation.VisibleForTesting; import android.view.LayoutInflater; import android.view.LayoutInflater; import android.view.View; import android.view.View; import android.widget.CompoundButton; import android.widget.CompoundButton; Loading @@ -42,6 +41,8 @@ import com.android.settingslib.R; import java.util.Arrays; import java.util.Arrays; import androidx.annotation.VisibleForTesting; public class ZenDurationDialog { public class ZenDurationDialog { private static final int[] MINUTE_BUCKETS = ZenModeConfig.MINUTE_BUCKETS; private static final int[] MINUTE_BUCKETS = ZenModeConfig.MINUTE_BUCKETS; @VisibleForTesting protected static final int MIN_BUCKET_MINUTES = MINUTE_BUCKETS[0]; @VisibleForTesting protected static final int MIN_BUCKET_MINUTES = MINUTE_BUCKETS[0]; Loading @@ -66,9 +67,9 @@ public class ZenDurationDialog { } } public Dialog createDialog() { public Dialog createDialog() { int zenDuration = Settings.Global.getInt( int zenDuration = Settings.Secure.getInt( mContext.getContentResolver(), Settings.Global.ZEN_DURATION, mContext.getContentResolver(), Settings.Secure.ZEN_DURATION, Settings.Global.ZEN_DURATION_FOREVER); Settings.Secure.ZEN_DURATION_FOREVER); final AlertDialog.Builder builder = new AlertDialog.Builder(mContext) final AlertDialog.Builder builder = new AlertDialog.Builder(mContext) .setTitle(R.string.zen_mode_duration_settings_title) .setTitle(R.string.zen_mode_duration_settings_title) Loading @@ -91,12 +92,12 @@ public class ZenDurationDialog { protected void updateZenDuration(int currZenDuration) { protected void updateZenDuration(int currZenDuration) { final int checkedRadioButtonId = mZenRadioGroup.getCheckedRadioButtonId(); final int checkedRadioButtonId = mZenRadioGroup.getCheckedRadioButtonId(); int newZenDuration = Settings.Global.getInt( int newZenDuration = Settings.Secure.getInt( mContext.getContentResolver(), Settings.Global.ZEN_DURATION, mContext.getContentResolver(), Settings.Secure.ZEN_DURATION, Settings.Global.ZEN_DURATION_FOREVER); Settings.Secure.ZEN_DURATION_FOREVER); switch (checkedRadioButtonId) { switch (checkedRadioButtonId) { case FOREVER_CONDITION_INDEX: case FOREVER_CONDITION_INDEX: newZenDuration = Settings.Global.ZEN_DURATION_FOREVER; newZenDuration = Settings.Secure.ZEN_DURATION_FOREVER; MetricsLogger.action(mContext, MetricsLogger.action(mContext, MetricsProto.MetricsEvent. MetricsProto.MetricsEvent. NOTIFICATION_ZEN_MODE_DURATION_FOREVER); NOTIFICATION_ZEN_MODE_DURATION_FOREVER); Loading @@ -110,7 +111,7 @@ public class ZenDurationDialog { newZenDuration); newZenDuration); break; break; case ALWAYS_ASK_CONDITION_INDEX: case ALWAYS_ASK_CONDITION_INDEX: newZenDuration = Settings.Global.ZEN_DURATION_PROMPT; newZenDuration = Settings.Secure.ZEN_DURATION_PROMPT; MetricsLogger.action(mContext, MetricsLogger.action(mContext, MetricsProto.MetricsEvent. MetricsProto.MetricsEvent. NOTIFICATION_ZEN_MODE_DURATION_PROMPT); NOTIFICATION_ZEN_MODE_DURATION_PROMPT); Loading @@ -118,8 +119,8 @@ public class ZenDurationDialog { } } if (currZenDuration != newZenDuration) { if (currZenDuration != newZenDuration) { Settings.Global.putInt(mContext.getContentResolver(), Settings.Secure.putInt(mContext.getContentResolver(), Settings.Global.ZEN_DURATION, newZenDuration); Settings.Secure.ZEN_DURATION, newZenDuration); } } } } Loading Loading
core/java/android/provider/Settings.java +104 −9 Original line number Original line Diff line number Diff line Loading @@ -6030,6 +6030,57 @@ public final class Settings { private static final Validator MANUAL_RINGER_TOGGLE_COUNT_VALIDATOR = private static final Validator MANUAL_RINGER_TOGGLE_COUNT_VALIDATOR = NON_NEGATIVE_INTEGER_VALIDATOR; NON_NEGATIVE_INTEGER_VALIDATOR; /** * Whether to play a sound for charging events. * @hide */ public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled"; /** * Whether to vibrate for wireless charging events. * @hide */ public static final String CHARGING_VIBRATION_ENABLED = "charging_vibration_enabled"; /** * If 0, turning on dnd manually will last indefinitely. * Else if non-negative, turning on dnd manually will last for this many minutes. * Else (if negative), turning on dnd manually will surface a dialog that prompts * user to specify a duration. * @hide */ public static final String ZEN_DURATION = "zen_duration"; private static final Validator ZEN_DURATION_VALIDATOR = ANY_INTEGER_VALIDATOR; /** @hide */ public static final int ZEN_DURATION_PROMPT = -1; /** @hide */ public static final int ZEN_DURATION_FOREVER = 0; /** * If nonzero, will show the zen upgrade notification when the user toggles DND on/off. * @hide */ public static final String SHOW_ZEN_UPGRADE_NOTIFICATION = "show_zen_upgrade_notification"; /** * If nonzero, will show the zen update settings suggestion. * @hide */ public static final String SHOW_ZEN_SETTINGS_SUGGESTION = "show_zen_settings_suggestion"; /** * If nonzero, zen has not been updated to reflect new changes. * @hide */ public static final String ZEN_SETTINGS_UPDATED = "zen_settings_updated"; /** * If nonzero, zen setting suggestion has been viewed by user * @hide */ public static final String ZEN_SETTINGS_SUGGESTION_VIEWED = "zen_settings_suggestion_viewed"; /** /** * Whether the in call notification is enabled to play sound during calls. The value is * Whether the in call notification is enabled to play sound during calls. The value is * boolean (1 or 0). * boolean (1 or 0). Loading Loading @@ -8033,6 +8084,13 @@ public final class Settings { IN_CALL_NOTIFICATION_ENABLED, IN_CALL_NOTIFICATION_ENABLED, LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, LOCK_SCREEN_SHOW_NOTIFICATIONS, LOCK_SCREEN_SHOW_NOTIFICATIONS, ZEN_DURATION, SHOW_ZEN_UPGRADE_NOTIFICATION, SHOW_ZEN_SETTINGS_SUGGESTION, ZEN_SETTINGS_UPDATED, ZEN_SETTINGS_SUGGESTION_VIEWED, CHARGING_SOUNDS_ENABLED, CHARGING_VIBRATION_ENABLED, }; }; /** /** Loading Loading @@ -8178,6 +8236,13 @@ public final class Settings { VALIDATORS.put(IN_CALL_NOTIFICATION_ENABLED, IN_CALL_NOTIFICATION_ENABLED_VALIDATOR); VALIDATORS.put(IN_CALL_NOTIFICATION_ENABLED, IN_CALL_NOTIFICATION_ENABLED_VALIDATOR); VALIDATORS.put(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, BOOLEAN_VALIDATOR); VALIDATORS.put(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, BOOLEAN_VALIDATOR); VALIDATORS.put(LOCK_SCREEN_SHOW_NOTIFICATIONS, BOOLEAN_VALIDATOR); VALIDATORS.put(LOCK_SCREEN_SHOW_NOTIFICATIONS, BOOLEAN_VALIDATOR); VALIDATORS.put(ZEN_DURATION, ZEN_DURATION_VALIDATOR); VALIDATORS.put(SHOW_ZEN_UPGRADE_NOTIFICATION, BOOLEAN_VALIDATOR); VALIDATORS.put(SHOW_ZEN_SETTINGS_SUGGESTION, BOOLEAN_VALIDATOR); VALIDATORS.put(ZEN_SETTINGS_UPDATED, BOOLEAN_VALIDATOR); VALIDATORS.put(ZEN_SETTINGS_SUGGESTION_VIEWED, BOOLEAN_VALIDATOR); VALIDATORS.put(CHARGING_SOUNDS_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(CHARGING_VIBRATION_ENABLED, BOOLEAN_VALIDATOR); } } /** /** Loading Loading @@ -8651,16 +8716,20 @@ public final class Settings { /** /** * Whether to play a sound for charging events. * Whether to play a sound for charging events. * @deprecated Use {@link android.provider.Settings.Secure#CHARGING_SOUNDS_ENABLED} instead * @hide * @hide */ */ @Deprecated public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled"; public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled"; private static final Validator CHARGING_SOUNDS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; private static final Validator CHARGING_SOUNDS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; /** /** * Whether to vibrate for wireless charging events. * Whether to vibrate for wireless charging events. * @deprecated Use {@link android.provider.Settings.Secure#CHARGING_VIBRATION_ENABLED} * @hide * @hide */ */ @Deprecated public static final String CHARGING_VIBRATION_ENABLED = "charging_vibration_enabled"; public static final String CHARGING_VIBRATION_ENABLED = "charging_vibration_enabled"; private static final Validator CHARGING_VIBRATION_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; private static final Validator CHARGING_VIBRATION_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; Loading Loading @@ -11721,18 +11790,27 @@ public final class Settings { public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag"; public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag"; /** /** * If 0, turning on dnd manually will last indefinitely. * @deprecated Use {@link android.provider.Settings.Secure#ZEN_DURATION} instead * Else if non-negative, turning on dnd manually will last for this many minutes. * Else (if negative), turning on dnd manually will surface a dialog that prompts * user to specify a duration. * @hide * @hide */ */ @Deprecated public static final String ZEN_DURATION = "zen_duration"; public static final String ZEN_DURATION = "zen_duration"; private static final Validator ZEN_DURATION_VALIDATOR = ANY_INTEGER_VALIDATOR; private static final Validator ZEN_DURATION_VALIDATOR = ANY_INTEGER_VALIDATOR; /** @hide */ public static final int ZEN_DURATION_PROMPT = -1; /** /** @hide */ public static final int ZEN_DURATION_FOREVER = 0; * @deprecated Use {@link android.provider.Settings.Secure#ZEN_DURATION_PROMPT} instead * @hide */ @Deprecated public static final int ZEN_DURATION_PROMPT = -1; /** * @deprecated Use {@link android.provider.Settings.Secure#ZEN_DURATION_FOREVER} instead * @hide */ @Deprecated public static final int ZEN_DURATION_FOREVER = 0; /** /** * Defines global heads up toggle. One of HEADS_UP_OFF, HEADS_UP_ON. * Defines global heads up toggle. One of HEADS_UP_OFF, HEADS_UP_ON. Loading Loading @@ -12276,8 +12354,16 @@ public final class Settings { // Certain settings have been moved from global to the per-user secure namespace // Certain settings have been moved from global to the per-user secure namespace private static final HashSet<String> MOVED_TO_SECURE; private static final HashSet<String> MOVED_TO_SECURE; static { static { MOVED_TO_SECURE = new HashSet<>(1); MOVED_TO_SECURE = new HashSet<>(8); MOVED_TO_SECURE.add(Settings.Global.INSTALL_NON_MARKET_APPS); MOVED_TO_SECURE.add(Global.INSTALL_NON_MARKET_APPS); MOVED_TO_SECURE.add(Global.ZEN_DURATION); MOVED_TO_SECURE.add(Global.SHOW_ZEN_UPGRADE_NOTIFICATION); MOVED_TO_SECURE.add(Global.SHOW_ZEN_SETTINGS_SUGGESTION); MOVED_TO_SECURE.add(Global.ZEN_SETTINGS_UPDATED); MOVED_TO_SECURE.add(Global.ZEN_SETTINGS_SUGGESTION_VIEWED); MOVED_TO_SECURE.add(Global.CHARGING_SOUNDS_ENABLED); MOVED_TO_SECURE.add(Global.CHARGING_VIBRATION_ENABLED); } } /** @hide */ /** @hide */ Loading Loading @@ -12953,28 +13039,37 @@ public final class Settings { */ */ public static final String SHOW_MUTE_IN_CRASH_DIALOG = "show_mute_in_crash_dialog"; public static final String SHOW_MUTE_IN_CRASH_DIALOG = "show_mute_in_crash_dialog"; /** /** * If nonzero, will show the zen upgrade notification when the user toggles DND on/off. * If nonzero, will show the zen upgrade notification when the user toggles DND on/off. * @hide * @hide * @deprecated - Use {@link android.provider.Settings.Secure#SHOW_ZEN_UPGRADE_NOTIFICATION} */ */ @Deprecated public static final String SHOW_ZEN_UPGRADE_NOTIFICATION = "show_zen_upgrade_notification"; public static final String SHOW_ZEN_UPGRADE_NOTIFICATION = "show_zen_upgrade_notification"; /** /** * If nonzero, will show the zen update settings suggestion. * If nonzero, will show the zen update settings suggestion. * @hide * @hide * @deprecated - Use {@link android.provider.Settings.Secure#SHOW_ZEN_SETTINGS_SUGGESTION} */ */ @Deprecated public static final String SHOW_ZEN_SETTINGS_SUGGESTION = "show_zen_settings_suggestion"; public static final String SHOW_ZEN_SETTINGS_SUGGESTION = "show_zen_settings_suggestion"; /** /** * If nonzero, zen has not been updated to reflect new changes. * If nonzero, zen has not been updated to reflect new changes. * @deprecated - Use {@link android.provider.Settings.Secure#ZEN_SETTINGS_UPDATED} * @hide * @hide */ */ @Deprecated public static final String ZEN_SETTINGS_UPDATED = "zen_settings_updated"; public static final String ZEN_SETTINGS_UPDATED = "zen_settings_updated"; /** /** * If nonzero, zen setting suggestion has beem viewed by user * If nonzero, zen setting suggestion has been viewed by user * @hide * @hide * @deprecated - Use {@link android.provider.Settings.Secure#ZEN_SETTINGS_SUGGESTION_VIEWED} */ */ @Deprecated public static final String ZEN_SETTINGS_SUGGESTION_VIEWED = public static final String ZEN_SETTINGS_SUGGESTION_VIEWED = "zen_settings_suggestion_viewed"; "zen_settings_suggestion_viewed"; Loading
core/proto/android/providers/settings/global.proto +3 −7 Original line number Original line Diff line number Diff line Loading @@ -745,7 +745,7 @@ message GlobalSettingsProto { optional SettingProto car_dock = 1; optional SettingProto car_dock = 1; optional SettingProto car_undock = 2; optional SettingProto car_undock = 2; optional SettingProto charging_sounds_enabled = 3 [ (android.privacy).dest = DEST_AUTOMATIC ]; reserved 3; // Moved to secure settings Sound.charging_sounds_enabled optional SettingProto charging_started = 4; optional SettingProto charging_started = 4; optional SettingProto desk_dock = 5; optional SettingProto desk_dock = 5; optional SettingProto desk_undock = 6; optional SettingProto desk_undock = 6; Loading Loading @@ -941,12 +941,8 @@ message GlobalSettingsProto { optional SettingProto mode = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto mode = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto mode_ringer_level = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto mode_ringer_level = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto mode_config_etag = 3; optional SettingProto mode_config_etag = 3; // If 0, turning on dnd manually will last indefinitely. Else if reserved 4; // Moved to secure settings Zen.duration // non-negative, turning on dnd manually will last for this many minutes. reserved 5; // Moved to secure settings Zen.show_zen_upgrade_notification // Else (if negative), turning on dnd manually will surface a dialog that // prompts user to specify a duration. optional SettingProto duration = 4 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto show_zen_upgrade_notification = 5 [ (android.privacy).dest = DEST_AUTOMATIC ]; } } optional Zen zen = 138; optional Zen zen = 138; Loading
core/proto/android/providers/settings/secure.proto +26 −1 Original line number Original line Diff line number Diff line Loading @@ -300,6 +300,7 @@ message SecureSettingsProto { optional SettingProto enabled_policy_access_packages = 3 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto enabled_policy_access_packages = 3 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto badging = 4 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto badging = 4 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto show_note_about_notification_hiding = 5 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto show_note_about_notification_hiding = 5 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto in_call_notification_enabled = 6 [ (android.privacy).dest = DEST_AUTOMATIC ]; } } optional Notification notification = 41; optional Notification notification = 41; Loading Loading @@ -404,6 +405,15 @@ message SecureSettingsProto { optional SettingProto skip_first_use_hints = 52 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto skip_first_use_hints = 52 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto sleep_timeout = 53 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto sleep_timeout = 53 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto sms_default_application = 54 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto sms_default_application = 54 [ (android.privacy).dest = DEST_AUTOMATIC ]; message Sounds { option (android.msg_privacy).dest = DEST_EXPLICIT; optional SettingProto charging_sounds_enabled = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto charging_vibration_enabled = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; } optional Sounds sounds = 72; // Defines whether managed profile ringtones should be synced from its // Defines whether managed profile ringtones should be synced from its // parent profile. // parent profile. optional SettingProto sync_parent_sounds = 55 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto sync_parent_sounds = 55 [ (android.privacy).dest = DEST_AUTOMATIC ]; Loading Loading @@ -484,7 +494,22 @@ message SecureSettingsProto { optional SettingProto wake_gesture_enabled = 68 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto wake_gesture_enabled = 68 [ (android.privacy).dest = DEST_AUTOMATIC ]; message Zen { option (android.msg_privacy).dest = DEST_EXPLICIT; // If 0, turning on dnd manually will last indefinitely. Else if // non-negative, turning on dnd manually will last for this many minutes. // Else (if negative), turning on dnd manually will surface a dialog that // prompts user to specify a duration. optional SettingProto duration = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto show_zen_upgrade_notification = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto show_zen_settings_suggestion = 3 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto settings_updated = 4 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto settings_suggestion_viewed = 5 [ (android.privacy).dest = DEST_AUTOMATIC ]; } optional Zen zen = 71; // Please insert fields in alphabetical order and group them into messages // Please insert fields in alphabetical order and group them into messages // if possible (to avoid reaching the method limit). // if possible (to avoid reaching the method limit). // Next tag = 71; // Next tag = 73; } }
core/tests/coretests/src/android/provider/SettingsBackupTest.java +1 −5 Original line number Original line Diff line number Diff line Loading @@ -389,10 +389,6 @@ public class SettingsBackupTest { Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, Settings.Global.SHOW_RESTART_IN_CRASH_DIALOG, Settings.Global.SHOW_RESTART_IN_CRASH_DIALOG, Settings.Global.SHOW_TEMPERATURE_WARNING, Settings.Global.SHOW_TEMPERATURE_WARNING, Settings.Global.SHOW_ZEN_UPGRADE_NOTIFICATION, Settings.Global.SHOW_ZEN_SETTINGS_SUGGESTION, Settings.Global.ZEN_SETTINGS_UPDATED, Settings.Global.ZEN_SETTINGS_SUGGESTION_VIEWED, Settings.Global.SMART_SELECTION_UPDATE_CONTENT_URL, Settings.Global.SMART_SELECTION_UPDATE_CONTENT_URL, Settings.Global.SMART_SELECTION_UPDATE_METADATA_URL, Settings.Global.SMART_SELECTION_UPDATE_METADATA_URL, Settings.Global.SMS_OUTGOING_CHECK_INTERVAL_MS, Settings.Global.SMS_OUTGOING_CHECK_INTERVAL_MS, Loading Loading @@ -495,8 +491,8 @@ public class SettingsBackupTest { Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED, Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED, Settings.Global.WIFI_WATCHDOG_ON, Settings.Global.WIFI_WATCHDOG_ON, Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON, Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON, Settings.Global.WINDOW_ANIMATION_SCALE, Settings.Global.CHARGING_STARTED_SOUND, Settings.Global.CHARGING_STARTED_SOUND, Settings.Global.WINDOW_ANIMATION_SCALE, Settings.Global.WTF_IS_FATAL, Settings.Global.WTF_IS_FATAL, Settings.Global.ZEN_MODE, Settings.Global.ZEN_MODE, Settings.Global.ZEN_MODE_CONFIG_ETAG, Settings.Global.ZEN_MODE_CONFIG_ETAG, Loading
packages/SettingsLib/src/com/android/settingslib/notification/ZenDurationDialog.java +12 −11 Original line number Original line Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.content.DialogInterface; import android.provider.Settings; import android.provider.Settings; import android.service.notification.Condition; import android.service.notification.Condition; import android.service.notification.ZenModeConfig; import android.service.notification.ZenModeConfig; import androidx.annotation.VisibleForTesting; import android.view.LayoutInflater; import android.view.LayoutInflater; import android.view.View; import android.view.View; import android.widget.CompoundButton; import android.widget.CompoundButton; Loading @@ -42,6 +41,8 @@ import com.android.settingslib.R; import java.util.Arrays; import java.util.Arrays; import androidx.annotation.VisibleForTesting; public class ZenDurationDialog { public class ZenDurationDialog { private static final int[] MINUTE_BUCKETS = ZenModeConfig.MINUTE_BUCKETS; private static final int[] MINUTE_BUCKETS = ZenModeConfig.MINUTE_BUCKETS; @VisibleForTesting protected static final int MIN_BUCKET_MINUTES = MINUTE_BUCKETS[0]; @VisibleForTesting protected static final int MIN_BUCKET_MINUTES = MINUTE_BUCKETS[0]; Loading @@ -66,9 +67,9 @@ public class ZenDurationDialog { } } public Dialog createDialog() { public Dialog createDialog() { int zenDuration = Settings.Global.getInt( int zenDuration = Settings.Secure.getInt( mContext.getContentResolver(), Settings.Global.ZEN_DURATION, mContext.getContentResolver(), Settings.Secure.ZEN_DURATION, Settings.Global.ZEN_DURATION_FOREVER); Settings.Secure.ZEN_DURATION_FOREVER); final AlertDialog.Builder builder = new AlertDialog.Builder(mContext) final AlertDialog.Builder builder = new AlertDialog.Builder(mContext) .setTitle(R.string.zen_mode_duration_settings_title) .setTitle(R.string.zen_mode_duration_settings_title) Loading @@ -91,12 +92,12 @@ public class ZenDurationDialog { protected void updateZenDuration(int currZenDuration) { protected void updateZenDuration(int currZenDuration) { final int checkedRadioButtonId = mZenRadioGroup.getCheckedRadioButtonId(); final int checkedRadioButtonId = mZenRadioGroup.getCheckedRadioButtonId(); int newZenDuration = Settings.Global.getInt( int newZenDuration = Settings.Secure.getInt( mContext.getContentResolver(), Settings.Global.ZEN_DURATION, mContext.getContentResolver(), Settings.Secure.ZEN_DURATION, Settings.Global.ZEN_DURATION_FOREVER); Settings.Secure.ZEN_DURATION_FOREVER); switch (checkedRadioButtonId) { switch (checkedRadioButtonId) { case FOREVER_CONDITION_INDEX: case FOREVER_CONDITION_INDEX: newZenDuration = Settings.Global.ZEN_DURATION_FOREVER; newZenDuration = Settings.Secure.ZEN_DURATION_FOREVER; MetricsLogger.action(mContext, MetricsLogger.action(mContext, MetricsProto.MetricsEvent. MetricsProto.MetricsEvent. NOTIFICATION_ZEN_MODE_DURATION_FOREVER); NOTIFICATION_ZEN_MODE_DURATION_FOREVER); Loading @@ -110,7 +111,7 @@ public class ZenDurationDialog { newZenDuration); newZenDuration); break; break; case ALWAYS_ASK_CONDITION_INDEX: case ALWAYS_ASK_CONDITION_INDEX: newZenDuration = Settings.Global.ZEN_DURATION_PROMPT; newZenDuration = Settings.Secure.ZEN_DURATION_PROMPT; MetricsLogger.action(mContext, MetricsLogger.action(mContext, MetricsProto.MetricsEvent. MetricsProto.MetricsEvent. NOTIFICATION_ZEN_MODE_DURATION_PROMPT); NOTIFICATION_ZEN_MODE_DURATION_PROMPT); Loading @@ -118,8 +119,8 @@ public class ZenDurationDialog { } } if (currZenDuration != newZenDuration) { if (currZenDuration != newZenDuration) { Settings.Global.putInt(mContext.getContentResolver(), Settings.Secure.putInt(mContext.getContentResolver(), Settings.Global.ZEN_DURATION, newZenDuration); Settings.Secure.ZEN_DURATION, newZenDuration); } } } } Loading