Loading core/java/android/provider/Settings.java +9 −0 Original line number Diff line number Diff line Loading @@ -838,6 +838,15 @@ public final class Settings { @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_ZEN_MODE_SETTINGS = "android.settings.ZEN_MODE_SETTINGS"; /** * Activity Action: Show Zen Mode priority configuration settings. * * @hide */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_ZEN_MODE_PRIORITY_SETTINGS = "android.settings.ZEN_MODE_PRIORITY_SETTINGS"; /** * Activity Action: Show the regulatory information screen for the device. * <p> Loading core/java/android/service/notification/ZenModeConfig.java +13 −3 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ public class ZenModeConfig implements Parcelable { private static final int MINUTES_MS = 60 * SECONDS_MS; private static final int ZERO_VALUE_MS = 10 * SECONDS_MS; private static final boolean DEFAULT_ALLOW_REMINDERS = true; private static final boolean DEFAULT_ALLOW_EVENTS = true; private static final int XML_VERSION = 1; Loading @@ -75,6 +76,7 @@ public class ZenModeConfig implements Parcelable { private static final String ALLOW_ATT_CALLS = "calls"; private static final String ALLOW_ATT_MESSAGES = "messages"; private static final String ALLOW_ATT_FROM = "from"; private static final String ALLOW_ATT_REMINDERS = "reminders"; private static final String ALLOW_ATT_EVENTS = "events"; private static final String SLEEP_TAG = "sleep"; private static final String SLEEP_ATT_MODE = "mode"; Loading @@ -100,6 +102,7 @@ public class ZenModeConfig implements Parcelable { public boolean allowCalls; public boolean allowMessages; public boolean allowReminders = DEFAULT_ALLOW_REMINDERS; public boolean allowEvents = DEFAULT_ALLOW_EVENTS; public int allowFrom = SOURCE_ANYONE; Loading @@ -119,6 +122,7 @@ public class ZenModeConfig implements Parcelable { public ZenModeConfig(Parcel source) { allowCalls = source.readInt() == 1; allowMessages = source.readInt() == 1; allowReminders = source.readInt() == 1; allowEvents = source.readInt() == 1; if (source.readInt() == 1) { sleepMode = source.readString(); Loading Loading @@ -147,6 +151,7 @@ public class ZenModeConfig implements Parcelable { public void writeToParcel(Parcel dest, int flags) { dest.writeInt(allowCalls ? 1 : 0); dest.writeInt(allowMessages ? 1 : 0); dest.writeInt(allowReminders ? 1 : 0); dest.writeInt(allowEvents ? 1 : 0); if (sleepMode != null) { dest.writeInt(1); Loading Loading @@ -182,6 +187,7 @@ public class ZenModeConfig implements Parcelable { .append("allowCalls=").append(allowCalls) .append(",allowMessages=").append(allowMessages) .append(",allowFrom=").append(sourceToString(allowFrom)) .append(",allowReminders=").append(allowReminders) .append(",allowEvents=").append(allowEvents) .append(",sleepMode=").append(sleepMode) .append(",sleepStart=").append(sleepStartHour).append('.').append(sleepStartMinute) Loading Loading @@ -217,6 +223,7 @@ public class ZenModeConfig implements Parcelable { return other.allowCalls == allowCalls && other.allowMessages == allowMessages && other.allowFrom == allowFrom && other.allowReminders == allowReminders && other.allowEvents == allowEvents && Objects.equals(other.sleepMode, sleepMode) && other.sleepNone == sleepNone Loading @@ -232,9 +239,9 @@ public class ZenModeConfig implements Parcelable { @Override public int hashCode() { return Objects.hash(allowCalls, allowMessages, allowFrom, allowEvents, sleepMode, sleepNone, sleepStartHour, sleepStartMinute, sleepEndHour, sleepEndMinute, Arrays.hashCode(conditionComponents), Arrays.hashCode(conditionIds), return Objects.hash(allowCalls, allowMessages, allowFrom, allowReminders, allowEvents, sleepMode, sleepNone, sleepStartHour, sleepStartMinute, sleepEndHour, sleepEndMinute, Arrays.hashCode(conditionComponents), Arrays.hashCode(conditionIds), exitCondition, exitConditionComponent); } Loading Loading @@ -300,6 +307,8 @@ public class ZenModeConfig implements Parcelable { if (ALLOW_TAG.equals(tag)) { rt.allowCalls = safeBoolean(parser, ALLOW_ATT_CALLS, false); rt.allowMessages = safeBoolean(parser, ALLOW_ATT_MESSAGES, false); rt.allowReminders = safeBoolean(parser, ALLOW_ATT_REMINDERS, DEFAULT_ALLOW_REMINDERS); rt.allowEvents = safeBoolean(parser, ALLOW_ATT_EVENTS, DEFAULT_ALLOW_EVENTS); rt.allowFrom = safeInt(parser, ALLOW_ATT_FROM, SOURCE_ANYONE); if (rt.allowFrom < SOURCE_ANYONE || rt.allowFrom > MAX_SOURCE) { Loading Loading @@ -344,6 +353,7 @@ public class ZenModeConfig implements Parcelable { out.startTag(null, ALLOW_TAG); out.attribute(null, ALLOW_ATT_CALLS, Boolean.toString(allowCalls)); out.attribute(null, ALLOW_ATT_MESSAGES, Boolean.toString(allowMessages)); out.attribute(null, ALLOW_ATT_REMINDERS, Boolean.toString(allowReminders)); out.attribute(null, ALLOW_ATT_EVENTS, Boolean.toString(allowEvents)); out.attribute(null, ALLOW_ATT_FROM, Integer.toString(allowFrom)); out.endTag(null, ALLOW_TAG); Loading core/java/com/android/internal/logging/MetricsLogger.java +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ public class MetricsLogger implements MetricsConstants { public static final int ACTION_WIFI_ON = 141; public static final int MANAGE_PERMISSIONS = 142; public static final int NOTIFICATION_ZEN_MODE_PRIORITY = 143; public static final int MANAGE_DOMAIN_URLS = 143; Loading services/core/java/com/android/server/notification/ZenModeHelper.java +11 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,13 @@ public class ZenModeHelper implements AudioManagerInternal.RingerModeDelegate { } return false; } if (isReminder(record)) { if (!mConfig.allowReminders) { ZenLog.traceIntercepted(record, "!allowReminders"); return true; } return false; } ZenLog.traceIntercepted(record, "!priority"); return true; default: Loading Loading @@ -446,6 +453,10 @@ public class ZenModeHelper implements AudioManagerInternal.RingerModeDelegate { return record.isCategory(Notification.CATEGORY_EVENT); } private static boolean isReminder(NotificationRecord record) { return record.isCategory(Notification.CATEGORY_REMINDER); } public boolean isCall(NotificationRecord record) { return record != null && (isDefaultPhoneApp(record.sbn.getPackageName()) || record.isCategory(Notification.CATEGORY_CALL)); Loading Loading
core/java/android/provider/Settings.java +9 −0 Original line number Diff line number Diff line Loading @@ -838,6 +838,15 @@ public final class Settings { @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_ZEN_MODE_SETTINGS = "android.settings.ZEN_MODE_SETTINGS"; /** * Activity Action: Show Zen Mode priority configuration settings. * * @hide */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_ZEN_MODE_PRIORITY_SETTINGS = "android.settings.ZEN_MODE_PRIORITY_SETTINGS"; /** * Activity Action: Show the regulatory information screen for the device. * <p> Loading
core/java/android/service/notification/ZenModeConfig.java +13 −3 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ public class ZenModeConfig implements Parcelable { private static final int MINUTES_MS = 60 * SECONDS_MS; private static final int ZERO_VALUE_MS = 10 * SECONDS_MS; private static final boolean DEFAULT_ALLOW_REMINDERS = true; private static final boolean DEFAULT_ALLOW_EVENTS = true; private static final int XML_VERSION = 1; Loading @@ -75,6 +76,7 @@ public class ZenModeConfig implements Parcelable { private static final String ALLOW_ATT_CALLS = "calls"; private static final String ALLOW_ATT_MESSAGES = "messages"; private static final String ALLOW_ATT_FROM = "from"; private static final String ALLOW_ATT_REMINDERS = "reminders"; private static final String ALLOW_ATT_EVENTS = "events"; private static final String SLEEP_TAG = "sleep"; private static final String SLEEP_ATT_MODE = "mode"; Loading @@ -100,6 +102,7 @@ public class ZenModeConfig implements Parcelable { public boolean allowCalls; public boolean allowMessages; public boolean allowReminders = DEFAULT_ALLOW_REMINDERS; public boolean allowEvents = DEFAULT_ALLOW_EVENTS; public int allowFrom = SOURCE_ANYONE; Loading @@ -119,6 +122,7 @@ public class ZenModeConfig implements Parcelable { public ZenModeConfig(Parcel source) { allowCalls = source.readInt() == 1; allowMessages = source.readInt() == 1; allowReminders = source.readInt() == 1; allowEvents = source.readInt() == 1; if (source.readInt() == 1) { sleepMode = source.readString(); Loading Loading @@ -147,6 +151,7 @@ public class ZenModeConfig implements Parcelable { public void writeToParcel(Parcel dest, int flags) { dest.writeInt(allowCalls ? 1 : 0); dest.writeInt(allowMessages ? 1 : 0); dest.writeInt(allowReminders ? 1 : 0); dest.writeInt(allowEvents ? 1 : 0); if (sleepMode != null) { dest.writeInt(1); Loading Loading @@ -182,6 +187,7 @@ public class ZenModeConfig implements Parcelable { .append("allowCalls=").append(allowCalls) .append(",allowMessages=").append(allowMessages) .append(",allowFrom=").append(sourceToString(allowFrom)) .append(",allowReminders=").append(allowReminders) .append(",allowEvents=").append(allowEvents) .append(",sleepMode=").append(sleepMode) .append(",sleepStart=").append(sleepStartHour).append('.').append(sleepStartMinute) Loading Loading @@ -217,6 +223,7 @@ public class ZenModeConfig implements Parcelable { return other.allowCalls == allowCalls && other.allowMessages == allowMessages && other.allowFrom == allowFrom && other.allowReminders == allowReminders && other.allowEvents == allowEvents && Objects.equals(other.sleepMode, sleepMode) && other.sleepNone == sleepNone Loading @@ -232,9 +239,9 @@ public class ZenModeConfig implements Parcelable { @Override public int hashCode() { return Objects.hash(allowCalls, allowMessages, allowFrom, allowEvents, sleepMode, sleepNone, sleepStartHour, sleepStartMinute, sleepEndHour, sleepEndMinute, Arrays.hashCode(conditionComponents), Arrays.hashCode(conditionIds), return Objects.hash(allowCalls, allowMessages, allowFrom, allowReminders, allowEvents, sleepMode, sleepNone, sleepStartHour, sleepStartMinute, sleepEndHour, sleepEndMinute, Arrays.hashCode(conditionComponents), Arrays.hashCode(conditionIds), exitCondition, exitConditionComponent); } Loading Loading @@ -300,6 +307,8 @@ public class ZenModeConfig implements Parcelable { if (ALLOW_TAG.equals(tag)) { rt.allowCalls = safeBoolean(parser, ALLOW_ATT_CALLS, false); rt.allowMessages = safeBoolean(parser, ALLOW_ATT_MESSAGES, false); rt.allowReminders = safeBoolean(parser, ALLOW_ATT_REMINDERS, DEFAULT_ALLOW_REMINDERS); rt.allowEvents = safeBoolean(parser, ALLOW_ATT_EVENTS, DEFAULT_ALLOW_EVENTS); rt.allowFrom = safeInt(parser, ALLOW_ATT_FROM, SOURCE_ANYONE); if (rt.allowFrom < SOURCE_ANYONE || rt.allowFrom > MAX_SOURCE) { Loading Loading @@ -344,6 +353,7 @@ public class ZenModeConfig implements Parcelable { out.startTag(null, ALLOW_TAG); out.attribute(null, ALLOW_ATT_CALLS, Boolean.toString(allowCalls)); out.attribute(null, ALLOW_ATT_MESSAGES, Boolean.toString(allowMessages)); out.attribute(null, ALLOW_ATT_REMINDERS, Boolean.toString(allowReminders)); out.attribute(null, ALLOW_ATT_EVENTS, Boolean.toString(allowEvents)); out.attribute(null, ALLOW_ATT_FROM, Integer.toString(allowFrom)); out.endTag(null, ALLOW_TAG); Loading
core/java/com/android/internal/logging/MetricsLogger.java +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ public class MetricsLogger implements MetricsConstants { public static final int ACTION_WIFI_ON = 141; public static final int MANAGE_PERMISSIONS = 142; public static final int NOTIFICATION_ZEN_MODE_PRIORITY = 143; public static final int MANAGE_DOMAIN_URLS = 143; Loading
services/core/java/com/android/server/notification/ZenModeHelper.java +11 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,13 @@ public class ZenModeHelper implements AudioManagerInternal.RingerModeDelegate { } return false; } if (isReminder(record)) { if (!mConfig.allowReminders) { ZenLog.traceIntercepted(record, "!allowReminders"); return true; } return false; } ZenLog.traceIntercepted(record, "!priority"); return true; default: Loading Loading @@ -446,6 +453,10 @@ public class ZenModeHelper implements AudioManagerInternal.RingerModeDelegate { return record.isCategory(Notification.CATEGORY_EVENT); } private static boolean isReminder(NotificationRecord record) { return record.isCategory(Notification.CATEGORY_REMINDER); } public boolean isCall(NotificationRecord record) { return record != null && (isDefaultPhoneApp(record.sbn.getPackageName()) || record.isCategory(Notification.CATEGORY_CALL)); Loading