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

This reverts commit 01c2f7f2e324dbf7ce70229ecb29f9c33542be0e.

Change-Id: I161c7a2277979f281d7579894b8f64e918082e7f
diff --git a/src/com/android/contacts/ContactsDrawerActivity.java b/src/com/android/contacts/ContactsDrawerActivity.java
index a12d0e1..b62d5e6 100644
--- a/src/com/android/contacts/ContactsDrawerActivity.java
+++ b/src/com/android/contacts/ContactsDrawerActivity.java
@@ -426,7 +426,7 @@
         }
     }
 
-    protected void onCreateGroupMenuItemClicked() {
+    private void onCreateGroupMenuItemClicked() {
         // Select the account to create the group
         final Bundle extras = getIntent().getExtras();
         final Account account = extras == null ? null :
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index 756aeb4..8429d2a 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -281,18 +281,12 @@
             return false;
         }
 
-        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;
-            }
+        if (mRequest.getActionCode() == 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;
         }
         return true;
     }
diff --git a/src/com/android/contacts/group/GroupUtil.java b/src/com/android/contacts/group/GroupUtil.java
index 41dfa8c..beba2ea 100644
--- a/src/com/android/contacts/group/GroupUtil.java
+++ b/src/com/android/contacts/group/GroupUtil.java
@@ -49,6 +49,9 @@
 @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"));
@@ -140,6 +143,21 @@
     }
 
     /**
+     * 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".
      */
diff --git a/src/com/android/contacts/list/ContactsIntentResolver.java b/src/com/android/contacts/list/ContactsIntentResolver.java
index 800ed11..39eaeba 100644
--- a/src/com/android/contacts/list/ContactsIntentResolver.java
+++ b/src/com/android/contacts/list/ContactsIntentResolver.java
@@ -16,6 +16,7 @@
 
 package com.android.contacts.list;
 
+import android.accounts.Account;
 import android.app.Activity;
 import android.app.SearchManager;
 import android.content.Intent;
@@ -130,9 +131,6 @@
             }
         } 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
diff --git a/src/com/android/contacts/list/ContactsRequest.java b/src/com/android/contacts/list/ContactsRequest.java
index e9b3a86..615fac6 100644
--- a/src/com/android/contacts/list/ContactsRequest.java
+++ b/src/com/android/contacts/list/ContactsRequest.java
@@ -42,9 +42,6 @@
     /** Show potential new members of a specific group */
     public static final int ACTION_PICK_GROUP_MEMBERS = 21;
 
-    /** Create a new group */
-    public static final int ACTION_INSERT_GROUP = 22;
-
     /** Show all starred contacts */
     public static final int ACTION_STARRED = 30;