Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1b1f349 authored by Daisuke Miyakawa's avatar Daisuke Miyakawa Committed by Android (Google) Code Review
Browse files

Merge "Make the app accept Contacts.CONTENT_URI without id"

parents c897f021 f0c4681e
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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" />
+11 −4
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.os.Bundle;
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 @@ public class ContactsIntentResolver {
                request.setSearchMode(true);
            }
        } else if (Intent.ACTION_VIEW.equals(action)) {
            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
+1 −0
Original line number Diff line number Diff line
@@ -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>
+5 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ public class AllIntentsActivity extends ListActivity
        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 @@ public class AllIntentsActivity extends ListActivity
                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);