am 1687164a: (-s ours) Reconcile with jb-mr0-release - do not merge

* commit '1687164a25c537f456cb4d212d128c99870bdf07':
  Fix event color query (which fixes the failing CTS test).
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 3d424e4..2951087 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -44,6 +44,7 @@
         <provider android:name="CalendarProvider2" android:authorities="com.android.calendar"
                 android:label="@string/provider_label"
                 android:multiprocess="false"
+                android:exported="true"
                 android:readPermission="android.permission.READ_CALENDAR"
                 android:writePermission="android.permission.WRITE_CALENDAR" />
 
diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml
index 6c3ae5e..e82b7dd 100644
--- a/res/values-fa/strings.xml
+++ b/res/values-fa/strings.xml
@@ -18,7 +18,7 @@
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="calendar_storage" msgid="5387668002987562770">"حافظه تقویم"</string>
     <string name="upgrade_msg" msgid="2792831029435070926">"ارتقاء پایگاه داده تقویم."</string>
-    <string name="calendar_default_name" msgid="6924293766625167275">"پیش فرض"</string>
+    <string name="calendar_default_name" msgid="6924293766625167275">"پیش‌فرض"</string>
     <string name="calendar_info" msgid="6687678621418059281">"اطلاعات تقویم"</string>
     <string name="calendar_info_error" msgid="5575162446528419982">"خطا"</string>
     <string name="calendar_info_no_calendars" msgid="4287534468186704433">"تقویمی موجود نیست"</string>
@@ -27,7 +27,7 @@
     <string name="provider_label" msgid="2306513350843464739">"تقویم"</string>
     <string name="debug_tool_delete_button" msgid="5052706251268452090">"اکنون حذف کنید"</string>
     <string name="debug_tool_start_button" msgid="5384780896342913563">"شروع"</string>
-    <string name="debug_tool_message" msgid="4862486669932821937">"شما در حال 1) ایجاد یک کپی از پایگاه داده تقویم خود در کارت SD/حافظه USB که توسط هر برنامه‌ای قابل خواندن است و 2) ایمیل کردن آن هستید. به خاطر داشته باشید که بلافاصله پس از کپی کردن آن از دستگاه یا دریافت ایمیل، آن را حذف کنید."</string>
+    <string name="debug_tool_message" msgid="4862486669932821937">"شما در حال 1) ایجاد یک کپی از پایگاه داده تقویم خود در کارت SD/حافظهٔ USB که توسط هر برنامه‌ای قابل خواندن است و 2) ایمیل کردن آن هستید. به خاطر داشته باشید که بلافاصله پس از کپی کردن آن از دستگاه یا دریافت ایمیل، آن را حذف کنید."</string>
     <string name="debug_tool_email_sender_picker" msgid="2000311987477419397">"یک برنامه را برای ارسال فایل خود انتخاب کنید"</string>
     <string name="debug_tool_email_subject" msgid="2403590332256471194">"پایگاه داده تقویم پیوست شد"</string>
     <string name="debug_tool_email_body" msgid="4835949635324134017">"پایگاه داده تقویم من همراه با تمام قرارها و اطلاعات شخصی من پیوست شده است. از آن به دقت استفاده کنید."</string>
diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml
index 601eb8b..40df5df 100644
--- a/res/values-tr/strings.xml
+++ b/res/values-tr/strings.xml
@@ -27,7 +27,7 @@
     <string name="provider_label" msgid="2306513350843464739">"Takvim"</string>
     <string name="debug_tool_delete_button" msgid="5052706251268452090">"Şimdi sil"</string>
     <string name="debug_tool_start_button" msgid="5384780896342913563">"Başlat"</string>
-    <string name="debug_tool_message" msgid="4862486669932821937">"Takvim veritabanınızı 1) tüm uygulamaların okuyabileceği sd kart/usb depolama birimine kopyalamak ve 2) bunu e-postayla göndermek üzeresiniz. Bu veritabanını başarılı bir şekilde kopyaladıktan veya e-posta alındıktan sonra, kopyayı cihazdan hemen silmeyi unutmayın."</string>
+    <string name="debug_tool_message" msgid="4862486669932821937">"Takvim veritabanınızı 1) tüm uygulamaların okuyabileceği sd kart/usb belleğe kopyalamak ve 2) bunu e-postayla göndermek üzeresiniz. Bu veritabanını başarılı bir şekilde kopyaladıktan veya e-posta alındıktan sonra, kopyayı cihazdan hemen silmeyi unutmayın."</string>
     <string name="debug_tool_email_sender_picker" msgid="2000311987477419397">"Dosyanızı göndermek için bir program seçin"</string>
     <string name="debug_tool_email_subject" msgid="2403590332256471194">"Takvim Veritabanı ekte"</string>
     <string name="debug_tool_email_body" msgid="4835949635324134017">"Tüm randevularımı ve kişisel bilgilerimi içeren takvim veritabanımı ekte bulabilirsiniz. Lütfen kullanırken dikkatli olun."</string>
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index f2d64d9..383edad 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -27,7 +27,7 @@
     <string name="provider_label" msgid="2306513350843464739">"日历"</string>
     <string name="debug_tool_delete_button" msgid="5052706251268452090">"立即删除"</string>
     <string name="debug_tool_start_button" msgid="5384780896342913563">"开始"</string>
-    <string name="debug_tool_message" msgid="4862486669932821937">"您需要执行以下操作:1) 在任意应用都可读取的 SD 卡/USB 存储设备中,创建日历数据库的副本;2) 通过电子邮件发送该副本。在成功从设备中复制该副本或开发人员收到相关电子邮件后,请务必将该副本及时删除。"</string>
+    <string name="debug_tool_message" msgid="4862486669932821937">"您需要执行以下操作:1) 在任意应用都可读取的 SD 卡/USB 存储设备中,创建日历数据库的副本;2) 通过电子邮件发送该副本。在成功从设备中复制该副本或开发者收到相关电子邮件后,请务必将该副本及时删除。"</string>
     <string name="debug_tool_email_sender_picker" msgid="2000311987477419397">"选择用于发送文件的程序"</string>
     <string name="debug_tool_email_subject" msgid="2403590332256471194">"日历调试工具已附加"</string>
     <string name="debug_tool_email_body" msgid="4835949635324134017">"附件是我的日历数据库,其中包含我的全部约会和个人信息,因此请谨慎处理。"</string>
diff --git a/src/com/android/providers/calendar/CalendarAlarmManager.java b/src/com/android/providers/calendar/CalendarAlarmManager.java
index d917020..f25d3de 100644
--- a/src/com/android/providers/calendar/CalendarAlarmManager.java
+++ b/src/com/android/providers/calendar/CalendarAlarmManager.java
@@ -193,9 +193,13 @@
      * @param db TODO
      */
     void runScheduleNextAlarm(boolean removeAlarms, CalendarProvider2 cp2) {
+        SQLiteDatabase db = cp2.mDb;
+        if (db == null) {
+            return;
+        }
+
         // Reset so that we can accept other schedules of next alarm
         mNextAlarmCheckScheduled.set(false);
-        SQLiteDatabase db = cp2.mDb;
         db.beginTransaction();
         try {
             if (removeAlarms) {
diff --git a/src/com/android/providers/calendar/CalendarDatabaseHelper.java b/src/com/android/providers/calendar/CalendarDatabaseHelper.java
index 01bd6f8..7db2594 100644
--- a/src/com/android/providers/calendar/CalendarDatabaseHelper.java
+++ b/src/com/android/providers/calendar/CalendarDatabaseHelper.java
@@ -16,10 +16,6 @@
 
 package com.android.providers.calendar;
 
-import com.google.common.annotations.VisibleForTesting;
-
-import com.android.common.content.SyncStateContentProviderHelper;
-
 import android.accounts.Account;
 import android.content.ContentResolver;
 import android.content.ContentValues;
@@ -42,6 +38,9 @@
 import android.text.format.Time;
 import android.util.Log;
 
+import com.android.common.content.SyncStateContentProviderHelper;
+import com.google.common.annotations.VisibleForTesting;
+
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.util.TimeZone;
@@ -71,9 +70,10 @@
     // 2xx for Honeycomb
     // 3xx for ICS
     // 4xx for JB
-    // 5xx for K
+    // 5xx for JB MR1
+    // 6xx for K
     // Bump this to the next hundred at each major release.
-    static final int DATABASE_VERSION = 403;
+    static final int DATABASE_VERSION = 502;
 
     private static final int PRE_FROYO_SYNC_STATE_VERSION = 3;
 
@@ -112,8 +112,10 @@
             Events.GUESTS_CAN_INVITE_OTHERS + "," +
             Events.GUESTS_CAN_SEE_GUESTS + "," +
             Events.ORGANIZER + "," +
+            Events.IS_ORGANIZER + "," +
             Events.CUSTOM_APP_PACKAGE + "," +
-            Events.CUSTOM_APP_URI;
+            Events.CUSTOM_APP_URI + "," +
+            Events.UID_2445;
 
     // columns used to duplicate a reminder row
     private static final String LAST_SYNCED_REMINDER_COLUMNS =
@@ -558,11 +560,13 @@
                 CalendarContract.Events.GUESTS_CAN_INVITE_OTHERS + " INTEGER NOT NULL DEFAULT 1," +
                 CalendarContract.Events.GUESTS_CAN_SEE_GUESTS + " INTEGER NOT NULL DEFAULT 1," +
                 CalendarContract.Events.ORGANIZER + " STRING," +
+                CalendarContract.Events.IS_ORGANIZER + " INTEGER," +
                 CalendarContract.Events.DELETED + " INTEGER NOT NULL DEFAULT 0," +
                 // timezone for event with allDay events are in local timezone
                 CalendarContract.Events.EVENT_END_TIMEZONE + " TEXT," +
                 CalendarContract.Events.CUSTOM_APP_PACKAGE + " TEXT," +
                 CalendarContract.Events.CUSTOM_APP_URI + " TEXT," +
+                CalendarContract.Events.UID_2445 + " TEXT," +
                 // SYNC_DATAX columns are available for use by sync adapters
                 CalendarContract.Events.SYNC_DATA1 + " TEXT," +
                 CalendarContract.Events.SYNC_DATA2 + " TEXT," +
@@ -773,6 +777,7 @@
                 Calendars.CALENDAR_LOCATION + " TEXT," +
                 Calendars.CALENDAR_TIME_ZONE + " TEXT," +
                 Calendars.OWNER_ACCOUNT + " TEXT, " +
+                Calendars.IS_PRIMARY + " INTEGER, " +
                 Calendars.CAN_ORGANIZER_RESPOND + " INTEGER NOT NULL DEFAULT 1," +
                 Calendars.CAN_MODIFY_TIME_ZONE + " INTEGER DEFAULT 1," +
                 Calendars.CAN_PARTIALLY_UPDATE + " INTEGER DEFAULT 0," +
@@ -1386,9 +1391,19 @@
             }
             if (oldVersion == 402) {
                 upgradeToVersion403(db);
-                createEventsView = true; // This is needed if the calendars or events schema changed
+                createEventsView = true;
                 oldVersion = 403;
             }
+            if (oldVersion == 403) {
+                upgradeToVersion501(db);
+                createEventsView = true;
+                oldVersion = 501;
+            }
+            if (oldVersion == 501) {
+                upgradeToVersion502(db);
+                createEventsView = true; // This is needed if the calendars or events schema changed
+                oldVersion = 502;
+            }
 
             if (createEventsView) {
                 createEventsView(db);
@@ -1462,10 +1477,32 @@
     /**********************************************************/
 
     /**********************************************************/
-    /* 5xx db version is for K release
+    /* 6xx db version is for K release
     /**********************************************************/
 
     /**********************************************************/
+    /* 5xx db version is for JB MR1 release
+    /**********************************************************/
+
+    private void upgradeToVersion501(SQLiteDatabase db) {
+        /*
+         * Changes from version 403 to 501:
+         * - add isOrganizer column to Events table
+         * - add isPrimary column to Calendars table
+         */
+        db.execSQL("ALTER TABLE Events ADD COLUMN isOrganizer INTEGER;");
+        db.execSQL("ALTER TABLE Calendars ADD COLUMN isPrimary INTEGER;");
+    }
+
+    private void upgradeToVersion502(SQLiteDatabase db) {
+        /*
+         * Changes from version 501 to 502:
+         * - add UID for events added from the RFC 2445 iCalendar format.
+         */
+        db.execSQL("ALTER TABLE Events ADD COLUMN uid2445 TEXT;");
+    }
+
+    /**********************************************************/
     /* 4xx db version is for J release
     /**********************************************************/
 
@@ -3139,8 +3176,12 @@
                 + CalendarContract.Events.GUESTS_CAN_MODIFY + ","
                 + CalendarContract.Events.GUESTS_CAN_SEE_GUESTS + ","
                 + CalendarContract.Events.ORGANIZER + ","
+                + "COALESCE("
+                + Events.IS_ORGANIZER + ", " + Events.ORGANIZER + " = " + Calendars.OWNER_ACCOUNT
+                + ") AS " + Events.IS_ORGANIZER + ","
                 + CalendarContract.Events.CUSTOM_APP_PACKAGE + ","
                 + CalendarContract.Events.CUSTOM_APP_URI + ","
+                + CalendarContract.Events.UID_2445 + ","
                 + CalendarContract.Events.SYNC_DATA1 + ","
                 + CalendarContract.Events.SYNC_DATA2 + ","
                 + CalendarContract.Events.SYNC_DATA3 + ","
diff --git a/src/com/android/providers/calendar/CalendarInstancesHelper.java b/src/com/android/providers/calendar/CalendarInstancesHelper.java
index b549eb9..356b442 100644
--- a/src/com/android/providers/calendar/CalendarInstancesHelper.java
+++ b/src/com/android/providers/calendar/CalendarInstancesHelper.java
@@ -16,11 +16,11 @@
 
 package com.android.providers.calendar;
 
-import com.android.calendarcommon.DateException;
-import com.android.calendarcommon.Duration;
-import com.android.calendarcommon.EventRecurrence;
-import com.android.calendarcommon.RecurrenceProcessor;
-import com.android.calendarcommon.RecurrenceSet;
+import com.android.calendarcommon2.DateException;
+import com.android.calendarcommon2.Duration;
+import com.android.calendarcommon2.EventRecurrence;
+import com.android.calendarcommon2.RecurrenceProcessor;
+import com.android.calendarcommon2.RecurrenceSet;
 import com.android.providers.calendar.CalendarDatabaseHelper.Tables;
 
 import android.content.ContentValues;
diff --git a/src/com/android/providers/calendar/CalendarProvider2.java b/src/com/android/providers/calendar/CalendarProvider2.java
index 9ef0e35..d2027ee 100644
--- a/src/com/android/providers/calendar/CalendarProvider2.java
+++ b/src/com/android/providers/calendar/CalendarProvider2.java
@@ -54,11 +54,11 @@
 import android.util.TimeFormatException;
 import android.util.TimeUtils;
 
-import com.android.calendarcommon.DateException;
-import com.android.calendarcommon.Duration;
-import com.android.calendarcommon.EventRecurrence;
-import com.android.calendarcommon.RecurrenceProcessor;
-import com.android.calendarcommon.RecurrenceSet;
+import com.android.calendarcommon2.DateException;
+import com.android.calendarcommon2.Duration;
+import com.android.calendarcommon2.EventRecurrence;
+import com.android.calendarcommon2.RecurrenceProcessor;
+import com.android.calendarcommon2.RecurrenceSet;
 import com.android.providers.calendar.CalendarDatabaseHelper.Tables;
 import com.android.providers.calendar.CalendarDatabaseHelper.Views;
 import com.google.android.collect.Sets;
@@ -413,6 +413,7 @@
         ALLOWED_IN_EXCEPTION.add(Events.ORGANIZER);
         ALLOWED_IN_EXCEPTION.add(Events.CUSTOM_APP_PACKAGE);
         ALLOWED_IN_EXCEPTION.add(Events.CUSTOM_APP_URI);
+        ALLOWED_IN_EXCEPTION.add(Events.UID_2445);
         // deleted, original_id, alerts
     }
 
@@ -876,12 +877,14 @@
             case CALENDARS:
             case CALENDAR_ENTITIES:
                 qb.setTables(Tables.CALENDARS);
+                qb.setProjectionMap(sCalendarsProjectionMap);
                 selection = appendAccountToSelection(uri, selection, Calendars.ACCOUNT_NAME,
                         Calendars.ACCOUNT_TYPE);
                 break;
             case CALENDARS_ID:
             case CALENDAR_ENTITIES_ID:
                 qb.setTables(Tables.CALENDARS);
+                qb.setProjectionMap(sCalendarsProjectionMap);
                 selectionArgs = insertSelectionArg(selectionArgs, uri.getPathSegments().get(1));
                 qb.appendWhere(SQL_WHERE_ID);
                 break;
@@ -4553,6 +4556,7 @@
     private static final UriMatcher sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
     private static final HashMap<String, String> sInstancesProjectionMap;
     private static final HashMap<String, String> sColorsProjectionMap;
+    protected static final HashMap<String, String> sCalendarsProjectionMap;
     protected static final HashMap<String, String> sEventsProjectionMap;
     private static final HashMap<String, String> sEventEntitiesProjectionMap;
     private static final HashMap<String, String> sAttendeesProjectionMap;
@@ -4614,6 +4618,48 @@
         sColorsProjectionMap.put(Colors.COLOR_TYPE, Colors.COLOR_TYPE);
         sColorsProjectionMap.put(Colors.COLOR, Colors.COLOR);
 
+        sCalendarsProjectionMap = new HashMap<String, String>();
+        sCalendarsProjectionMap.put(Calendars._ID, Calendars._ID);
+        sCalendarsProjectionMap.put(Calendars.ACCOUNT_NAME, Calendars.ACCOUNT_NAME);
+        sCalendarsProjectionMap.put(Calendars.ACCOUNT_TYPE, Calendars.ACCOUNT_TYPE);
+        sCalendarsProjectionMap.put(Calendars._SYNC_ID, Calendars._SYNC_ID);
+        sCalendarsProjectionMap.put(Calendars.DIRTY, Calendars.DIRTY);
+        sCalendarsProjectionMap.put(Calendars.NAME, Calendars.NAME);
+        sCalendarsProjectionMap.put(
+                Calendars.CALENDAR_DISPLAY_NAME, Calendars.CALENDAR_DISPLAY_NAME);
+        sCalendarsProjectionMap.put(Calendars.CALENDAR_COLOR, Calendars.CALENDAR_COLOR);
+        sCalendarsProjectionMap.put(Calendars.CALENDAR_COLOR_KEY, Calendars.CALENDAR_COLOR_KEY);
+        sCalendarsProjectionMap.put(Calendars.CALENDAR_ACCESS_LEVEL,
+                Calendars.CALENDAR_ACCESS_LEVEL);
+        sCalendarsProjectionMap.put(Calendars.VISIBLE, Calendars.VISIBLE);
+        sCalendarsProjectionMap.put(Calendars.SYNC_EVENTS, Calendars.SYNC_EVENTS);
+        sCalendarsProjectionMap.put(Calendars.CALENDAR_LOCATION, Calendars.CALENDAR_LOCATION);
+        sCalendarsProjectionMap.put(Calendars.CALENDAR_TIME_ZONE, Calendars.CALENDAR_TIME_ZONE);
+        sCalendarsProjectionMap.put(Calendars.OWNER_ACCOUNT, Calendars.OWNER_ACCOUNT);
+        sCalendarsProjectionMap.put(Calendars.IS_PRIMARY,
+                "COALESCE(" + Events.IS_PRIMARY + ", "
+                        + Calendars.OWNER_ACCOUNT + " = " + Calendars.ACCOUNT_NAME + ")");
+        sCalendarsProjectionMap.put(Calendars.CAN_ORGANIZER_RESPOND,
+                Calendars.CAN_ORGANIZER_RESPOND);
+        sCalendarsProjectionMap.put(Calendars.CAN_MODIFY_TIME_ZONE, Calendars.CAN_MODIFY_TIME_ZONE);
+        sCalendarsProjectionMap.put(Calendars.CAN_PARTIALLY_UPDATE, Calendars.CAN_PARTIALLY_UPDATE);
+        sCalendarsProjectionMap.put(Calendars.MAX_REMINDERS, Calendars.MAX_REMINDERS);
+        sCalendarsProjectionMap.put(Calendars.ALLOWED_REMINDERS, Calendars.ALLOWED_REMINDERS);
+        sCalendarsProjectionMap.put(Calendars.ALLOWED_AVAILABILITY, Calendars.ALLOWED_AVAILABILITY);
+        sCalendarsProjectionMap.put(Calendars.ALLOWED_ATTENDEE_TYPES,
+                Calendars.ALLOWED_ATTENDEE_TYPES);
+        sCalendarsProjectionMap.put(Calendars.DELETED, Calendars.DELETED);
+        sCalendarsProjectionMap.put(Calendars.CAL_SYNC1, Calendars.CAL_SYNC1);
+        sCalendarsProjectionMap.put(Calendars.CAL_SYNC2, Calendars.CAL_SYNC2);
+        sCalendarsProjectionMap.put(Calendars.CAL_SYNC3, Calendars.CAL_SYNC3);
+        sCalendarsProjectionMap.put(Calendars.CAL_SYNC4, Calendars.CAL_SYNC4);
+        sCalendarsProjectionMap.put(Calendars.CAL_SYNC5, Calendars.CAL_SYNC5);
+        sCalendarsProjectionMap.put(Calendars.CAL_SYNC6, Calendars.CAL_SYNC6);
+        sCalendarsProjectionMap.put(Calendars.CAL_SYNC7, Calendars.CAL_SYNC7);
+        sCalendarsProjectionMap.put(Calendars.CAL_SYNC8, Calendars.CAL_SYNC8);
+        sCalendarsProjectionMap.put(Calendars.CAL_SYNC9, Calendars.CAL_SYNC9);
+        sCalendarsProjectionMap.put(Calendars.CAL_SYNC10, Calendars.CAL_SYNC10);
+
         sEventsProjectionMap = new HashMap<String, String>();
         // Events columns
         sEventsProjectionMap.put(Events.ACCOUNT_NAME, Events.ACCOUNT_NAME);
@@ -4650,8 +4696,10 @@
         sEventsProjectionMap.put(Events.GUESTS_CAN_MODIFY, Events.GUESTS_CAN_MODIFY);
         sEventsProjectionMap.put(Events.GUESTS_CAN_SEE_GUESTS, Events.GUESTS_CAN_SEE_GUESTS);
         sEventsProjectionMap.put(Events.ORGANIZER, Events.ORGANIZER);
+        sEventsProjectionMap.put(Events.IS_ORGANIZER, Events.IS_ORGANIZER);
         sEventsProjectionMap.put(Events.CUSTOM_APP_PACKAGE, Events.CUSTOM_APP_PACKAGE);
         sEventsProjectionMap.put(Events.CUSTOM_APP_URI, Events.CUSTOM_APP_URI);
+        sEventsProjectionMap.put(Events.UID_2445, Events.UID_2445);
         sEventsProjectionMap.put(Events.DELETED, Events.DELETED);
         sEventsProjectionMap.put(Events._SYNC_ID, Events._SYNC_ID);
 
@@ -4741,8 +4789,10 @@
         sEventEntitiesProjectionMap.put(Events.GUESTS_CAN_MODIFY, Events.GUESTS_CAN_MODIFY);
         sEventEntitiesProjectionMap.put(Events.GUESTS_CAN_SEE_GUESTS, Events.GUESTS_CAN_SEE_GUESTS);
         sEventEntitiesProjectionMap.put(Events.ORGANIZER, Events.ORGANIZER);
+        sEventEntitiesProjectionMap.put(Events.IS_ORGANIZER, Events.IS_ORGANIZER);
         sEventEntitiesProjectionMap.put(Events.CUSTOM_APP_PACKAGE, Events.CUSTOM_APP_PACKAGE);
         sEventEntitiesProjectionMap.put(Events.CUSTOM_APP_URI, Events.CUSTOM_APP_URI);
+        sEventEntitiesProjectionMap.put(Events.UID_2445, Events.UID_2445);
         sEventEntitiesProjectionMap.put(Events.DELETED, Events.DELETED);
         sEventEntitiesProjectionMap.put(Events._ID, Events._ID);
         sEventEntitiesProjectionMap.put(Events._SYNC_ID, Events._SYNC_ID);
diff --git a/tests/src/com/android/providers/calendar/CalendarProvider2Test.java b/tests/src/com/android/providers/calendar/CalendarProvider2Test.java
index 764585a..5f2ebf4 100644
--- a/tests/src/com/android/providers/calendar/CalendarProvider2Test.java
+++ b/tests/src/com/android/providers/calendar/CalendarProvider2Test.java
@@ -502,6 +502,7 @@
         int mSyncId;
         String mCustomAppPackage;
         String mCustomAppUri;
+        String mUid2445;
 
         // Constructor for normal events, using the default timezone
         public EventInfo(String title, String startDate, String endDate,
@@ -534,6 +535,7 @@
             mAllDay = allDay;
             mCustomAppPackage = "CustomAppPackage-" + mTitle;
             mCustomAppUri = "CustomAppUri-" + mTitle;
+            mUid2445 = null;
         }
 
         // Constructor for repeating events, using the default timezone
@@ -582,22 +584,23 @@
         // Constructor for recurrence exceptions, using the default timezone
         public EventInfo(String originalTitle, String originalInstance, String title,
                 String description, String startDate, String endDate, boolean allDay,
-                String customPackageName, String customPackageUri) {
+                String customPackageName, String customPackageUri, String mUid2445) {
             init(originalTitle, originalInstance,
                     title, description, startDate, endDate, allDay, DEFAULT_TIMEZONE,
-                    customPackageName, customPackageUri);
+                    customPackageName, customPackageUri, mUid2445);
         }
 
         public void init(String originalTitle, String originalInstance,
                 String title, String description, String startDate, String endDate,
                 boolean allDay, String timezone, String customPackageName,
-                String customPackageUri) {
+                String customPackageUri, String uid2445) {
             mOriginalTitle = originalTitle;
             Time time = new Time(timezone);
             time.parse3339(originalInstance);
             mOriginalInstance = time.toMillis(false /* use isDst */);
             mCustomAppPackage = customPackageName;
             mCustomAppUri = customPackageUri;
+            mUid2445 = uid2445;
             init(title, description, startDate, endDate, null /* rrule */, allDay, timezone);
         }
     }
@@ -671,19 +674,24 @@
                     "FREQ=MONTHLY;WKST=SU;BYMONTHDAY=31", false),
             new EventInfo("daily0", "2008-05-01T00:00:00",
                     "except0", "daily0 exception for 5/1/2008 12am, change to 5/1/2008 2am to 3am",
-                    "2008-05-01T02:00:00", "2008-05-01T01:03:00", false, "AppPkg1", "AppUri1"),
+                    "2008-05-01T02:00:00", "2008-05-01T01:03:00", false, "AppPkg1", "AppUri1",
+                    "uid2445-1"),
             new EventInfo("daily0", "2008-05-03T00:00:00",
                     "except1", "daily0 exception for 5/3/2008 12am, change to 5/3/2008 2am to 3am",
-                    "2008-05-03T02:00:00", "2008-05-03T01:03:00", false, "AppPkg2", "AppUri2"),
+                    "2008-05-03T02:00:00", "2008-05-03T01:03:00", false, "AppPkg2", "AppUri2",
+                    null),
             new EventInfo("daily0", "2008-05-02T00:00:00",
                     "except2", "daily0 exception for 5/2/2008 12am, change to 1/2/2008",
-                    "2008-01-02T00:00:00", "2008-01-02T01:00:00", false, "AppPkg3", "AppUri3"),
+                    "2008-01-02T00:00:00", "2008-01-02T01:00:00", false, "AppPkg3", "AppUri3",
+                    "12345@uid2445"),
             new EventInfo("weekly0", "2008-05-13T13:00:00",
                     "except3", "daily0 exception for 5/11/2008 1pm, change to 12/11/2008 1pm",
-                    "2008-12-11T13:00:00", "2008-12-11T14:00:00", false, "AppPkg4", "AppUri4"),
+                    "2008-12-11T13:00:00", "2008-12-11T14:00:00", false, "AppPkg4", "AppUri4",
+                    null),
             new EventInfo("weekly0", "2008-05-13T13:00:00",
                     "cancel0", "weekly0 exception for 5/13/2008 1pm",
-                    "2008-05-13T13:00:00", "2008-05-13T14:00:00", false, "AppPkg5", "AppUri5"),
+                    "2008-05-13T13:00:00", "2008-05-13T14:00:00", false, "AppPkg5", "AppUri5",
+                    null),
             new EventInfo("yearly0", "yearly on 5/1/2008 from 1pm to 2pm",
                     "2008-05-01T13:00:00", "2008-05-01T14:00:00",
                     "FREQ=YEARLY;WKST=SU", false),
@@ -1184,6 +1192,9 @@
         if (event.mCustomAppUri != null) {
             m.put(Events.CUSTOM_APP_URI, event.mCustomAppUri);
         }
+        if (event.mUid2445 != null) {
+            m.put(Events.UID_2445, event.mUid2445);
+        }
 
         if (event.mOriginalTitle != null) {
             // This is a recurrence exception.
@@ -1939,7 +1950,7 @@
 
         assertEquals(0, deletes);
     }
-
+    
     public void testCalendarAlerts() throws Exception {
         // This projection is from AlertActivity; want to make sure it works.
         String[] projection = new String[] {
diff --git a/tests/src/com/android/providers/calendar/ICalendarTest.java b/tests/src/com/android/providers/calendar/ICalendarTest.java
index 4a740a9..28bc73b 100644
--- a/tests/src/com/android/providers/calendar/ICalendarTest.java
+++ b/tests/src/com/android/providers/calendar/ICalendarTest.java
@@ -1,7 +1,7 @@
 // Copyright 2007 The Android Open Source Project
 package com.android.providers.calendar;
 
-import com.android.calendarcommon.ICalendar;
+import com.android.calendarcommon2.ICalendar;
 
 import android.test.suitebuilder.annotation.SmallTest;
 import junit.framework.TestCase;
diff --git a/tests/src/com/android/providers/calendar/RecurrenceSetTest.java b/tests/src/com/android/providers/calendar/RecurrenceSetTest.java
index 2ce7167..f8b3704 100644
--- a/tests/src/com/android/providers/calendar/RecurrenceSetTest.java
+++ b/tests/src/com/android/providers/calendar/RecurrenceSetTest.java
@@ -16,8 +16,8 @@
 
 package com.android.providers.calendar;
 
-import com.android.calendarcommon.ICalendar;
-import com.android.calendarcommon.RecurrenceSet;
+import com.android.calendarcommon2.ICalendar;
+import com.android.calendarcommon2.RecurrenceSet;
 
 import android.content.ContentValues;
 import android.provider.CalendarContract;