diff options
| author | 2015-05-06 16:21:58 +0000 | |
|---|---|---|
| committer | 2015-05-06 16:21:59 +0000 | |
| commit | 444eda0836095f58388456355e80cf3b9b127bf4 (patch) | |
| tree | 68c417f647964ab08e0b7ff33e36b04efe5fd36a | |
| parent | ed7cbf111f5970ab56e557cd785063068405b563 (diff) | |
| parent | 028a53977cd0e3c1393ca17ad680473764905a56 (diff) | |
Merge "Zen: Calendar tracker should use event availability." into mnc-dev
| -rw-r--r-- | services/core/java/com/android/server/notification/CalendarTracker.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/notification/CalendarTracker.java b/services/core/java/com/android/server/notification/CalendarTracker.java index c82df4827f53..28da73ccb3ed 100644 --- a/services/core/java/com/android/server/notification/CalendarTracker.java +++ b/services/core/java/com/android/server/notification/CalendarTracker.java @@ -47,6 +47,7 @@ public class CalendarTracker { Instances.EVENT_ID, Instances.OWNER_ACCOUNT, Instances.CALENDAR_ID, + Instances.AVAILABILITY, }; private static final String INSTANCE_ORDER_BY = Instances.BEGIN + " ASC"; @@ -143,11 +144,14 @@ public class CalendarTracker { final int eventId = cursor.getInt(4); final String owner = cursor.getString(5); final long calendarId = cursor.getLong(6); - if (DEBUG) Log.d(TAG, String.format("%s %s-%s v=%s eid=%s o=%s cid=%s", title, - new Date(begin), new Date(end), visible, eventId, owner, calendarId)); + final int availability = cursor.getInt(7); + if (DEBUG) Log.d(TAG, String.format("%s %s-%s v=%s a=%s eid=%s o=%s cid=%s", title, + new Date(begin), new Date(end), visible, availabilityToString(availability), + eventId, owner, calendarId)); final boolean meetsTime = time >= begin && time < end; final boolean meetsCalendar = visible - && (filter.calendar == 0 || filter.calendar == calendarId); + && (filter.calendar == 0 || filter.calendar == calendarId) + && availability != Instances.AVAILABILITY_FREE; if (meetsCalendar) { if (DEBUG) Log.d(TAG, " MEETS CALENDAR"); final boolean meetsAttendee = meetsAttendee(filter, eventId, owner); @@ -228,6 +232,15 @@ public class CalendarTracker { } } + private static String availabilityToString(int availability) { + switch (availability) { + case Instances.AVAILABILITY_BUSY: return "AVAILABILITY_BUSY"; + case Instances.AVAILABILITY_FREE: return "AVAILABILITY_FREE"; + case Instances.AVAILABILITY_TENTATIVE: return "AVAILABILITY_TENTATIVE"; + default: return "AVAILABILITY_UNKNOWN_" + availability; + } + } + private static boolean meetsReply(int reply, int attendeeStatus) { switch (reply) { case EventInfo.REPLY_YES: |