Loading core/java/android/service/notification/ZenModeConfig.java +39 −32 Original line number Diff line number Diff line Loading @@ -16,6 +16,10 @@ package android.service.notification; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK; import android.app.ActivityManager; import android.app.AlarmManager; import android.app.NotificationManager; Loading Loading @@ -68,6 +72,7 @@ public class ZenModeConfig implements Parcelable { public static final int SOURCE_STAR = 2; public static final int MAX_SOURCE = SOURCE_STAR; private static final int DEFAULT_SOURCE = SOURCE_CONTACT; private static final int DEFAULT_CALLS_SOURCE = SOURCE_STAR; public static final String EVENTS_DEFAULT_RULE_ID = "EVENTS_DEFAULT_RULE"; public static final String EVERY_NIGHT_DEFAULT_RULE_ID = "EVERY_NIGHT_DEFAULT_RULE"; Loading @@ -93,13 +98,10 @@ public class ZenModeConfig implements Parcelable { private static final boolean DEFAULT_ALLOW_REMINDERS = false; private static final boolean DEFAULT_ALLOW_EVENTS = false; private static final boolean DEFAULT_ALLOW_REPEAT_CALLERS = false; private static final boolean DEFAULT_ALLOW_SCREEN_OFF = false; private static final boolean DEFAULT_ALLOW_SCREEN_ON = false; private static final boolean DEFAULT_CHANNELS_BYPASSING_DND = false; private static final int DEFAULT_SUPPRESSED_VISUAL_EFFECTS = Policy.getAllSuppressedVisualEffects(); private static final int DEFAULT_SUPPRESSED_VISUAL_EFFECTS = 0; public static final int XML_VERSION = 7; public static final int XML_VERSION = 8; public static final String ZEN_TAG = "zen"; private static final String ZEN_ATT_VERSION = "version"; private static final String ZEN_ATT_USER = "user"; Loading Loading @@ -151,12 +153,10 @@ public class ZenModeConfig implements Parcelable { public boolean allowMessages = DEFAULT_ALLOW_MESSAGES; public boolean allowReminders = DEFAULT_ALLOW_REMINDERS; public boolean allowEvents = DEFAULT_ALLOW_EVENTS; public int allowCallsFrom = DEFAULT_SOURCE; public int allowCallsFrom = DEFAULT_CALLS_SOURCE; public int allowMessagesFrom = DEFAULT_SOURCE; public int user = UserHandle.USER_SYSTEM; public int suppressedVisualEffects = DEFAULT_SUPPRESSED_VISUAL_EFFECTS; public boolean allowWhenScreenOff = DEFAULT_ALLOW_SCREEN_OFF; public boolean allowWhenScreenOn = DEFAULT_ALLOW_SCREEN_ON; public boolean areChannelsBypassingDnd = DEFAULT_CHANNELS_BYPASSING_DND; public int version; Loading Loading @@ -185,8 +185,6 @@ public class ZenModeConfig implements Parcelable { automaticRules.put(ids[i], rules[i]); } } allowWhenScreenOff = source.readInt() == 1; allowWhenScreenOn = source.readInt() == 1; allowAlarms = source.readInt() == 1; allowMedia = source.readInt() == 1; allowSystem = source.readInt() == 1; Loading Loading @@ -219,8 +217,6 @@ public class ZenModeConfig implements Parcelable { } else { dest.writeInt(0); } dest.writeInt(allowWhenScreenOff ? 1 : 0); dest.writeInt(allowWhenScreenOn ? 1 : 0); dest.writeInt(allowAlarms ? 1 : 0); dest.writeInt(allowMedia ? 1 : 0); dest.writeInt(allowSystem ? 1 : 0); Loading @@ -242,8 +238,6 @@ public class ZenModeConfig implements Parcelable { .append(",allowMessages=").append(allowMessages) .append(",allowCallsFrom=").append(sourceToString(allowCallsFrom)) .append(",allowMessagesFrom=").append(sourceToString(allowMessagesFrom)) .append(",allowWhenScreenOff=").append(allowWhenScreenOff) .append(",allowWhenScreenOn=").append(allowWhenScreenOn) .append(",suppressedVisualEffects=").append(suppressedVisualEffects) .append(",areChannelsBypassingDnd=").append(areChannelsBypassingDnd) .append(",automaticRules=").append(automaticRules) Loading Loading @@ -289,12 +283,6 @@ public class ZenModeConfig implements Parcelable { if (allowMessagesFrom != to.allowMessagesFrom) { d.addLine("allowMessagesFrom", allowMessagesFrom, to.allowMessagesFrom); } if (allowWhenScreenOff != to.allowWhenScreenOff) { d.addLine("allowWhenScreenOff", allowWhenScreenOff, to.allowWhenScreenOff); } if (allowWhenScreenOn != to.allowWhenScreenOn) { d.addLine("allowWhenScreenOn", allowWhenScreenOn, to.allowWhenScreenOn); } if (suppressedVisualEffects != to.suppressedVisualEffects) { d.addLine("suppressedVisualEffects", suppressedVisualEffects, to.suppressedVisualEffects); Loading Loading @@ -404,8 +392,6 @@ public class ZenModeConfig implements Parcelable { && other.allowMessagesFrom == allowMessagesFrom && other.allowReminders == allowReminders && other.allowEvents == allowEvents && other.allowWhenScreenOff == allowWhenScreenOff && other.allowWhenScreenOn == allowWhenScreenOn && other.user == user && Objects.equals(other.automaticRules, automaticRules) && Objects.equals(other.manualRule, manualRule) Loading @@ -418,7 +404,7 @@ public class ZenModeConfig implements Parcelable { return Objects.hash(allowAlarms, allowMedia, allowSystem, allowCalls, allowRepeatCallers, allowMessages, allowCallsFrom, allowMessagesFrom, allowReminders, allowEvents, allowWhenScreenOff, allowWhenScreenOn, user, automaticRules, manualRule, user, automaticRules, manualRule, suppressedVisualEffects, areChannelsBypassingDnd); } Loading Loading @@ -472,6 +458,7 @@ public class ZenModeConfig implements Parcelable { final ZenModeConfig rt = new ZenModeConfig(); rt.version = safeInt(parser, ZEN_ATT_VERSION, XML_VERSION); rt.user = safeInt(parser, ZEN_ATT_USER, rt.user); boolean readSuppressedEffects = false; while ((type = parser.next()) != XmlPullParser.END_DOCUMENT) { tag = parser.getName(); if (type == XmlPullParser.END_TAG && ZEN_TAG.equals(tag)) { Loading Loading @@ -502,17 +489,33 @@ public class ZenModeConfig implements Parcelable { rt.allowCallsFrom = DEFAULT_SOURCE; rt.allowMessagesFrom = DEFAULT_SOURCE; } // continue to read even though we now have suppressedVisualEffects, in case // we need to revert to users' previous settings rt.allowWhenScreenOff = safeBoolean(parser, ALLOW_ATT_SCREEN_OFF, DEFAULT_ALLOW_SCREEN_OFF); rt.allowWhenScreenOn = safeBoolean(parser, ALLOW_ATT_SCREEN_ON, DEFAULT_ALLOW_SCREEN_ON); rt.allowAlarms = safeBoolean(parser, ALLOW_ATT_ALARMS, DEFAULT_ALLOW_ALARMS); rt.allowMedia = safeBoolean(parser, ALLOW_ATT_MEDIA, DEFAULT_ALLOW_MEDIA); rt.allowSystem = safeBoolean(parser, ALLOW_ATT_SYSTEM, DEFAULT_ALLOW_SYSTEM); } else if (DISALLOW_TAG.equals(tag)) { // migrate old suppressed visual effects fields, if they still exist in the xml Boolean allowWhenScreenOff = unsafeBoolean(parser, ALLOW_ATT_SCREEN_OFF); if (allowWhenScreenOff != null) { readSuppressedEffects = true; if (allowWhenScreenOff) { rt.suppressedVisualEffects |= SUPPRESSED_EFFECT_LIGHTS | SUPPRESSED_EFFECT_FULL_SCREEN_INTENT; } } Boolean allowWhenScreenOn = unsafeBoolean(parser, ALLOW_ATT_SCREEN_ON); if (allowWhenScreenOn != null) { readSuppressedEffects = true; if (allowWhenScreenOn) { rt.suppressedVisualEffects |= SUPPRESSED_EFFECT_PEEK; } } if (readSuppressedEffects) { Slog.d(TAG, "Migrated visual effects to " + rt.suppressedVisualEffects); } } else if (DISALLOW_TAG.equals(tag) && !readSuppressedEffects) { // only read from suppressed visual effects field if we haven't just migrated // the values from allowOn/allowOff, lest we wipe out those settings rt.suppressedVisualEffects = safeInt(parser, DISALLOW_ATT_VISUAL_EFFECTS, DEFAULT_SUPPRESSED_VISUAL_EFFECTS); } else if (MANUAL_TAG.equals(tag)) { Loading Loading @@ -552,8 +555,6 @@ public class ZenModeConfig implements Parcelable { out.attribute(null, ALLOW_ATT_EVENTS, Boolean.toString(allowEvents)); out.attribute(null, ALLOW_ATT_CALLS_FROM, Integer.toString(allowCallsFrom)); out.attribute(null, ALLOW_ATT_MESSAGES_FROM, Integer.toString(allowMessagesFrom)); out.attribute(null, ALLOW_ATT_SCREEN_OFF, Boolean.toString(allowWhenScreenOff)); out.attribute(null, ALLOW_ATT_SCREEN_ON, Boolean.toString(allowWhenScreenOn)); out.attribute(null, ALLOW_ATT_ALARMS, Boolean.toString(allowAlarms)); out.attribute(null, ALLOW_ATT_MEDIA, Boolean.toString(allowMedia)); out.attribute(null, ALLOW_ATT_SYSTEM, Boolean.toString(allowSystem)); Loading Loading @@ -673,6 +674,12 @@ public class ZenModeConfig implements Parcelable { return source >= SOURCE_ANYONE && source <= MAX_SOURCE; } private static Boolean unsafeBoolean(XmlPullParser parser, String att) { final String val = parser.getAttributeValue(null, att); if (TextUtils.isEmpty(val)) return null; return Boolean.parseBoolean(val); } private static boolean safeBoolean(XmlPullParser parser, String att, boolean defValue) { final String val = parser.getAttributeValue(null, att); return safeBoolean(val, defValue); Loading core/res/res/drawable/ic_dnd_block_notifications.xml 0 → 100644 +30 −0 Original line number Diff line number Diff line <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="40dp" android:height="40dp" android:viewportWidth="40.0" android:viewportHeight="40.0"> <path android:pathData="M34,20H2c-1.1,0 -2,-0.9 -2,-2V6c0,-1.1 0.9,-2 2,-2h32c1.1,0 2,0.9 2,2v12C36,19.1 35.1,20 34,20z" android:fillColor="#FBBC04"/> <path android:pathData="M4.63,10L4.63,10c-0.83,0 -1.5,-0.67 -1.5,-1.5v0C3.12,7.67 3.8,7 4.62,7h0c0.82,0 1.5,0.67 1.5,1.5v0C6.12,9.33 5.45,10 4.63,10z" android:fillColor="#FFFFFF"/> <path android:pathData="M8.62,7.5h9.5v2h-9.5z" android:fillColor="#FFFFFF"/> <path android:pathData="M3.12,15h24v2h-24z" android:fillColor="#FFFFFF"/> <path android:pathData="M3.12,12h17.5v2h-17.5z" android:fillColor="#FFFFFF"/> <path android:pathData="M33.59,6.41m-5.78,0a5.78,5.78 0,1 1,11.56 0a5.78,5.78 0,1 1,-11.56 0" android:fillColor="#FFFFFF"/> <path android:pathData="M33.5,0C29.91,0 27,2.91 27,6.5s2.91,6.5 6.5,6.5S40,10.09 40,6.5S37.09,0 33.5,0zM33.5,11.7c-2.87,0 -5.2,-2.33 -5.2,-5.2s2.33,-5.2 5.2,-5.2s5.2,2.33 5.2,5.2S36.37,11.7 33.5,11.7z" android:fillColor="#4285F4"/> <path android:pathData="M30.25,5.85h6.5v1.3h-6.5z" android:fillColor="#4285F4"/> </vector> core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2555,6 +2555,7 @@ <java-symbol type="drawable" name="ic_storage_48dp" /> <java-symbol type="drawable" name="ic_usb_48dp" /> <java-symbol type="drawable" name="ic_zen_24dp" /> <java-symbol type="drawable" name="ic_dnd_block_notifications" /> <!-- Floating toolbar --> <java-symbol type="id" name="floating_toolbar_menu_item_image" /> Loading core/res/res/xml/default_zen_mode_config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ <!-- Default configuration for zen mode. See android.service.notification.ZenModeConfig. --> <zen version="7"> <allow alarms="true" media="true" system="false" calls="false" messages="false" <allow alarms="true" media="true" system="false" calls="false" callsFrom="2" messages="false" reminders="false" events="false" /> <!-- all visual effects that exist as of P --> Loading packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +17 −12 Original line number Diff line number Diff line Loading @@ -2935,7 +2935,7 @@ public class SettingsProvider extends ContentProvider { } private final class UpgradeController { private static final int SETTINGS_VERSION = 164; private static final int SETTINGS_VERSION = 165; private final int mUserId; Loading Loading @@ -3710,17 +3710,7 @@ public class SettingsProvider extends ContentProvider { } if (currentVersion == 162) { // Version 162: Add a gesture for silencing phones final SettingsState settings = getGlobalSettingsLocked(); final Setting currentSetting = settings.getSettingLocked( Global.SHOW_ZEN_UPGRADE_NOTIFICATION); if (!currentSetting.isNull() && TextUtils.equals("0", currentSetting.getValue())) { settings.insertSettingLocked( Global.SHOW_ZEN_UPGRADE_NOTIFICATION, "1", null, true, SettingsState.SYSTEM_PACKAGE_NAME); } // Version 162: REMOVED: Add a gesture for silencing phones currentVersion = 163; } Loading @@ -3742,6 +3732,21 @@ public class SettingsProvider extends ContentProvider { currentVersion = 164; } if (currentVersion == 164) { // Version 164: Add a gesture for silencing phones final SettingsState settings = getGlobalSettingsLocked(); final Setting currentSetting = settings.getSettingLocked( Global.SHOW_ZEN_UPGRADE_NOTIFICATION); if (!currentSetting.isNull() && TextUtils.equals("0", currentSetting.getValue())) { settings.insertSettingLocked( Global.SHOW_ZEN_UPGRADE_NOTIFICATION, "1", null, true, SettingsState.SYSTEM_PACKAGE_NAME); } currentVersion = 165; } // vXXX: Add new settings above this point. if (currentVersion != newVersion) { Loading Loading
core/java/android/service/notification/ZenModeConfig.java +39 −32 Original line number Diff line number Diff line Loading @@ -16,6 +16,10 @@ package android.service.notification; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK; import android.app.ActivityManager; import android.app.AlarmManager; import android.app.NotificationManager; Loading Loading @@ -68,6 +72,7 @@ public class ZenModeConfig implements Parcelable { public static final int SOURCE_STAR = 2; public static final int MAX_SOURCE = SOURCE_STAR; private static final int DEFAULT_SOURCE = SOURCE_CONTACT; private static final int DEFAULT_CALLS_SOURCE = SOURCE_STAR; public static final String EVENTS_DEFAULT_RULE_ID = "EVENTS_DEFAULT_RULE"; public static final String EVERY_NIGHT_DEFAULT_RULE_ID = "EVERY_NIGHT_DEFAULT_RULE"; Loading @@ -93,13 +98,10 @@ public class ZenModeConfig implements Parcelable { private static final boolean DEFAULT_ALLOW_REMINDERS = false; private static final boolean DEFAULT_ALLOW_EVENTS = false; private static final boolean DEFAULT_ALLOW_REPEAT_CALLERS = false; private static final boolean DEFAULT_ALLOW_SCREEN_OFF = false; private static final boolean DEFAULT_ALLOW_SCREEN_ON = false; private static final boolean DEFAULT_CHANNELS_BYPASSING_DND = false; private static final int DEFAULT_SUPPRESSED_VISUAL_EFFECTS = Policy.getAllSuppressedVisualEffects(); private static final int DEFAULT_SUPPRESSED_VISUAL_EFFECTS = 0; public static final int XML_VERSION = 7; public static final int XML_VERSION = 8; public static final String ZEN_TAG = "zen"; private static final String ZEN_ATT_VERSION = "version"; private static final String ZEN_ATT_USER = "user"; Loading Loading @@ -151,12 +153,10 @@ public class ZenModeConfig implements Parcelable { public boolean allowMessages = DEFAULT_ALLOW_MESSAGES; public boolean allowReminders = DEFAULT_ALLOW_REMINDERS; public boolean allowEvents = DEFAULT_ALLOW_EVENTS; public int allowCallsFrom = DEFAULT_SOURCE; public int allowCallsFrom = DEFAULT_CALLS_SOURCE; public int allowMessagesFrom = DEFAULT_SOURCE; public int user = UserHandle.USER_SYSTEM; public int suppressedVisualEffects = DEFAULT_SUPPRESSED_VISUAL_EFFECTS; public boolean allowWhenScreenOff = DEFAULT_ALLOW_SCREEN_OFF; public boolean allowWhenScreenOn = DEFAULT_ALLOW_SCREEN_ON; public boolean areChannelsBypassingDnd = DEFAULT_CHANNELS_BYPASSING_DND; public int version; Loading Loading @@ -185,8 +185,6 @@ public class ZenModeConfig implements Parcelable { automaticRules.put(ids[i], rules[i]); } } allowWhenScreenOff = source.readInt() == 1; allowWhenScreenOn = source.readInt() == 1; allowAlarms = source.readInt() == 1; allowMedia = source.readInt() == 1; allowSystem = source.readInt() == 1; Loading Loading @@ -219,8 +217,6 @@ public class ZenModeConfig implements Parcelable { } else { dest.writeInt(0); } dest.writeInt(allowWhenScreenOff ? 1 : 0); dest.writeInt(allowWhenScreenOn ? 1 : 0); dest.writeInt(allowAlarms ? 1 : 0); dest.writeInt(allowMedia ? 1 : 0); dest.writeInt(allowSystem ? 1 : 0); Loading @@ -242,8 +238,6 @@ public class ZenModeConfig implements Parcelable { .append(",allowMessages=").append(allowMessages) .append(",allowCallsFrom=").append(sourceToString(allowCallsFrom)) .append(",allowMessagesFrom=").append(sourceToString(allowMessagesFrom)) .append(",allowWhenScreenOff=").append(allowWhenScreenOff) .append(",allowWhenScreenOn=").append(allowWhenScreenOn) .append(",suppressedVisualEffects=").append(suppressedVisualEffects) .append(",areChannelsBypassingDnd=").append(areChannelsBypassingDnd) .append(",automaticRules=").append(automaticRules) Loading Loading @@ -289,12 +283,6 @@ public class ZenModeConfig implements Parcelable { if (allowMessagesFrom != to.allowMessagesFrom) { d.addLine("allowMessagesFrom", allowMessagesFrom, to.allowMessagesFrom); } if (allowWhenScreenOff != to.allowWhenScreenOff) { d.addLine("allowWhenScreenOff", allowWhenScreenOff, to.allowWhenScreenOff); } if (allowWhenScreenOn != to.allowWhenScreenOn) { d.addLine("allowWhenScreenOn", allowWhenScreenOn, to.allowWhenScreenOn); } if (suppressedVisualEffects != to.suppressedVisualEffects) { d.addLine("suppressedVisualEffects", suppressedVisualEffects, to.suppressedVisualEffects); Loading Loading @@ -404,8 +392,6 @@ public class ZenModeConfig implements Parcelable { && other.allowMessagesFrom == allowMessagesFrom && other.allowReminders == allowReminders && other.allowEvents == allowEvents && other.allowWhenScreenOff == allowWhenScreenOff && other.allowWhenScreenOn == allowWhenScreenOn && other.user == user && Objects.equals(other.automaticRules, automaticRules) && Objects.equals(other.manualRule, manualRule) Loading @@ -418,7 +404,7 @@ public class ZenModeConfig implements Parcelable { return Objects.hash(allowAlarms, allowMedia, allowSystem, allowCalls, allowRepeatCallers, allowMessages, allowCallsFrom, allowMessagesFrom, allowReminders, allowEvents, allowWhenScreenOff, allowWhenScreenOn, user, automaticRules, manualRule, user, automaticRules, manualRule, suppressedVisualEffects, areChannelsBypassingDnd); } Loading Loading @@ -472,6 +458,7 @@ public class ZenModeConfig implements Parcelable { final ZenModeConfig rt = new ZenModeConfig(); rt.version = safeInt(parser, ZEN_ATT_VERSION, XML_VERSION); rt.user = safeInt(parser, ZEN_ATT_USER, rt.user); boolean readSuppressedEffects = false; while ((type = parser.next()) != XmlPullParser.END_DOCUMENT) { tag = parser.getName(); if (type == XmlPullParser.END_TAG && ZEN_TAG.equals(tag)) { Loading Loading @@ -502,17 +489,33 @@ public class ZenModeConfig implements Parcelable { rt.allowCallsFrom = DEFAULT_SOURCE; rt.allowMessagesFrom = DEFAULT_SOURCE; } // continue to read even though we now have suppressedVisualEffects, in case // we need to revert to users' previous settings rt.allowWhenScreenOff = safeBoolean(parser, ALLOW_ATT_SCREEN_OFF, DEFAULT_ALLOW_SCREEN_OFF); rt.allowWhenScreenOn = safeBoolean(parser, ALLOW_ATT_SCREEN_ON, DEFAULT_ALLOW_SCREEN_ON); rt.allowAlarms = safeBoolean(parser, ALLOW_ATT_ALARMS, DEFAULT_ALLOW_ALARMS); rt.allowMedia = safeBoolean(parser, ALLOW_ATT_MEDIA, DEFAULT_ALLOW_MEDIA); rt.allowSystem = safeBoolean(parser, ALLOW_ATT_SYSTEM, DEFAULT_ALLOW_SYSTEM); } else if (DISALLOW_TAG.equals(tag)) { // migrate old suppressed visual effects fields, if they still exist in the xml Boolean allowWhenScreenOff = unsafeBoolean(parser, ALLOW_ATT_SCREEN_OFF); if (allowWhenScreenOff != null) { readSuppressedEffects = true; if (allowWhenScreenOff) { rt.suppressedVisualEffects |= SUPPRESSED_EFFECT_LIGHTS | SUPPRESSED_EFFECT_FULL_SCREEN_INTENT; } } Boolean allowWhenScreenOn = unsafeBoolean(parser, ALLOW_ATT_SCREEN_ON); if (allowWhenScreenOn != null) { readSuppressedEffects = true; if (allowWhenScreenOn) { rt.suppressedVisualEffects |= SUPPRESSED_EFFECT_PEEK; } } if (readSuppressedEffects) { Slog.d(TAG, "Migrated visual effects to " + rt.suppressedVisualEffects); } } else if (DISALLOW_TAG.equals(tag) && !readSuppressedEffects) { // only read from suppressed visual effects field if we haven't just migrated // the values from allowOn/allowOff, lest we wipe out those settings rt.suppressedVisualEffects = safeInt(parser, DISALLOW_ATT_VISUAL_EFFECTS, DEFAULT_SUPPRESSED_VISUAL_EFFECTS); } else if (MANUAL_TAG.equals(tag)) { Loading Loading @@ -552,8 +555,6 @@ public class ZenModeConfig implements Parcelable { out.attribute(null, ALLOW_ATT_EVENTS, Boolean.toString(allowEvents)); out.attribute(null, ALLOW_ATT_CALLS_FROM, Integer.toString(allowCallsFrom)); out.attribute(null, ALLOW_ATT_MESSAGES_FROM, Integer.toString(allowMessagesFrom)); out.attribute(null, ALLOW_ATT_SCREEN_OFF, Boolean.toString(allowWhenScreenOff)); out.attribute(null, ALLOW_ATT_SCREEN_ON, Boolean.toString(allowWhenScreenOn)); out.attribute(null, ALLOW_ATT_ALARMS, Boolean.toString(allowAlarms)); out.attribute(null, ALLOW_ATT_MEDIA, Boolean.toString(allowMedia)); out.attribute(null, ALLOW_ATT_SYSTEM, Boolean.toString(allowSystem)); Loading Loading @@ -673,6 +674,12 @@ public class ZenModeConfig implements Parcelable { return source >= SOURCE_ANYONE && source <= MAX_SOURCE; } private static Boolean unsafeBoolean(XmlPullParser parser, String att) { final String val = parser.getAttributeValue(null, att); if (TextUtils.isEmpty(val)) return null; return Boolean.parseBoolean(val); } private static boolean safeBoolean(XmlPullParser parser, String att, boolean defValue) { final String val = parser.getAttributeValue(null, att); return safeBoolean(val, defValue); Loading
core/res/res/drawable/ic_dnd_block_notifications.xml 0 → 100644 +30 −0 Original line number Diff line number Diff line <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="40dp" android:height="40dp" android:viewportWidth="40.0" android:viewportHeight="40.0"> <path android:pathData="M34,20H2c-1.1,0 -2,-0.9 -2,-2V6c0,-1.1 0.9,-2 2,-2h32c1.1,0 2,0.9 2,2v12C36,19.1 35.1,20 34,20z" android:fillColor="#FBBC04"/> <path android:pathData="M4.63,10L4.63,10c-0.83,0 -1.5,-0.67 -1.5,-1.5v0C3.12,7.67 3.8,7 4.62,7h0c0.82,0 1.5,0.67 1.5,1.5v0C6.12,9.33 5.45,10 4.63,10z" android:fillColor="#FFFFFF"/> <path android:pathData="M8.62,7.5h9.5v2h-9.5z" android:fillColor="#FFFFFF"/> <path android:pathData="M3.12,15h24v2h-24z" android:fillColor="#FFFFFF"/> <path android:pathData="M3.12,12h17.5v2h-17.5z" android:fillColor="#FFFFFF"/> <path android:pathData="M33.59,6.41m-5.78,0a5.78,5.78 0,1 1,11.56 0a5.78,5.78 0,1 1,-11.56 0" android:fillColor="#FFFFFF"/> <path android:pathData="M33.5,0C29.91,0 27,2.91 27,6.5s2.91,6.5 6.5,6.5S40,10.09 40,6.5S37.09,0 33.5,0zM33.5,11.7c-2.87,0 -5.2,-2.33 -5.2,-5.2s2.33,-5.2 5.2,-5.2s5.2,2.33 5.2,5.2S36.37,11.7 33.5,11.7z" android:fillColor="#4285F4"/> <path android:pathData="M30.25,5.85h6.5v1.3h-6.5z" android:fillColor="#4285F4"/> </vector>
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2555,6 +2555,7 @@ <java-symbol type="drawable" name="ic_storage_48dp" /> <java-symbol type="drawable" name="ic_usb_48dp" /> <java-symbol type="drawable" name="ic_zen_24dp" /> <java-symbol type="drawable" name="ic_dnd_block_notifications" /> <!-- Floating toolbar --> <java-symbol type="id" name="floating_toolbar_menu_item_image" /> Loading
core/res/res/xml/default_zen_mode_config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ <!-- Default configuration for zen mode. See android.service.notification.ZenModeConfig. --> <zen version="7"> <allow alarms="true" media="true" system="false" calls="false" messages="false" <allow alarms="true" media="true" system="false" calls="false" callsFrom="2" messages="false" reminders="false" events="false" /> <!-- all visual effects that exist as of P --> Loading
packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +17 −12 Original line number Diff line number Diff line Loading @@ -2935,7 +2935,7 @@ public class SettingsProvider extends ContentProvider { } private final class UpgradeController { private static final int SETTINGS_VERSION = 164; private static final int SETTINGS_VERSION = 165; private final int mUserId; Loading Loading @@ -3710,17 +3710,7 @@ public class SettingsProvider extends ContentProvider { } if (currentVersion == 162) { // Version 162: Add a gesture for silencing phones final SettingsState settings = getGlobalSettingsLocked(); final Setting currentSetting = settings.getSettingLocked( Global.SHOW_ZEN_UPGRADE_NOTIFICATION); if (!currentSetting.isNull() && TextUtils.equals("0", currentSetting.getValue())) { settings.insertSettingLocked( Global.SHOW_ZEN_UPGRADE_NOTIFICATION, "1", null, true, SettingsState.SYSTEM_PACKAGE_NAME); } // Version 162: REMOVED: Add a gesture for silencing phones currentVersion = 163; } Loading @@ -3742,6 +3732,21 @@ public class SettingsProvider extends ContentProvider { currentVersion = 164; } if (currentVersion == 164) { // Version 164: Add a gesture for silencing phones final SettingsState settings = getGlobalSettingsLocked(); final Setting currentSetting = settings.getSettingLocked( Global.SHOW_ZEN_UPGRADE_NOTIFICATION); if (!currentSetting.isNull() && TextUtils.equals("0", currentSetting.getValue())) { settings.insertSettingLocked( Global.SHOW_ZEN_UPGRADE_NOTIFICATION, "1", null, true, SettingsState.SYSTEM_PACKAGE_NAME); } currentVersion = 165; } // vXXX: Add new settings above this point. if (currentVersion != newVersion) { Loading