diff --git a/src/com/android/providers/calendar/CalendarDatabaseHelper.java b/src/com/android/providers/calendar/CalendarDatabaseHelper.java
index 7d5b8a9..9bca5d3 100644
--- a/src/com/android/providers/calendar/CalendarDatabaseHelper.java
+++ b/src/com/android/providers/calendar/CalendarDatabaseHelper.java
@@ -70,7 +70,7 @@
     // 4xx for JB
     // 5xx for K
     // Bump this to the next hundred at each major release.
-    static final int DATABASE_VERSION = 401;
+    static final int DATABASE_VERSION = 402;
 
     private static final int PRE_FROYO_SYNC_STATE_VERSION = 3;
 
@@ -121,7 +121,9 @@
             Attendees.ATTENDEE_EMAIL + "," +
             Attendees.ATTENDEE_STATUS + "," +
             Attendees.ATTENDEE_RELATIONSHIP + "," +
-            Attendees.ATTENDEE_TYPE;
+            Attendees.ATTENDEE_TYPE + "," +
+            Attendees.ATTENDEE_IDENTITY + "," +
+            Attendees.ATTENDEE_ID_NAMESPACE;
 
     // columns used to duplicate an extended property row
     private static final String LAST_SYNCED_EXTENDED_PROPERTY_COLUMNS =
@@ -426,7 +428,9 @@
                 CalendarContract.Attendees.ATTENDEE_EMAIL + " TEXT," +
                 CalendarContract.Attendees.ATTENDEE_STATUS + " INTEGER," +
                 CalendarContract.Attendees.ATTENDEE_RELATIONSHIP + " INTEGER," +
-                CalendarContract.Attendees.ATTENDEE_TYPE + " INTEGER" +
+                CalendarContract.Attendees.ATTENDEE_TYPE + " INTEGER," +
+                CalendarContract.Attendees.ATTENDEE_IDENTITY + " TEXT," +
+                CalendarContract.Attendees.ATTENDEE_ID_NAMESPACE + " TEXT" +
                 ");");
 
         db.execSQL("CREATE INDEX attendeesEventIdIndex ON " + Tables.ATTENDEES + " (" +
@@ -1368,6 +1372,11 @@
                 createEventsView = true;
                 oldVersion = 401;
             }
+            if (oldVersion == 401) {
+                upgradeToVersion402(db);
+                createEventsView = true;
+                oldVersion = 402;
+            }
             if (createEventsView) {
                 createEventsView(db);
             }
@@ -1443,6 +1452,16 @@
     /* 4xx db version is for J release
     /**********************************************************/
 
+    @VisibleForTesting
+    void upgradeToVersion402(SQLiteDatabase db) {
+        /*
+         * Changes from version 401 to 402:
+         * - add identity and namespace to Attendees table
+         */
+        db.execSQL("ALTER TABLE Attendees ADD COLUMN attendeeIdentity TEXT;");
+        db.execSQL("ALTER TABLE Attendees ADD COLUMN attendeeIdNamespace TEXT;");
+    }
+
     /*
      * Changes from version 309 to 401:
      * Fix repeating events' exceptions with the wrong original_id
diff --git a/src/com/android/providers/calendar/CalendarProvider2.java b/src/com/android/providers/calendar/CalendarProvider2.java
index 53b71f9..50183ea 100644
--- a/src/com/android/providers/calendar/CalendarProvider2.java
+++ b/src/com/android/providers/calendar/CalendarProvider2.java
@@ -4763,6 +4763,8 @@
         sAttendeesProjectionMap.put(Attendees.ATTENDEE_STATUS, "attendeeStatus");
         sAttendeesProjectionMap.put(Attendees.ATTENDEE_RELATIONSHIP, "attendeeRelationship");
         sAttendeesProjectionMap.put(Attendees.ATTENDEE_TYPE, "attendeeType");
+        sAttendeesProjectionMap.put(Attendees.ATTENDEE_IDENTITY, "attendeeIdentity");
+        sAttendeesProjectionMap.put(Attendees.ATTENDEE_ID_NAMESPACE, "attendeeIdNamespace");
         sAttendeesProjectionMap.put(Events.DELETED, "Events.deleted AS deleted");
         sAttendeesProjectionMap.put(Events._SYNC_ID, "Events._sync_id AS _sync_id");
 
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 22cb75b..0ce5105 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -4,9 +4,9 @@
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
-  
+
           http://www.apache.org/licenses/LICENSE-2.0
-  
+
      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,13 +24,16 @@
 
     <uses-permission android:name="android.permission.READ_CALENDAR" />
     <uses-permission android:name="android.permission.WRITE_CALENDAR" />
-   
+
     <!--
     The test declared in this instrumentation will be run along with tests declared by
     all other applications via the command: "adb shell itr".
     The "itr" command will find all tests declared by all applications. If you want to run just these
     tests on their own then use the command:
     "adb shell am instrument -w com.android.providers.calendar.tests/android.test.InstrumentationTestRunner"
+
+    To test db upgrade:
+    adb shell am instrument -w -e class com.android.providers.calendar.CalendarDatabaseHelperTest#testSchemasEqualForAllTables com.android.providers.calendar.tests/android.test.InstrumentationTestRunner
     -->
     <instrumentation android:name="android.test.InstrumentationTestRunner"
                      android:targetPackage="com.android.providers.calendar"
diff --git a/tests/src/com/android/providers/calendar/CalendarDatabaseHelperTest.java b/tests/src/com/android/providers/calendar/CalendarDatabaseHelperTest.java
index fbd737e..9cb2e28 100644
--- a/tests/src/com/android/providers/calendar/CalendarDatabaseHelperTest.java
+++ b/tests/src/com/android/providers/calendar/CalendarDatabaseHelperTest.java
@@ -464,9 +464,21 @@
                 "tbl_name,sql" /* orderBy */);
 
         while (goodCursor.moveToNext()) {
-            assertTrue("Should have same number of tables", badCursor.moveToNext());
+            String goodTableName = goodCursor.getString(0);
+            // Ignore tables that do not belong to calendar
+            if (goodTableName.startsWith("sqlite_") || goodTableName.equals("android_metadata")) {
+                continue;
+            }
+
+            // Ignore tables that do not belong to calendar
+            String badTableName;
+            do {
+                assertTrue("Should have same number of tables", badCursor.moveToNext());
+                badTableName = badCursor.getString(0);
+            } while (badTableName.startsWith("sqlite_") || badTableName.equals("android_metadata"));
+
             assertEquals("Table names different between upgraded schema and freshly-created scheme",
-                    goodCursor.getString(0), badCursor.getString(0));
+                    goodTableName, badTableName);
 
             String badString = badCursor.getString(1);
             String goodString = goodCursor.getString(1);
diff --git a/tests/src/com/android/providers/calendar/CalendarProvider2Test.java b/tests/src/com/android/providers/calendar/CalendarProvider2Test.java
index 1be6069..dac3162 100644
--- a/tests/src/com/android/providers/calendar/CalendarProvider2Test.java
+++ b/tests/src/com/android/providers/calendar/CalendarProvider2Test.java
@@ -51,6 +51,7 @@
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
 import java.util.TimeZone;
 
 /**
@@ -1867,12 +1868,16 @@
         attendee.put(CalendarContract.Attendees.ATTENDEE_RELATIONSHIP,
                 CalendarContract.Attendees.RELATIONSHIP_ORGANIZER);
         attendee.put(CalendarContract.Attendees.EVENT_ID, eventId);
+        attendee.put(CalendarContract.Attendees.ATTENDEE_IDENTITY, "ID1");
+        attendee.put(CalendarContract.Attendees.ATTENDEE_ID_NAMESPACE, "IDNS1");
         Uri attendeesUri = mResolver.insert(CalendarContract.Attendees.CONTENT_URI, attendee);
 
         Cursor cursor = mResolver.query(CalendarContract.Attendees.CONTENT_URI, null,
                 "event_id=" + eventId, null, null);
         assertEquals("Created event is missing - cannot find EventUri = " + eventUri, 1,
                 cursor.getCount());
+        Set<String> attendeeColumns = attendee.keySet();
+        verifyContentValueAgainstCursor(attendee, attendeeColumns, cursor);
         cursor.close();
 
         cursor = mResolver.query(eventUri, null, null, null, null);
@@ -1885,11 +1890,23 @@
         assertEquals(CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED, selfAttendeeStatus);
         cursor.close();
 
-        // Change status to declined
+        // Update status to declined and change identity
+        ContentValues attendeeUpdate = new ContentValues();
+        attendeeUpdate.put(CalendarContract.Attendees.ATTENDEE_IDENTITY, "ID2");
+        attendee.put(CalendarContract.Attendees.ATTENDEE_IDENTITY, "ID2");
+        attendeeUpdate.put(CalendarContract.Attendees.ATTENDEE_STATUS,
+                CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED);
         attendee.put(CalendarContract.Attendees.ATTENDEE_STATUS,
                 CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED);
-        mResolver.update(attendeesUri, attendee, null, null);
+        mResolver.update(attendeesUri, attendeeUpdate, null, null);
 
+        // Check in attendees table
+        cursor = mResolver.query(attendeesUri, null, null, null, null);
+        cursor.moveToNext();
+        verifyContentValueAgainstCursor(attendee, attendeeColumns, cursor);
+        cursor.close();
+
+        // Test that the self status in events table is updated
         cursor = mResolver.query(eventUri, null, null, null, null);
         cursor.moveToNext();
         selfAttendeeStatus = cursor.getInt(selfColumn);
@@ -1915,6 +1932,16 @@
         cursor.close();
     }
 
+    private void verifyContentValueAgainstCursor(ContentValues cv,
+            Set<String> keys, Cursor cursor) {
+        cursor.moveToFirst();
+        for (String key : keys) {
+            assertEquals(cv.get(key).toString(),
+                    cursor.getString(cursor.getColumnIndex(key)));
+        }
+        cursor.close();
+    }
+
     /**
      * Test the event's dirty status and clear it.
      *
