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

Commit a7dad42a authored by Walter Jang's avatar Walter Jang Committed by Android (Google) Code Review
Browse files

Merge "Revert "Handle group insert, view, and edit intents (1/2)"" into ub-contactsdialer-f-dev

parents c9545cb2 6bf93943
Loading
Loading
Loading
Loading
+1 −20
Original line number Original line Diff line number Diff line
@@ -138,12 +138,6 @@
                <data android:mimeType="vnd.android.cursor.dir/contact" />
                <data android:mimeType="vnd.android.cursor.dir/contact" />
            </intent-filter>
            </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"
            <meta-data android:name="android.app.searchable"
                android:resource="@xml/searchable"
                android:resource="@xml/searchable"
            />
            />
@@ -273,20 +267,7 @@


        <!-- Displays the members of a group in a list -->
        <!-- Displays the members of a group in a list -->
        <activity android:name=".activities.GroupMembersActivity"
        <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
        <activity
            android:name=".quickcontact.QuickContactActivity"
            android:name=".quickcontact.QuickContactActivity"
+1 −1
Original line number Original line Diff line number Diff line
@@ -426,7 +426,7 @@ public abstract class ContactsDrawerActivity extends AppCompatContactsActivity i
        }
        }
    }
    }


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


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


+18 −0
Original line number Original line Diff line number Diff line
@@ -49,6 +49,9 @@ import java.util.Set;
@NeededForTesting
@NeededForTesting
public final class GroupUtil {
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
    // System IDs of FFC groups in Google accounts
    private static final Set<String> FFC_GROUPS =
    private static final Set<String> FFC_GROUPS =
            new HashSet(Arrays.asList("Friends", "Family", "Coworkers"));
            new HashSet(Arrays.asList("Friends", "Family", "Coworkers"));
@@ -139,6 +142,21 @@ public final class GroupUtil {
        return intent;
        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
     * 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".
     * the group is one of "Friends", "Family" and "Coworkers".
+1 −3
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.contacts.list;
package com.android.contacts.list;


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