Fixes following some breakage caused by CL 60952

Change-Id: Ia9fe3a477ab3e4e141773432a969d67168fd6155
diff --git a/src/com/android/providers/contacts/ContactAggregator.java b/src/com/android/providers/contacts/ContactAggregator.java
index 1f6bd40..c3abaa5 100644
--- a/src/com/android/providers/contacts/ContactAggregator.java
+++ b/src/com/android/providers/contacts/ContactAggregator.java
@@ -237,17 +237,17 @@
         final String replaceAggregatePresenceSql =
                 "INSERT OR REPLACE INTO " + Tables.AGGREGATED_PRESENCE + "("
                 + AggregatedPresenceColumns.CONTACT_ID + ", "
-                + StatusUpdates.STATUS + ", "
+                + StatusUpdates.PRESENCE + ", "
                 + StatusUpdates.CHAT_CAPABILITY + ")"
                 + " SELECT " + PresenceColumns.CONTACT_ID + ","
-                + StatusUpdates.STATUS + ","
+                + StatusUpdates.PRESENCE + ","
                 + StatusUpdates.CHAT_CAPABILITY
                 + " FROM " + Tables.PRESENCE
                 + " WHERE "
-                + " (" + StatusUpdates.STATUS
+                + " (" + StatusUpdates.PRESENCE
                 +       " * 10 + " + StatusUpdates.CHAT_CAPABILITY + ")"
                 + " = (SELECT "
-                + "MAX (" + StatusUpdates.STATUS
+                + "MAX (" + StatusUpdates.PRESENCE
                 +       " * 10 + " + StatusUpdates.CHAT_CAPABILITY + ")"
                 + " FROM " + Tables.PRESENCE
                 + " WHERE " + PresenceColumns.CONTACT_ID
@@ -1769,7 +1769,7 @@
         // Don't aggregate a contact with itself
         matcher.keepOut(contactId);
 
-        if (parameters.size() == 0) {
+        if (parameters == null || parameters.size() == 0) {
             final Cursor c = db.query(RawContactIdQuery.TABLE, RawContactIdQuery.COLUMNS,
                     RawContacts.CONTACT_ID + "=" + contactId, null, null, null, null);
             try {
@@ -1810,7 +1810,7 @@
                 updateMatchScoresBasedOnNameMatches(db, parameter.value, candidates, matcher);
             }
 
-            // TODO: add support for other
+            // TODO: add support for other parameter kinds
         }
     }
 }
diff --git a/src/com/android/providers/contacts/ContactsProvider2.java b/src/com/android/providers/contacts/ContactsProvider2.java
index 59b709b..7828a3a 100644
--- a/src/com/android/providers/contacts/ContactsProvider2.java
+++ b/src/com/android/providers/contacts/ContactsProvider2.java
@@ -5945,6 +5945,9 @@
             case AGGREGATION_SUGGESTIONS:
                 return sContactsProjectionMap.getColumnNames();
 
+            case CONTACTS_ID_ENTITIES:
+                return sEntityProjectionMap.getColumnNames();
+
             case CONTACTS_AS_VCARD:
             case CONTACTS_AS_MULTI_VCARD:
                 return sContactsVCardProjectionMap.getColumnNames();
diff --git a/tests/src/com/android/providers/contacts/ContactAggregatorTest.java b/tests/src/com/android/providers/contacts/ContactAggregatorTest.java
index 8f68ed9..00bd5d3 100644
--- a/tests/src/com/android/providers/contacts/ContactAggregatorTest.java
+++ b/tests/src/com/android/providers/contacts/ContactAggregatorTest.java
@@ -910,7 +910,7 @@
                 .addParameter(AggregationSuggestions.PARAMETER_MATCH_NICKNAME, "nickname1")
                 .setLimit(7)
                 .build();
-        assertEquals("content://com.android.contacts/contacts/-1/suggestions?"
+        assertEquals("content://com.android.contacts/contacts/0/suggestions?"
                 + "limit=7"
                 + "&query=name%3Aname1"
                 + "&query=name%3Aname2"
diff --git a/tests/src/com/android/providers/contacts/LegacyContactImporterPerformanceTest.java b/tests/src/com/android/providers/contacts/LegacyContactImporterPerformanceTest.java
index 3919770..50ba389 100644
--- a/tests/src/com/android/providers/contacts/LegacyContactImporterPerformanceTest.java
+++ b/tests/src/com/android/providers/contacts/LegacyContactImporterPerformanceTest.java
@@ -18,6 +18,7 @@
 
 import android.content.ContentProvider;
 import android.content.Context;
+import android.content.pm.ApplicationInfo;
 import android.content.res.Resources;
 import android.os.Debug;
 import android.provider.CallLog;
@@ -72,6 +73,13 @@
             public String getPackageName() {
                 return "no.package";
             }
+
+            @Override
+            public ApplicationInfo getApplicationInfo() {
+                ApplicationInfo ai = new ApplicationInfo();
+                ai.packageName = "contactsTestPackage";
+                return ai;
+            }
         };
         RenamingDelegatingContext targetContextWrapper = new RenamingDelegatingContext(context,
                 targetContext, "perf_imp.");