Make sure we always send an attendee name w/ email address
* EAS requires an attendee name in addition to an address in upsynced
Calendar items.
Change-Id: I9384dcba6fd2fff8be960e18297ef7f641e0abe7
diff --git a/src/com/android/exchange/adapter/CalendarSyncAdapter.java b/src/com/android/exchange/adapter/CalendarSyncAdapter.java
index 288b1a2..11821c9 100644
--- a/src/com/android/exchange/adapter/CalendarSyncAdapter.java
+++ b/src/com/android/exchange/adapter/CalendarSyncAdapter.java
@@ -1083,7 +1083,9 @@
ContentValues ncvValues = ncv.values;
if (ncvUri.equals(Attendees.CONTENT_URI)) {
Integer relationship = ncvValues.getAsInteger(Attendees.ATTENDEE_RELATIONSHIP);
- if (relationship != null) {
+ // If there's no relationship, we can't create this for EAS
+ // Similarly, we need an attendee email for each invitee
+ if (relationship != null && ncvValues.containsKey(Attendees.ATTENDEE_EMAIL)) {
// Organizer isn't among attendees in EAS
if (relationship == Attendees.RELATIONSHIP_ORGANIZER) {
organizerName = ncvValues.getAsString(Attendees.ATTENDEE_NAME);
@@ -1094,14 +1096,17 @@
hasAttendees = true;
}
s.start(Tags.CALENDAR_ATTENDEE);
- s.writeStringValue(ncvValues, Attendees.ATTENDEE_NAME,
- Tags.CALENDAR_ATTENDEE_NAME);
+ String attendeeName = ncvValues.getAsString(Attendees.ATTENDEE_NAME);
+ if (attendeeName == null) {
+ attendeeName = ncvValues.getAsString(Attendees.ATTENDEE_EMAIL);
+ }
+ s.data(Tags.CALENDAR_ATTENDEE_NAME, attendeeName);
s.writeStringValue(ncvValues, Attendees.ATTENDEE_EMAIL,
Tags.CALENDAR_ATTENDEE_EMAIL);
s.data(Tags.CALENDAR_ATTENDEE_TYPE, "1"); // Required
s.end(); // Attendee
+ // Don't send status (disallowed for upload)
}
- // If there's no relationship, we can't create this for EAS
}
}
if (hasAttendees) {