Finish current group activity after creating new groups

Bug 30047708

Change-Id: I70aca1320dfb8a44d1a140d154a6f172ab438315
diff --git a/src/com/android/contacts/ContactsDrawerActivity.java b/src/com/android/contacts/ContactsDrawerActivity.java
index 4254a64..e4f8010 100644
--- a/src/com/android/contacts/ContactsDrawerActivity.java
+++ b/src/com/android/contacts/ContactsDrawerActivity.java
@@ -245,6 +245,13 @@
             if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "Received group URI " + groupUri);
             Toast.makeText(this, R.string.groupCreatedToast, Toast.LENGTH_SHORT).show();
             startActivity(GroupUtil.createViewGroupIntent(this, groupUri, /* title */ null));
+            if (this instanceof GroupMembersActivity) {
+                // If we created a group while viewing the members of an existing group (i.e.
+                // while on GroupMembersActivity), finish the current GroupMembersActivity so that
+                // hitting back from the new GroupMembersActivity that was just stared will open
+                // the all contacts list. See b/30047708.
+                finish();
+            }
         } else {
             super.onNewIntent(newIntent);
         }