Merge "Don't print out bundle in ContactEditorFragment"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index fc0036c..e6336bc 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -254,6 +254,13 @@
                 <data android:mimeType="vnd.android.cursor.dir/contact" />
             </intent-filter>
 
+            <intent-filter>
+                <action android:name="android.intent.action.VIEW" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <data android:mimeType="vnd.android.cursor.dir/person" />
+                <data android:mimeType="vnd.android.cursor.dir/contact" />
+            </intent-filter>
+
             <meta-data android:name="android.app.searchable"
                 android:resource="@xml/searchable"
             />
@@ -480,8 +487,6 @@
             <intent-filter android:label="@string/viewContactDesription">
                 <action android:name="android.intent.action.VIEW" />
                 <category android:name="android.intent.category.DEFAULT" />
-                <data android:mimeType="vnd.android.cursor.dir/person" />
-                <data android:mimeType="vnd.android.cursor.dir/contact" />
                 <data android:mimeType="vnd.android.cursor.item/person" />
                 <data android:mimeType="vnd.android.cursor.item/contact" />
                 <data android:mimeType="vnd.android.cursor.item/raw_contact" />
diff --git a/src/com/android/contacts/list/ContactsIntentResolver.java b/src/com/android/contacts/list/ContactsIntentResolver.java
index 63cadf1..a3fa7b0 100644
--- a/src/com/android/contacts/list/ContactsIntentResolver.java
+++ b/src/com/android/contacts/list/ContactsIntentResolver.java
@@ -27,6 +27,7 @@
 import android.provider.Contacts.ContactMethods;
 import android.provider.Contacts.People;
 import android.provider.Contacts.Phones;
+import android.provider.ContactsContract;
 import android.provider.ContactsContract.CommonDataKinds.Email;
 import android.provider.ContactsContract.CommonDataKinds.Phone;
 import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
@@ -145,10 +146,16 @@
                 request.setSearchMode(true);
             }
         } else if (Intent.ACTION_VIEW.equals(action)) {
-            request.setActionCode(ContactsRequest.ACTION_VIEW_CONTACT);
-            request.setContactUri(intent.getData());
-            intent.setAction(Intent.ACTION_DEFAULT);
-            intent.setData(null);
+            final String resolvedType = intent.resolveType(mContext);
+            if (ContactsContract.Contacts.CONTENT_TYPE.equals(resolvedType)
+                    || android.provider.Contacts.People.CONTENT_TYPE.equals(resolvedType)) {
+                request.setActionCode(ContactsRequest.ACTION_ALL_CONTACTS);
+            } else {
+                request.setActionCode(ContactsRequest.ACTION_VIEW_CONTACT);
+                request.setContactUri(intent.getData());
+                intent.setAction(Intent.ACTION_DEFAULT);
+                intent.setData(null);
+            }
         } else if (UI.FILTER_CONTACTS_ACTION.equals(action)) {
             // When we get a FILTER_CONTACTS_ACTION, it represents search in the context
             // of some other action. Let's retrieve the original action to provide proper
diff --git a/tests/res/values/donottranslate_strings.xml b/tests/res/values/donottranslate_strings.xml
index 194b6ca..27b9176 100644
--- a/tests/res/values/donottranslate_strings.xml
+++ b/tests/res/values/donottranslate_strings.xml
@@ -28,6 +28,7 @@
         <item>LIST_FREQUENT_ACTION</item>
         <item>LIST_STREQUENT_ACTION</item>
         <item>LIST_GROUP_ACTION</item>
+        <item>VIEW (content uri without any id)</item>
         <item>ACTION_PICK: contact</item>
         <item>ACTION_PICK: contact (legacy)</item>
         <item>ACTION_PICK: phone</item>
diff --git a/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java b/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java
index 97816c2..f624113 100644
--- a/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java
+++ b/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java
@@ -70,6 +70,7 @@
         LIST_FREQUENT_ACTION,
         LIST_STREQUENT_ACTION,
         LIST_GROUP_ACTION,
+        VIEW_CONTACT_WITHOUT_ID,
         ACTION_PICK_CONTACT,
         ACTION_PICK_CONTACT_LEGACY,
         ACTION_PICK_PHONE,
@@ -409,6 +410,10 @@
                 startActivity(intent);
                 break;
             }
+            case VIEW_CONTACT_WITHOUT_ID: {
+                startActivity(new Intent(Intent.ACTION_VIEW, Contacts.CONTENT_URI));
+                break;
+            }
             case VIEW_CONTACT_LOOKUP: {
                 final long contactId = findArbitraryContactWithPhoneNumber();
                 final Uri uri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);