diff options
| author | John Spurlock <jspurlock@google.com> | 2015-05-05 14:42:01 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-05 14:42:03 +0000 |
| commit | 0bc8afff7eb3b5af72b7e9a4ce3954488bfbecd0 (patch) | |
| tree | 81281bccf0bd8f098fd9b63a385b27f94bd15401 | |
| parent | d4474cb9454c7a8b907c0be07236ffed4ecf3fd8 (diff) | |
| parent | d39af2d3f8c5d87e102aeb79d4148218ff616245 (diff) | |
| download | frameworks_base-0bc8afff7eb3b5af72b7e9a4ce3954488bfbecd0.zip frameworks_base-0bc8afff7eb3b5af72b7e9a4ce3954488bfbecd0.tar.gz frameworks_base-0bc8afff7eb3b5af72b7e9a4ce3954488bfbecd0.tar.bz2 | |
Merge "Zen: Remove calendar rule attendance attribute." into mnc-dev
| -rw-r--r-- | core/java/android/service/notification/ZenModeConfig.java | 13 | ||||
| -rw-r--r-- | services/core/java/com/android/server/notification/CalendarTracker.java | 38 |
2 files changed, 10 insertions, 41 deletions
diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java index f09f4d2..968cd72 100644 --- a/core/java/android/service/notification/ZenModeConfig.java +++ b/core/java/android/service/notification/ZenModeConfig.java @@ -692,7 +692,6 @@ public class ZenModeConfig implements Parcelable { .authority(SYSTEM_AUTHORITY) .appendPath(EVENT_PATH) .appendQueryParameter("calendar", Long.toString(event.calendar)) - .appendQueryParameter("attendance", Integer.toString(event.attendance)) .appendQueryParameter("reply", Integer.toString(event.reply)) .build(); } @@ -710,22 +709,16 @@ public class ZenModeConfig implements Parcelable { if (!isEvent) return null; final EventInfo rt = new EventInfo(); rt.calendar = tryParseLong(conditionId.getQueryParameter("calendar"), 0L); - rt.attendance = tryParseInt(conditionId.getQueryParameter("attendance"), 0); rt.reply = tryParseInt(conditionId.getQueryParameter("reply"), 0); return rt; } public static class EventInfo { - public static final int ATTENDANCE_REQUIRED_OR_OPTIONAL = 0; - public static final int ATTENDANCE_REQUIRED = 1; - public static final int ATTENDANCE_OPTIONAL = 2; - - public static final int REPLY_ANY = 0; - public static final int REPLY_ANY_EXCEPT_NO = 1; + 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 long calendar; // CalendarContract.Calendars._ID, or 0 for any - public int attendance; public int reply; @Override @@ -738,14 +731,12 @@ public class ZenModeConfig implements Parcelable { if (!(o instanceof EventInfo)) return false; final EventInfo other = (EventInfo) o; return calendar == other.calendar - && attendance == other.attendance && reply == other.reply; } public EventInfo copy() { final EventInfo rt = new EventInfo(); rt.calendar = calendar; - rt.attendance = attendance; rt.reply = reply; return rt; } diff --git a/services/core/java/com/android/server/notification/CalendarTracker.java b/services/core/java/com/android/server/notification/CalendarTracker.java index 8734d97..c82df48 100644 --- a/services/core/java/com/android/server/notification/CalendarTracker.java +++ b/services/core/java/com/android/server/notification/CalendarTracker.java @@ -55,7 +55,6 @@ public class CalendarTracker { Attendees.EVENT_ID, Attendees.ATTENDEE_EMAIL, Attendees.ATTENDEE_STATUS, - Attendees.ATTENDEE_TYPE, }; private static final String ATTENDEE_SELECTION = Attendees.EVENT_ID + " = ? AND " @@ -191,16 +190,13 @@ public class CalendarTracker { final long rowEventId = cursor.getLong(0); final String rowEmail = cursor.getString(1); final int status = cursor.getInt(2); - final int type = cursor.getInt(3); final boolean meetsReply = meetsReply(filter.reply, status); - final boolean meetsAttendance = meetsAttendance(filter.attendance, type); if (DEBUG) Log.d(TAG, (DEBUG_ATTENDEES ? String.format( "rowEventId=%s, rowEmail=%s, ", rowEventId, rowEmail) : "") + - String.format("status=%s, type=%s, meetsReply=%s, meetsAttendance=%s", - attendeeStatusToString(status), attendeeTypeToString(type), meetsReply, - meetsAttendance)); + String.format("status=%s, meetsReply=%s", + attendeeStatusToString(status), meetsReply)); final boolean eventMeets = rowEventId == eventId && Objects.equals(rowEmail, email) - && meetsReply && meetsAttendance; + && meetsReply; rt |= eventMeets; } return rt; @@ -232,35 +228,17 @@ public class CalendarTracker { } } - private static String attendeeTypeToString(int type) { - switch (type) { - case Attendees.TYPE_NONE: return "TYPE_NONE"; - case Attendees.TYPE_REQUIRED: return "TYPE_REQUIRED"; - case Attendees.TYPE_OPTIONAL: return "TYPE_OPTIONAL"; - case Attendees.TYPE_RESOURCE: return "TYPE_RESOURCE"; - default: return "TYPE_" + type; - } - } - - private static boolean meetsAttendance(int attendance, int attendeeType) { - switch (attendance) { - case EventInfo.ATTENDANCE_OPTIONAL: - return attendeeType == Attendees.TYPE_OPTIONAL; - case EventInfo.ATTENDANCE_REQUIRED: - return attendeeType == Attendees.TYPE_REQUIRED; - default: // EventInfo.ATTENDANCE_REQUIRED_OR_OPTIONAL - return true; - } - } - private static boolean meetsReply(int reply, int attendeeStatus) { switch (reply) { case EventInfo.REPLY_YES: return attendeeStatus == Attendees.ATTENDEE_STATUS_ACCEPTED; + case EventInfo.REPLY_YES_OR_MAYBE: + return attendeeStatus == Attendees.ATTENDEE_STATUS_ACCEPTED + || attendeeStatus == Attendees.ATTENDEE_STATUS_TENTATIVE; case EventInfo.REPLY_ANY_EXCEPT_NO: return attendeeStatus != Attendees.ATTENDEE_STATUS_DECLINED; - default: // EventInfo.REPLY_ANY - return true; + default: + return false; } } |
