Send correct busy status information in upsyncs to EAS
* Fix unit test that was failing
Bug: 2615382
Change-Id: I54c7bdd982d57528f55ce4f4c6804c9f532293fb
diff --git a/src/com/android/exchange/utility/CalendarUtilities.java b/src/com/android/exchange/utility/CalendarUtilities.java
index 263b136..a916288 100644
--- a/src/com/android/exchange/utility/CalendarUtilities.java
+++ b/src/com/android/exchange/utility/CalendarUtilities.java
@@ -137,10 +137,15 @@
static final String ICALENDAR_ATTENDEE_TENTATIVE =
ICALENDAR_ATTENDEE + ";PARTSTAT=TENTATIVE";
- public static final int BUSY_STATUS_BUSY = 0;
- public static final int BUSY_STATUS_FREE = 1;
- public static final int BUSY_STATUS_TENTATIVE = 2;
- public static final int BUSY_STATUS_OOF = 3;
+ // Note that these constants apply to Calendar items
+ // For future reference: MeetingRequest data can also include free/busy information, but the
+ // constants for these four options in MeetingRequest data have different values!
+ // See [MS-ASCAL] 2.2.2.8 for Calendar BusyStatus
+ // See [MS-EMAIL] 2.2.2.34 for MeetingRequest BusyStatus
+ public static final int BUSY_STATUS_FREE = 0;
+ public static final int BUSY_STATUS_TENTATIVE = 1;
+ public static final int BUSY_STATUS_BUSY = 2;
+ public static final int BUSY_STATUS_OUT_OF_OFFICE = 3;
// Return a 4-byte long from a byte array (little endian)
static int getLong(byte[] bytes, int offset) {
@@ -1233,7 +1238,7 @@
selfAttendeeStatus = Attendees.ATTENDEE_STATUS_TENTATIVE;
break;
case BUSY_STATUS_FREE:
- case BUSY_STATUS_OOF:
+ case BUSY_STATUS_OUT_OF_OFFICE:
default:
selfAttendeeStatus = Attendees.ATTENDEE_STATUS_NONE;
}
diff --git a/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java b/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java
index c99fa4b..2e3c02d 100644
--- a/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java
+++ b/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java
@@ -727,17 +727,17 @@
CalendarUtilities.BUSY_STATUS_FREE));
assertEquals(Attendees.ATTENDEE_STATUS_NONE,
CalendarUtilities.selfAttendeeStatusFromBusyStatus(
- CalendarUtilities.BUSY_STATUS_OOF));
+ CalendarUtilities.BUSY_STATUS_OUT_OF_OFFICE));
}
public void testBusyStatusFromSelfStatus() {
assertEquals(CalendarUtilities.BUSY_STATUS_FREE,
CalendarUtilities.busyStatusFromSelfAttendeeStatus(
Attendees.ATTENDEE_STATUS_DECLINED));
- assertEquals(CalendarUtilities.BUSY_STATUS_BUSY,
+ assertEquals(CalendarUtilities.BUSY_STATUS_FREE,
CalendarUtilities.busyStatusFromSelfAttendeeStatus(
Attendees.ATTENDEE_STATUS_NONE));
- assertEquals(CalendarUtilities.BUSY_STATUS_BUSY,
+ assertEquals(CalendarUtilities.BUSY_STATUS_FREE,
CalendarUtilities.busyStatusFromSelfAttendeeStatus(
Attendees.ATTENDEE_STATUS_INVITED));
assertEquals(CalendarUtilities.BUSY_STATUS_TENTATIVE,