Merge "Adding day group headings in the call log which group call log entries under 4 headings, "Today", "Yesterday", "Last week", "Other"."
diff --git a/src/com/android/contacts/common/CallUtil.java b/src/com/android/contacts/common/CallUtil.java
index 87b8f83..f62d8ff 100644
--- a/src/com/android/contacts/common/CallUtil.java
+++ b/src/com/android/contacts/common/CallUtil.java
@@ -34,9 +34,6 @@
     public static final String SCHEME_IMTO = "imto";
     public static final String SCHEME_SIP = "sip";
 
-    public static final ComponentName CALL_INTENT_DESTINATION = new ComponentName(
-            "com.android.phone", "com.android.phone.PrivilegedOutgoingCallBroadcaster");
-
     /**
      * Return an Intent for making a phone call. Scheme (e.g. tel, sip) will be determined
      * automatically.
@@ -72,11 +69,6 @@
             intent.putExtra(PhoneConstants.EXTRA_CALL_ORIGIN, callOrigin);
         }
 
-        // Set phone as an explicit component of CALL_PRIVILEGED intent.
-        // Setting destination explicitly prevents other apps from capturing this Intent since,
-        // unlike SendBroadcast, there is no API for specifying a permission on startActivity.
-        intent.setComponent(CALL_INTENT_DESTINATION);
-
         return intent;
     }
 
diff --git a/src/com/android/contacts/common/model/account/ExternalAccountType.java b/src/com/android/contacts/common/model/account/ExternalAccountType.java
index 0097592..e4cef52 100644
--- a/src/com/android/contacts/common/model/account/ExternalAccountType.java
+++ b/src/com/android/contacts/common/model/account/ExternalAccountType.java
@@ -48,7 +48,17 @@
 public class ExternalAccountType extends BaseAccountType {
     private static final String TAG = "ExternalAccountType";
 
-    private static final String METADATA_CONTACTS = "android.provider.CONTACTS_STRUCTURE";
+    /**
+     * The metadata name for so-called "contacts.xml".
+     *
+     * On LMP and later, we also accept the "alternate" name.
+     * This is to allow sync adapters to have a contacts.xml without making it visible on older
+     * platforms.
+     */
+    private static final String[] METADATA_CONTACTS_NAMES = new String[] {
+            "android.provider.ALTERNATE_CONTACTS_STRUCTURE",
+            "android.provider.CONTACTS_STRUCTURE"
+    };
 
     private static final String TAG_CONTACTS_SOURCE_LEGACY = "ContactsSource";
     private static final String TAG_CONTACTS_ACCOUNT_TYPE = "ContactsAccountType";
@@ -187,10 +197,17 @@
         PackageInfo packageInfo = pm.getPackageInfo(resPackageName,
                 PackageManager.GET_SERVICES|PackageManager.GET_META_DATA);
         for (ServiceInfo serviceInfo : packageInfo.services) {
-            final XmlResourceParser parser = serviceInfo.loadXmlMetaData(pm,
-                    METADATA_CONTACTS);
-            if (parser != null) {
-                return parser;
+            for (String metadataName : METADATA_CONTACTS_NAMES) {
+                final XmlResourceParser parser = serviceInfo.loadXmlMetaData(pm,
+                        metadataName);
+                if (parser != null) {
+                    if (Log.isLoggable(TAG, Log.DEBUG)) {
+                        Log.d(TAG, String.format("Metadata loaded from: %s, %s, %s",
+                                serviceInfo.packageName, serviceInfo.name,
+                                metadataName));
+                    }
+                    return parser;
+                }
             }
         }
         // Package was found, but that doesn't contain the CONTACTS_STRUCTURE metadata.