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

Commit d444d06e authored by Walter Jang's avatar Walter Jang Committed by android-build-merger
Browse files

Revert \"Revert \"Handle group insert, view, and edit intents (1/2)\"\"

am: 1110d678

Change-Id: I17b356a83fbf94318c9c622e68e55796d8368c5b
parents 783e6e5d 1110d678
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -138,6 +138,12 @@
                <data android:mimeType="vnd.android.cursor.dir/contact" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.INSERT" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.dir/group" />
            </intent-filter>

            <meta-data android:name="android.app.searchable"
                android:resource="@xml/searchable"
            />
@@ -173,6 +179,7 @@
                <data android:mimeType="vnd.android.cursor.dir/postal-address_v2" />
                <data android:mimeType="vnd.android.cursor.dir/postal-address" />
                <data android:mimeType="vnd.android.cursor.dir/email_v2" />
                <data android:mimeType="vnd.android.cursor.dir/group"/>
            </intent-filter>

            <intent-filter>
@@ -267,7 +274,20 @@

        <!-- Displays the members of a group in a list -->
        <activity android:name=".activities.GroupMembersActivity"
            android:theme="@style/PeopleActivityTheme"/>
            android:theme="@style/PeopleActivityTheme">

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/group" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.EDIT" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/group" />
            </intent-filter>
        </activity>

        <activity
            android:name=".quickcontact.QuickContactActivity"
+1 −1
Original line number Diff line number Diff line
@@ -426,7 +426,7 @@ public abstract class ContactsDrawerActivity extends AppCompatContactsActivity i
        }
    }

    private void onCreateGroupMenuItemClicked() {
    protected void onCreateGroupMenuItemClicked() {
        // Select the account to create the group
        final Bundle extras = getIntent().getExtras();
        final Account account = extras == null ? null :
+12 −6
Original line number Diff line number Diff line
@@ -284,13 +284,19 @@ public class PeopleActivity extends ContactsDrawerActivity implements
            return false;
        }

        if (mRequest.getActionCode() == ContactsRequest.ACTION_VIEW_CONTACT) {
        switch (mRequest.getActionCode()) {
            case ContactsRequest.ACTION_VIEW_CONTACT: {
                final Intent intent = ImplicitIntentsUtil.composeQuickContactIntent(
                        mRequest.getContactUri(), QuickContactActivity.MODE_FULLY_EXPANDED);
                intent.putExtra(QuickContactActivity.EXTRA_PREVIOUS_SCREEN_TYPE, ScreenType.UNKNOWN);
                ImplicitIntentsUtil.startActivityInApp(this, intent);
                return false;
            }
            case ContactsRequest.ACTION_INSERT_GROUP: {
                onCreateGroupMenuItemClicked();
                return true;
            }
        }
        return true;
    }

+1 −19
Original line number Diff line number Diff line
@@ -49,9 +49,6 @@ import java.util.Set;
@NeededForTesting
public final class GroupUtil {

    private static final String LEGACY_CONTACTS_AUTHORITY = "contacts";
    private static final String LEGACY_CONTACTS_URI = "content://contacts/groups";

    // System IDs of FFC groups in Google accounts
    private static final Set<String> FFC_GROUPS =
            new HashSet(Arrays.asList("Friends", "Family", "Coworkers"));
@@ -134,7 +131,7 @@ public final class GroupUtil {
    public static Intent createPickMemberIntent(
            GroupMetadata groupMetadata, ArrayList<String> memberContactIds) {
        final Intent intent = new Intent(Intent.ACTION_PICK);
        intent.setType(Groups.CONTENT_ITEM_TYPE);
        intent.setType(Groups.CONTENT_TYPE);
        intent.putExtra(UiIntentActions.GROUP_ACCOUNT_NAME, groupMetadata.accountName);
        intent.putExtra(UiIntentActions.GROUP_ACCOUNT_TYPE, groupMetadata.accountType);
        intent.putExtra(UiIntentActions.GROUP_ACCOUNT_DATA_SET, groupMetadata.dataSet);
@@ -142,21 +139,6 @@ public final class GroupUtil {
        return intent;
    }

    /**
     * Converts the given group Uri to the legacy format if the legacy authority was specified
     * in the given Uri.
     */
    // TODO(wjang):
    public static Uri maybeConvertToLegacyUri(Uri groupUri) {
        final String requestAuthority = groupUri.getAuthority();
        if (!LEGACY_CONTACTS_AUTHORITY.equals(requestAuthority)) {
            return groupUri;
        }
        final long groupId = ContentUris.parseId(groupUri);
        final Uri legacyContentUri = Uri.parse(LEGACY_CONTACTS_URI);
        return ContentUris.withAppendedId(legacyContentUri, groupId);
    }

    /**
     * Returns true if it's an empty and read-only group of a Google account and the system ID of
     * the group is one of "Friends", "Family" and "Coworkers".
+3 −1
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.contacts.list;

import android.accounts.Account;
import android.app.Activity;
import android.app.SearchManager;
import android.content.Intent;
@@ -131,6 +130,9 @@ public class ContactsIntentResolver {
            }
        } else if (Intent.ACTION_INSERT_OR_EDIT.equals(action)) {
            request.setActionCode(ContactsRequest.ACTION_INSERT_OR_EDIT_CONTACT);
        } else if (Intent.ACTION_INSERT.equals(action) &&
                Groups.CONTENT_TYPE.equals(intent.getType())) {
            request.setActionCode(ContactsRequest.ACTION_INSERT_GROUP);
        } else if (Intent.ACTION_SEARCH.equals(action)) {
            String query = intent.getStringExtra(SearchManager.QUERY);
            // If the {@link SearchManager.QUERY} is empty, then check if a phone number
Loading