Loading core/java/android/service/notification/ZenModeConfig.java +10 −11 Original line number Diff line number Diff line Loading @@ -410,10 +410,10 @@ public class ZenModeConfig implements Parcelable { rt.allowMessagesFrom = DEFAULT_SOURCE; } } else if (MANUAL_TAG.equals(tag)) { rt.manualRule = readRuleXml(parser, false /*conditionRequired*/); rt.manualRule = readRuleXml(parser); } else if (AUTOMATIC_TAG.equals(tag)) { final String id = parser.getAttributeValue(null, RULE_ATT_ID); final ZenRule automaticRule = readRuleXml(parser, true /*conditionRequired*/); final ZenRule automaticRule = readRuleXml(parser); if (id != null && automaticRule != null) { rt.automaticRules.put(id, automaticRule); } Loading Loading @@ -455,7 +455,7 @@ public class ZenModeConfig implements Parcelable { out.endTag(null, ZEN_TAG); } public static ZenRule readRuleXml(XmlPullParser parser, boolean conditionRequired) { public static ZenRule readRuleXml(XmlPullParser parser) { final ZenRule rt = new ZenRule(); rt.enabled = safeBoolean(parser, RULE_ATT_ENABLED, true); rt.snoozing = safeBoolean(parser, RULE_ATT_SNOOZING, false); Loading Loading @@ -801,7 +801,7 @@ public class ZenModeConfig implements Parcelable { .authority(SYSTEM_AUTHORITY) .appendPath(EVENT_PATH) .appendQueryParameter("userId", Long.toString(event.userId)) .appendQueryParameter("calendar", Long.toString(event.calendar)) .appendQueryParameter("calendar", event.calendar != null ? event.calendar : "") .appendQueryParameter("reply", Integer.toString(event.reply)) .build(); } Loading @@ -819,21 +819,21 @@ public class ZenModeConfig implements Parcelable { if (!isEvent) return null; final EventInfo rt = new EventInfo(); rt.userId = tryParseInt(conditionId.getQueryParameter("userId"), UserHandle.USER_NULL); rt.calendar = tryParseLong(conditionId.getQueryParameter("calendar"), EventInfo.ANY_CALENDAR); rt.calendar = conditionId.getQueryParameter("calendar"); if (TextUtils.isEmpty(rt.calendar) || tryParseLong(rt.calendar, -1L) != -1L) { rt.calendar = null; } rt.reply = tryParseInt(conditionId.getQueryParameter("reply"), 0); return rt; } public static class EventInfo { public static final long ANY_CALENDAR = 0; public static final int REPLY_ANY_EXCEPT_NO = 0; public static final int REPLY_YES_OR_MAYBE = 1; public static final int REPLY_YES = 2; public int userId = UserHandle.USER_NULL; // USER_NULL = unspecified - use current user public long calendar = ANY_CALENDAR; // CalendarContract.Calendars._ID, or ANY_CALENDAR public String calendar; // CalendarContract.Calendars.OWNER_ACCOUNT, or null for any public int reply; @Override Loading @@ -846,7 +846,7 @@ public class ZenModeConfig implements Parcelable { if (!(o instanceof EventInfo)) return false; final EventInfo other = (EventInfo) o; return userId == other.userId && calendar == other.calendar && Objects.equals(calendar, other.calendar) && reply == other.reply; } Loading @@ -860,7 +860,6 @@ public class ZenModeConfig implements Parcelable { public static int resolveUserId(int userId) { return userId == UserHandle.USER_NULL ? ActivityManager.getCurrentUser() : userId; } } Loading services/core/java/com/android/server/notification/CalendarTracker.java +1 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.server.notification; import static android.service.notification.ZenModeConfig.EventInfo.ANY_CALENDAR; import android.content.ContentResolver; import android.content.ContentUris; import android.content.Context; Loading Loading @@ -183,7 +181,7 @@ public class CalendarTracker { calendarPrimary)); final boolean meetsTime = time >= begin && time < end; final boolean meetsCalendar = calendarVisible && calendarPrimary && (filter.calendar == ANY_CALENDAR || filter.calendar == calendarId); && (filter.calendar == null || Objects.equals(filter.calendar, owner)); final boolean meetsAvailability = availability != Instances.AVAILABILITY_FREE; if (meetsCalendar && meetsAvailability) { if (DEBUG) Log.d(TAG, " MEETS CALENDAR & AVAILABILITY"); Loading services/core/java/com/android/server/notification/EventConditionProvider.java +1 −1 Original line number Diff line number Diff line Loading @@ -211,7 +211,7 @@ public class EventConditionProvider extends SystemConditionProviderService { continue; } CheckEventResult result = null; if (event.calendar == EventInfo.ANY_CALENDAR) { if (event.calendar == null) { // any calendar // event could exist on any tracker for (int i = 0; i < mTrackers.size(); i++) { final CalendarTracker tracker = mTrackers.valueAt(i); Loading services/core/java/com/android/server/notification/ZenModeHelper.java +8 −1 Original line number Diff line number Diff line Loading @@ -265,6 +265,13 @@ public class ZenModeHelper { return; } config.manualRule = null; // don't restore the manual rule if (config.automaticRules != null) { for (ZenModeConfig.ZenRule automaticRule : config.automaticRules.values()) { // don't restore transient state from restored automatic rules automaticRule.snoozing = false; automaticRule.condition = null; } } } if (DEBUG) Log.d(TAG, "readXml"); setConfig(config, "readXml"); Loading Loading @@ -498,7 +505,7 @@ public class ZenModeHelper { if (config == null) return; final EventInfo events = new EventInfo(); events.calendar = EventInfo.ANY_CALENDAR; events.calendar = null; // any calendar events.reply = EventInfo.REPLY_YES_OR_MAYBE; final ZenRule rule = new ZenRule(); rule.enabled = false; Loading Loading
core/java/android/service/notification/ZenModeConfig.java +10 −11 Original line number Diff line number Diff line Loading @@ -410,10 +410,10 @@ public class ZenModeConfig implements Parcelable { rt.allowMessagesFrom = DEFAULT_SOURCE; } } else if (MANUAL_TAG.equals(tag)) { rt.manualRule = readRuleXml(parser, false /*conditionRequired*/); rt.manualRule = readRuleXml(parser); } else if (AUTOMATIC_TAG.equals(tag)) { final String id = parser.getAttributeValue(null, RULE_ATT_ID); final ZenRule automaticRule = readRuleXml(parser, true /*conditionRequired*/); final ZenRule automaticRule = readRuleXml(parser); if (id != null && automaticRule != null) { rt.automaticRules.put(id, automaticRule); } Loading Loading @@ -455,7 +455,7 @@ public class ZenModeConfig implements Parcelable { out.endTag(null, ZEN_TAG); } public static ZenRule readRuleXml(XmlPullParser parser, boolean conditionRequired) { public static ZenRule readRuleXml(XmlPullParser parser) { final ZenRule rt = new ZenRule(); rt.enabled = safeBoolean(parser, RULE_ATT_ENABLED, true); rt.snoozing = safeBoolean(parser, RULE_ATT_SNOOZING, false); Loading Loading @@ -801,7 +801,7 @@ public class ZenModeConfig implements Parcelable { .authority(SYSTEM_AUTHORITY) .appendPath(EVENT_PATH) .appendQueryParameter("userId", Long.toString(event.userId)) .appendQueryParameter("calendar", Long.toString(event.calendar)) .appendQueryParameter("calendar", event.calendar != null ? event.calendar : "") .appendQueryParameter("reply", Integer.toString(event.reply)) .build(); } Loading @@ -819,21 +819,21 @@ public class ZenModeConfig implements Parcelable { if (!isEvent) return null; final EventInfo rt = new EventInfo(); rt.userId = tryParseInt(conditionId.getQueryParameter("userId"), UserHandle.USER_NULL); rt.calendar = tryParseLong(conditionId.getQueryParameter("calendar"), EventInfo.ANY_CALENDAR); rt.calendar = conditionId.getQueryParameter("calendar"); if (TextUtils.isEmpty(rt.calendar) || tryParseLong(rt.calendar, -1L) != -1L) { rt.calendar = null; } rt.reply = tryParseInt(conditionId.getQueryParameter("reply"), 0); return rt; } public static class EventInfo { public static final long ANY_CALENDAR = 0; public static final int REPLY_ANY_EXCEPT_NO = 0; public static final int REPLY_YES_OR_MAYBE = 1; public static final int REPLY_YES = 2; public int userId = UserHandle.USER_NULL; // USER_NULL = unspecified - use current user public long calendar = ANY_CALENDAR; // CalendarContract.Calendars._ID, or ANY_CALENDAR public String calendar; // CalendarContract.Calendars.OWNER_ACCOUNT, or null for any public int reply; @Override Loading @@ -846,7 +846,7 @@ public class ZenModeConfig implements Parcelable { if (!(o instanceof EventInfo)) return false; final EventInfo other = (EventInfo) o; return userId == other.userId && calendar == other.calendar && Objects.equals(calendar, other.calendar) && reply == other.reply; } Loading @@ -860,7 +860,6 @@ public class ZenModeConfig implements Parcelable { public static int resolveUserId(int userId) { return userId == UserHandle.USER_NULL ? ActivityManager.getCurrentUser() : userId; } } Loading
services/core/java/com/android/server/notification/CalendarTracker.java +1 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.server.notification; import static android.service.notification.ZenModeConfig.EventInfo.ANY_CALENDAR; import android.content.ContentResolver; import android.content.ContentUris; import android.content.Context; Loading Loading @@ -183,7 +181,7 @@ public class CalendarTracker { calendarPrimary)); final boolean meetsTime = time >= begin && time < end; final boolean meetsCalendar = calendarVisible && calendarPrimary && (filter.calendar == ANY_CALENDAR || filter.calendar == calendarId); && (filter.calendar == null || Objects.equals(filter.calendar, owner)); final boolean meetsAvailability = availability != Instances.AVAILABILITY_FREE; if (meetsCalendar && meetsAvailability) { if (DEBUG) Log.d(TAG, " MEETS CALENDAR & AVAILABILITY"); Loading
services/core/java/com/android/server/notification/EventConditionProvider.java +1 −1 Original line number Diff line number Diff line Loading @@ -211,7 +211,7 @@ public class EventConditionProvider extends SystemConditionProviderService { continue; } CheckEventResult result = null; if (event.calendar == EventInfo.ANY_CALENDAR) { if (event.calendar == null) { // any calendar // event could exist on any tracker for (int i = 0; i < mTrackers.size(); i++) { final CalendarTracker tracker = mTrackers.valueAt(i); Loading
services/core/java/com/android/server/notification/ZenModeHelper.java +8 −1 Original line number Diff line number Diff line Loading @@ -265,6 +265,13 @@ public class ZenModeHelper { return; } config.manualRule = null; // don't restore the manual rule if (config.automaticRules != null) { for (ZenModeConfig.ZenRule automaticRule : config.automaticRules.values()) { // don't restore transient state from restored automatic rules automaticRule.snoozing = false; automaticRule.condition = null; } } } if (DEBUG) Log.d(TAG, "readXml"); setConfig(config, "readXml"); Loading Loading @@ -498,7 +505,7 @@ public class ZenModeHelper { if (config == null) return; final EventInfo events = new EventInfo(); events.calendar = EventInfo.ANY_CALENDAR; events.calendar = null; // any calendar events.reply = EventInfo.REPLY_YES_OR_MAYBE; final ZenRule rule = new ZenRule(); rule.enabled = false; Loading