diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index c5811ec..3ebfe3c 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -210,7 +210,12 @@
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.TAB" />
             </intent-filter>
-
+        </activity>
+        
+        <activity android:name=".activities.ContactSelectionActivity"
+            android:label="@string/contactsList"
+            android:clearTaskOnLaunch="true"
+        >
             <intent-filter>
                 <action android:name="android.intent.action.INSERT_OR_EDIT" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -329,7 +334,7 @@
         </activity>
 
         <activity-alias android:name="ContactShortcut"
-            android:targetActivity="ContactsListActivity"
+            android:targetActivity=".activities.ContactSelectionActivity"
             android:label="@string/shortcutContact"
             android:icon="@drawable/ic_launcher_shortcut_contact">
 
@@ -341,7 +346,7 @@
         </activity-alias>
 
         <activity-alias android:name="alias.DialShortcut"
-            android:targetActivity="ContactsListActivity"
+            android:targetActivity=".activities.ContactSelectionActivity"
             android:label="@string/shortcutDialContact"
             android:icon="@drawable/ic_launcher_shortcut_directdial">
 
@@ -354,7 +359,7 @@
         </activity-alias>
 
         <activity-alias android:name="alias.MessageShortcut"
-            android:targetActivity="ContactsListActivity"
+            android:targetActivity=".activities.ContactSelectionActivity"
             android:label="@string/shortcutMessageContact"
             android:icon="@drawable/ic_launcher_shortcut_directmessage">
 
@@ -450,10 +455,10 @@
             android:theme="@android:style/Theme.Translucent">
         </activity>
 
-        <!-- Makes .ContactsListActivity the search target for any activity in Contacts -->
+        <!-- Makes .ContactListActivity the search target for any activity in Contacts -->
         <meta-data
             android:name="android.app.default_searchable"
-            android:value=".ContactsListActivity" />
+            android:value=".activities.ContactListActivity" />
 
 
         <!-- LIVE FOLDERS -->
diff --git a/src/com/android/contacts/activities/ContactListActivity.java b/src/com/android/contacts/activities/ContactListActivity.java
index 234d8d9..ef831f0 100644
--- a/src/com/android/contacts/activities/ContactListActivity.java
+++ b/src/com/android/contacts/activities/ContactListActivity.java
@@ -22,16 +22,10 @@
 import com.android.contacts.interactions.PhoneNumberInteraction;
 import com.android.contacts.list.ContactBrowseListContextMenuAdapter;
 import com.android.contacts.list.ContactEntryListFragment;
-import com.android.contacts.list.ContactPickerFragment;
 import com.android.contacts.list.ContactsIntentResolver;
 import com.android.contacts.list.ContactsRequest;
 import com.android.contacts.list.DefaultContactBrowseListFragment;
 import com.android.contacts.list.OnContactBrowserActionListener;
-import com.android.contacts.list.OnContactPickerActionListener;
-import com.android.contacts.list.OnPhoneNumberPickerActionListener;
-import com.android.contacts.list.OnPostalAddressPickerActionListener;
-import com.android.contacts.list.PhoneNumberPickerFragment;
-import com.android.contacts.list.PostalAddressPickerFragment;
 import com.android.contacts.list.StrequentContactListFragment;
 import com.android.contacts.ui.ContactsPreferencesActivity;
 import com.android.contacts.views.detail.ContactDetailFragment;
@@ -64,7 +58,7 @@
  */
 public class ContactListActivity extends Activity implements View.OnCreateContextMenuListener {
 
-    private static final String TAG = "ContactsListActivity";
+    private static final String TAG = "ContactListActivity";
 
     private static final int SUBACTIVITY_NEW_CONTACT = 1;
     private static final int SUBACTIVITY_VIEW_CONTACT = 2;
@@ -233,20 +227,11 @@
     private void onCreateFragment() {
         mActionCode = mRequest.getActionCode();
         switch (mActionCode) {
-            case ContactsRequest.ACTION_DEFAULT:
-            case ContactsRequest.ACTION_INSERT_OR_EDIT_CONTACT: {
+            case ContactsRequest.ACTION_DEFAULT: {
                 DefaultContactBrowseListFragment fragment = new DefaultContactBrowseListFragment();
                 fragment.setOnContactListActionListener(new ContactBrowserActionListener());
-
-                if (mActionCode == ContactsRequest.ACTION_INSERT_OR_EDIT_CONTACT) {
-                    fragment.setEditMode(true);
-                    fragment.setCreateContactEnabled(true);
-                }
-
                 fragment.setDisplayWithPhonesOnlyOption(mRequest.getDisplayWithPhonesOnlyOption());
-
                 fragment.setVisibleContactsRestrictionEnabled(mRequest.getDisplayOnlyVisible());
-
                 fragment.setContextMenuAdapter(new ContactBrowseListContextMenuAdapter(fragment));
                 fragment.setSearchMode(mRequest.isSearchMode());
                 fragment.setQueryString(mRequest.getQueryString());
@@ -286,79 +271,6 @@
                 break;
             }
 
-            case ContactsRequest.ACTION_PICK_CONTACT: {
-                ContactPickerFragment fragment = new ContactPickerFragment();
-                fragment.setOnContactPickerActionListener(new ContactPickerActionListener());
-                fragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
-                fragment.setSearchMode(mRequest.isSearchMode());
-                mListFragment = fragment;
-                break;
-            }
-
-            case ContactsRequest.ACTION_PICK_OR_CREATE_CONTACT: {
-                ContactPickerFragment fragment = new ContactPickerFragment();
-                fragment.setOnContactPickerActionListener(new ContactPickerActionListener());
-                fragment.setCreateContactEnabled(!mRequest.isSearchMode());
-                fragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
-                mListFragment = fragment;
-                break;
-            }
-
-            case ContactsRequest.ACTION_CREATE_SHORTCUT_CONTACT: {
-                ContactPickerFragment fragment = new ContactPickerFragment();
-                fragment.setOnContactPickerActionListener(new ContactPickerActionListener());
-                fragment.setCreateContactEnabled(!mRequest.isSearchMode());
-                fragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
-                fragment.setSearchMode(mRequest.isSearchMode());
-                fragment.setQueryString(mRequest.getQueryString());
-                fragment.setDirectorySearchEnabled(mRequest.isDirectorySearchEnabled());
-                fragment.setShortcutRequested(true);
-                mListFragment = fragment;
-                break;
-            }
-
-            case ContactsRequest.ACTION_PICK_PHONE: {
-                PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
-                fragment.setOnPhoneNumberPickerActionListener(
-                        new PhoneNumberPickerActionListener());
-                fragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
-                mListFragment = fragment;
-                break;
-            }
-
-            case ContactsRequest.ACTION_CREATE_SHORTCUT_CALL: {
-                PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
-                fragment.setOnPhoneNumberPickerActionListener(
-                        new PhoneNumberPickerActionListener());
-                fragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
-                fragment.setShortcutAction(Intent.ACTION_CALL);
-                fragment.setSearchMode(mRequest.isSearchMode());
-
-                mListFragment = fragment;
-                break;
-            }
-
-            case ContactsRequest.ACTION_CREATE_SHORTCUT_SMS: {
-                PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
-                fragment.setOnPhoneNumberPickerActionListener(
-                        new PhoneNumberPickerActionListener());
-                fragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
-                fragment.setShortcutAction(Intent.ACTION_SENDTO);
-                fragment.setSearchMode(mRequest.isSearchMode());
-
-                mListFragment = fragment;
-                break;
-            }
-
-            case ContactsRequest.ACTION_PICK_POSTAL: {
-                PostalAddressPickerFragment fragment = new PostalAddressPickerFragment();
-                fragment.setOnPostalAddressPickerActionListener(
-                        new PostalAddressPickerActionListener());
-                fragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
-                mListFragment = fragment;
-                break;
-            }
-
             default:
                 throw new IllegalStateException("Invalid action code: " + mActionCode);
         }
@@ -422,47 +334,6 @@
         }
     }
 
-    private final class ContactPickerActionListener implements OnContactPickerActionListener {
-        public void onCreateNewContactAction() {
-            Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
-            startActivityAndForwardResult(intent);
-        }
-
-        public void onPickContactAction(Uri contactUri) {
-            Intent intent = new Intent();
-            setResult(RESULT_OK, intent.setData(contactUri));
-            finish();
-        }
-
-        public void onShortcutIntentCreated(Intent intent) {
-            setResult(RESULT_OK, intent);
-            finish();
-        }
-    }
-
-    private final class PhoneNumberPickerActionListener implements
-            OnPhoneNumberPickerActionListener {
-        public void onPickPhoneNumberAction(Uri dataUri) {
-            Intent intent = new Intent();
-            setResult(RESULT_OK, intent.setData(dataUri));
-            finish();
-        }
-
-        public void onShortcutIntentCreated(Intent intent) {
-            setResult(RESULT_OK, intent);
-            finish();
-        }
-    }
-
-    private final class PostalAddressPickerActionListener implements
-            OnPostalAddressPickerActionListener {
-        public void onPickPostalAddressAction(Uri dataUri) {
-            Intent intent = new Intent();
-            setResult(RESULT_OK, intent.setData(dataUri));
-            finish();
-        }
-    }
-
     private class DetailFragmentListener implements ContactDetailFragment.Listener {
         public void onContactNotFound() {
             Toast.makeText(ContactListActivity.this, "onContactNotFound", Toast.LENGTH_LONG).show();
diff --git a/src/com/android/contacts/activities/ContactSelectionActivity.java b/src/com/android/contacts/activities/ContactSelectionActivity.java
new file mode 100644
index 0000000..55d225a
--- /dev/null
+++ b/src/com/android/contacts/activities/ContactSelectionActivity.java
@@ -0,0 +1,473 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.contacts.activities;
+
+import com.android.contacts.R;
+import com.android.contacts.list.ContactEntryListFragment;
+import com.android.contacts.list.ContactPickerFragment;
+import com.android.contacts.list.ContactsIntentResolver;
+import com.android.contacts.list.ContactsRequest;
+import com.android.contacts.list.DefaultContactBrowseListFragment;
+import com.android.contacts.list.OnContactBrowserActionListener;
+import com.android.contacts.list.OnContactPickerActionListener;
+import com.android.contacts.list.OnPhoneNumberPickerActionListener;
+import com.android.contacts.list.OnPostalAddressPickerActionListener;
+import com.android.contacts.list.PhoneNumberPickerFragment;
+import com.android.contacts.list.PostalAddressPickerFragment;
+import com.android.contacts.widget.ContextMenuAdapter;
+import com.android.contacts.widget.SearchEditText;
+import com.android.contacts.widget.SearchEditText.OnFilterTextListener;
+
+import android.app.Activity;
+import android.app.FragmentTransaction;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.ContactsContract.Contacts;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+
+/**
+ * Displays a list of contacts (or phone numbers or postal addresses) for the
+ * purposes of selecting one.
+ */
+public class ContactSelectionActivity extends Activity implements View.OnCreateContextMenuListener {
+
+    private static final String TAG = "ContactSelectionActivity";
+
+    private static final int SUBACTIVITY_NEW_CONTACT = 1;
+    private static final int SUBACTIVITY_VIEW_CONTACT = 2;
+    private static final int SUBACTIVITY_DISPLAY_GROUP = 3;
+    private static final int SUBACTIVITY_SEARCH = 4;
+
+    private ContactsIntentResolver mIntentResolver;
+    protected ContactEntryListFragment<?> mListFragment;
+
+    private int mActionCode;
+
+    private boolean mSearchInitiated;
+
+    private ContactsRequest mRequest;
+    private SearchEditText mSearchEditText;
+
+    public ContactSelectionActivity() {
+        mIntentResolver = new ContactsIntentResolver(this);
+    }
+
+    @Override
+    protected void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+
+        // Extract relevant information from the intent
+        mRequest = mIntentResolver.resolveIntent(getIntent());
+        if (!mRequest.isValid()) {
+            setResult(RESULT_CANCELED);
+            finish();
+            return;
+        }
+
+        Intent redirect = mRequest.getRedirectIntent();
+        if (redirect != null) {
+            // Need to start a different activity
+            startActivity(redirect);
+            finish();
+            return;
+        }
+
+        setTitle(mRequest.getActivityTitle());
+
+        onCreateFragment();
+
+        int listFragmentContainerId;
+        if (mRequest.isSearchMode()) {
+            setContentView(R.layout.contacts_search_content);
+            listFragmentContainerId = R.id.list_container;
+            setupSearchUI();
+        } else {
+            listFragmentContainerId = android.R.id.content;
+        }
+
+        FragmentTransaction transaction = openFragmentTransaction();
+        transaction.add(listFragmentContainerId, mListFragment);
+        transaction.commit();
+    }
+
+    private void setupSearchUI() {
+        mSearchEditText = (SearchEditText)findViewById(R.id.search_src_text);
+        mSearchEditText.setText(mRequest.getQueryString());
+        mSearchEditText.setOnFilterTextListener(new OnFilterTextListener() {
+            public void onFilterChange(String queryString) {
+                mListFragment.setQueryString(queryString);
+            }
+
+            public void onCancelSearch() {
+                finish();
+            }
+        });
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        if (mRequest.isSearchMode()) {
+            mSearchEditText.requestFocus();
+        }
+    }
+
+    /**
+     * Creates the fragment based on the current request.
+     */
+    private void onCreateFragment() {
+        mActionCode = mRequest.getActionCode();
+        switch (mActionCode) {
+            case ContactsRequest.ACTION_INSERT_OR_EDIT_CONTACT: {
+                DefaultContactBrowseListFragment fragment = new DefaultContactBrowseListFragment();
+                fragment.setOnContactListActionListener(new ContactBrowserActionListener());
+                fragment.setEditMode(true);
+                fragment.setCreateContactEnabled(true);
+                fragment.setDisplayWithPhonesOnlyOption(mRequest.getDisplayWithPhonesOnlyOption());
+                fragment.setVisibleContactsRestrictionEnabled(mRequest.getDisplayOnlyVisible());
+                fragment.setSearchMode(mRequest.isSearchMode());
+                fragment.setQueryString(mRequest.getQueryString());
+                fragment.setDirectorySearchEnabled(false);
+                mListFragment = fragment;
+                break;
+            }
+
+            case ContactsRequest.ACTION_PICK_CONTACT: {
+                ContactPickerFragment fragment = new ContactPickerFragment();
+                fragment.setOnContactPickerActionListener(new ContactPickerActionListener());
+                fragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
+                fragment.setSearchMode(mRequest.isSearchMode());
+                mListFragment = fragment;
+                break;
+            }
+
+            case ContactsRequest.ACTION_PICK_OR_CREATE_CONTACT: {
+                ContactPickerFragment fragment = new ContactPickerFragment();
+                fragment.setOnContactPickerActionListener(new ContactPickerActionListener());
+                fragment.setCreateContactEnabled(!mRequest.isSearchMode());
+                fragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
+                mListFragment = fragment;
+                break;
+            }
+
+            case ContactsRequest.ACTION_CREATE_SHORTCUT_CONTACT: {
+                ContactPickerFragment fragment = new ContactPickerFragment();
+                fragment.setOnContactPickerActionListener(new ContactPickerActionListener());
+                fragment.setCreateContactEnabled(!mRequest.isSearchMode());
+                fragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
+                fragment.setSearchMode(mRequest.isSearchMode());
+                fragment.setQueryString(mRequest.getQueryString());
+                fragment.setDirectorySearchEnabled(mRequest.isDirectorySearchEnabled());
+                fragment.setShortcutRequested(true);
+                mListFragment = fragment;
+                break;
+            }
+
+            case ContactsRequest.ACTION_PICK_PHONE: {
+                PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
+                fragment.setOnPhoneNumberPickerActionListener(
+                        new PhoneNumberPickerActionListener());
+                fragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
+                mListFragment = fragment;
+                break;
+            }
+
+            case ContactsRequest.ACTION_CREATE_SHORTCUT_CALL: {
+                PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
+                fragment.setOnPhoneNumberPickerActionListener(
+                        new PhoneNumberPickerActionListener());
+                fragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
+                fragment.setShortcutAction(Intent.ACTION_CALL);
+                fragment.setSearchMode(mRequest.isSearchMode());
+
+                mListFragment = fragment;
+                break;
+            }
+
+            case ContactsRequest.ACTION_CREATE_SHORTCUT_SMS: {
+                PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
+                fragment.setOnPhoneNumberPickerActionListener(
+                        new PhoneNumberPickerActionListener());
+                fragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
+                fragment.setShortcutAction(Intent.ACTION_SENDTO);
+                fragment.setSearchMode(mRequest.isSearchMode());
+
+                mListFragment = fragment;
+                break;
+            }
+
+            case ContactsRequest.ACTION_PICK_POSTAL: {
+                PostalAddressPickerFragment fragment = new PostalAddressPickerFragment();
+                fragment.setOnPostalAddressPickerActionListener(
+                        new PostalAddressPickerActionListener());
+                fragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
+                mListFragment = fragment;
+                break;
+            }
+
+            default:
+                throw new IllegalStateException("Invalid action code: " + mActionCode);
+        }
+        mListFragment.setContactsRequest(mRequest);
+    }
+
+    private final class ContactBrowserActionListener implements OnContactBrowserActionListener {
+        public void onViewContactAction(Uri contactLookupUri) {
+            throw new UnsupportedOperationException();
+        }
+
+        public void onCreateNewContactAction() {
+            Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+            Bundle extras = getIntent().getExtras();
+            if (extras != null) {
+                intent.putExtras(extras);
+            }
+            startActivity(intent);
+        }
+
+        public void onEditContactAction(Uri contactLookupUri) {
+            Intent intent = new Intent(Intent.ACTION_EDIT, contactLookupUri);
+            Bundle extras = getIntent().getExtras();
+            if (extras != null) {
+                intent.putExtras(extras);
+            }
+            startActivity(intent);
+        }
+
+        public void onAddToFavoritesAction(Uri contactUri) {
+            throw new UnsupportedOperationException();
+        }
+
+        public void onRemoveFromFavoritesAction(Uri contactUri) {
+            throw new UnsupportedOperationException();
+        }
+
+        public void onCallContactAction(Uri contactUri) {
+            throw new UnsupportedOperationException();
+        }
+
+        public void onSmsContactAction(Uri contactUri) {
+            throw new UnsupportedOperationException();
+        }
+
+        public void onDeleteContactAction(Uri contactUri) {
+            throw new UnsupportedOperationException();
+        }
+
+        public void onFinishAction() {
+            onBackPressed();
+        }
+    }
+
+    private final class ContactPickerActionListener implements OnContactPickerActionListener {
+        public void onCreateNewContactAction() {
+            Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+            startActivityAndForwardResult(intent);
+        }
+
+        public void onPickContactAction(Uri contactUri) {
+            Intent intent = new Intent();
+            setResult(RESULT_OK, intent.setData(contactUri));
+            finish();
+        }
+
+        public void onShortcutIntentCreated(Intent intent) {
+            setResult(RESULT_OK, intent);
+            finish();
+        }
+    }
+
+    private final class PhoneNumberPickerActionListener implements
+            OnPhoneNumberPickerActionListener {
+        public void onPickPhoneNumberAction(Uri dataUri) {
+            Intent intent = new Intent();
+            setResult(RESULT_OK, intent.setData(dataUri));
+            finish();
+        }
+
+        public void onShortcutIntentCreated(Intent intent) {
+            setResult(RESULT_OK, intent);
+            finish();
+        }
+    }
+
+    private final class PostalAddressPickerActionListener implements
+            OnPostalAddressPickerActionListener {
+        public void onPickPostalAddressAction(Uri dataUri) {
+            Intent intent = new Intent();
+            setResult(RESULT_OK, intent.setData(dataUri));
+            finish();
+        }
+    }
+
+    public void startActivityAndForwardResult(final Intent intent) {
+        intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+
+        // Forward extras to the new activity
+        Bundle extras = getIntent().getExtras();
+        if (extras != null) {
+            intent.putExtras(extras);
+        }
+        startActivity(intent);
+        finish();
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        super.onCreateOptionsMenu(menu);
+
+        MenuInflater inflater = getMenuInflater();
+        if (!mListFragment.isSearchMode()) {
+            inflater.inflate(R.menu.search, menu);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case R.id.menu_search: {
+                onSearchRequested();
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
+            boolean globalSearch) {
+// TODO
+//        if (mProviderStatus != ProviderStatus.STATUS_NORMAL) {
+//            return;
+//        }
+
+        if (globalSearch) {
+            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
+        } else {
+            mListFragment.startSearch(initialQuery);
+        }
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        switch (requestCode) {
+//            case SUBACTIVITY_NEW_CONTACT:
+//                if (resultCode == RESULT_OK) {
+//                    returnPickerResult(null, data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME),
+//                            data.getData());
+//                    setRe
+//                }
+//                break;
+
+//            case SUBACTIVITY_VIEW_CONTACT:
+//                if (resultCode == RESULT_OK) {
+//                    mAdapter.notifyDataSetChanged();
+//                }
+//                break;
+//
+//            case SUBACTIVITY_DISPLAY_GROUP:
+//                // Mark as just created so we re-run the view query
+////                mJustCreated = true;
+//                break;
+//
+            case ContactEntryListFragment.ACTIVITY_REQUEST_CODE_PICKER:
+                if (resultCode == RESULT_OK) {
+                    mListFragment.onPickerResult(data);
+                }
+
+// TODO fix or remove multipicker code
+//                else if (resultCode == RESULT_CANCELED && mMode == MODE_PICK_MULTIPLE_PHONES) {
+//                    // Finish the activity if the sub activity was canceled as back key is used
+//                    // to confirm user selection in MODE_PICK_MULTIPLE_PHONES.
+//                    finish();
+//                }
+//                break;
+        }
+    }
+
+    @Override
+    public boolean onContextItemSelected(MenuItem item) {
+        ContextMenuAdapter menuAdapter = mListFragment.getContextMenuAdapter();
+        if (menuAdapter != null) {
+            return menuAdapter.onContextItemSelected(item);
+        }
+
+        return super.onContextItemSelected(item);
+    }
+
+    /**
+     * Event handler for the use case where the user starts typing without
+     * bringing up the search UI first.
+     */
+    @Override
+    public boolean dispatchKeyEvent(KeyEvent event) {
+        if (!mSearchInitiated && !mRequest.isSearchMode()) {
+            int unicodeChar = event.getUnicodeChar();
+            if (unicodeChar != 0) {
+                mSearchInitiated = true;
+                startSearch(new String(new int[]{unicodeChar}, 0, 1), false, null, false);
+                return true;
+            }
+        }
+        return super.dispatchKeyEvent(event);
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        // TODO move to the fragment
+        switch (keyCode) {
+//            case KeyEvent.KEYCODE_CALL: {
+//                if (callSelection()) {
+//                    return true;
+//                }
+//                break;
+//            }
+
+            case KeyEvent.KEYCODE_DEL: {
+                if (deleteSelection()) {
+                    return true;
+                }
+                break;
+            }
+        }
+
+        return super.onKeyDown(keyCode, event);
+    }
+
+    private boolean deleteSelection() {
+        // TODO move to the fragment
+//        if (mActionCode == ContactsRequest.ACTION_DEFAULT) {
+//            final int position = mListView.getSelectedItemPosition();
+//            if (position != ListView.INVALID_POSITION) {
+//                Uri contactUri = getContactUri(position);
+//                if (contactUri != null) {
+//                    doContactDelete(contactUri);
+//                    return true;
+//                }
+//            }
+//        }
+        return false;
+    }
+}
diff --git a/src/com/android/contacts/list/ContactsIntentResolver.java b/src/com/android/contacts/list/ContactsIntentResolver.java
index c0e9043..0570b2c 100644
--- a/src/com/android/contacts/list/ContactsIntentResolver.java
+++ b/src/com/android/contacts/list/ContactsIntentResolver.java
@@ -43,7 +43,7 @@
 @SuppressWarnings("deprecation")
 public class ContactsIntentResolver {
 
-    private static final String TAG = "ContactsListActivity";
+    private static final String TAG = "ContactsIntentResolver";
 
     private final Activity mContext;
 
diff --git a/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java b/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java
index 0666879..7af7dfc 100644
--- a/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java
+++ b/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java
@@ -52,8 +52,8 @@
 
     private static final String ANDROID_CONTACTS_PACKAGE = "com.android.contacts";
 
-    private static final String CONTACTS_LIST_ACTIVITY_CLASS_NAME =
-            "com.android.contacts.activities.ContactsListActivity";
+    private static final String CONTACT_LIST_ACTIVITY_CLASS_NAME =
+            "com.android.contacts.activities.ContactListActivity";
     private static final String SEARCH_RESULTS_ACTIVITY_CLASS_NAME =
             "com.android.contacts.SearchResultsActivity";
     private static final String MULTIPLE_PHONE_PICKER_ACTIVITY_CLASS_NAME =
@@ -124,87 +124,87 @@
 
         switch (position) {
             case LIST_DEFAULT: {
-                startContactsListActivity(
+                startContactListActivity(
                         new Intent(Intent.ACTION_VIEW, Contacts.CONTENT_URI));
                 break;
             }
             case LIST_ALL_CONTACTS_ACTION: {
-                startContactsListActivity(
+                startContactListActivity(
                         new Intent(UI.LIST_ALL_CONTACTS_ACTION, Contacts.CONTENT_URI));
                 break;
             }
             case LIST_CONTACTS_WITH_PHONES_ACTION: {
-                startContactsListActivity(
+                startContactListActivity(
                         new Intent(UI.LIST_CONTACTS_WITH_PHONES_ACTION, Contacts.CONTENT_URI));
                 break;
             }
             case LIST_STARRED_ACTION: {
-                startContactsListActivity(
+                startContactListActivity(
                         new Intent(UI.LIST_STARRED_ACTION, Contacts.CONTENT_URI));
                 break;
             }
             case LIST_STARRED_ACTION_WITH_FILTER: {
-                startContactsListActivity(buildFilterIntent(ContactsRequest.ACTION_STARRED, false));
+                startContactListActivity(buildFilterIntent(ContactsRequest.ACTION_STARRED, false));
                 break;
             }
             case LIST_FREQUENT_ACTION: {
-                startContactsListActivity(
+                startContactListActivity(
                         new Intent(UI.LIST_FREQUENT_ACTION, Contacts.CONTENT_URI));
                 break;
             }
             case LIST_FREQUENT_ACTION_WITH_FILTER: {
-                startContactsListActivity(
+                startContactListActivity(
                         buildFilterIntent(ContactsRequest.ACTION_FREQUENT, false));
                 break;
             }
             case LIST_STREQUENT_ACTION: {
-                startContactsListActivity(
+                startContactListActivity(
                         new Intent(UI.LIST_STREQUENT_ACTION, Contacts.CONTENT_URI));
                 break;
             }
             case LIST_STREQUENT_ACTION_WITH_FILTER: {
-                startContactsListActivity(
+                startContactListActivity(
                         buildFilterIntent(ContactsRequest.ACTION_STREQUENT, false));
                 break;
             }
             case ACTION_PICK_CONTACT: {
-                startContactsListActivityForResult(
+                startContactSelectionActivityForResult(
                         new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI));
                 break;
             }
             case ACTION_PICK_CONTACT_LEGACY: {
-                startContactsListActivityForResult(
+                startContactSelectionActivityForResult(
                         new Intent(Intent.ACTION_PICK, People.CONTENT_URI));
                 break;
             }
             case ACTION_PICK_PHONE: {
-                startContactsListActivityForResult(
+                startContactSelectionActivityForResult(
                         new Intent(Intent.ACTION_PICK, Phone.CONTENT_URI));
                 break;
             }
             case ACTION_PICK_PHONE_LEGACY: {
-                startContactsListActivityForResult(
+                startContactSelectionActivityForResult(
                         new Intent(Intent.ACTION_PICK, Phones.CONTENT_URI));
                 break;
             }
             case ACTION_PICK_POSTAL: {
-                startContactsListActivityForResult(
+                startContactSelectionActivityForResult(
                         new Intent(Intent.ACTION_PICK, StructuredPostal.CONTENT_URI));
                 break;
             }
             case ACTION_PICK_POSTAL_LEGACY: {
                 Intent intent = new Intent(Intent.ACTION_PICK);
                 intent.setType(ContactMethods.CONTENT_POSTAL_TYPE);
-                startContactsListActivityForResult(intent);
+                startContactSelectionActivityForResult(intent);
                 break;
             }
             case ACTION_CREATE_SHORTCUT_CONTACT: {
                 Intent intent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
-                startContactsListActivityForResult(intent);
+                startContactSelectionActivityForResult(intent);
                 break;
             }
             case ACTION_CREATE_SHORTCUT_CONTACT_FILTER: {
-                startContactsListActivityForResult(
+                startContactSelectionActivityForResult(
                         buildFilterIntent(ContactsRequest.ACTION_CREATE_SHORTCUT_CONTACT,
                                 false));
                 break;
@@ -217,7 +217,7 @@
                 break;
             }
             case ACTION_CREATE_SHORTCUT_DIAL_FILTER: {
-                startContactsListActivityForResult(
+                startContactSelectionActivityForResult(
                         buildFilterIntent(ContactsRequest.ACTION_CREATE_SHORTCUT_CALL,
                                 false));
                 break;
@@ -230,29 +230,29 @@
                 break;
             }
             case ACTION_CREATE_SHORTCUT_MESSAGE_FILTER: {
-                startContactsListActivityForResult(
+                startContactSelectionActivityForResult(
                         buildFilterIntent(ContactsRequest.ACTION_CREATE_SHORTCUT_CALL, false));
                 break;
             }
             case ACTION_GET_CONTENT_CONTACT: {
                 Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
                 intent.setType(Contacts.CONTENT_ITEM_TYPE);
-                startContactsListActivityForResult(intent);
+                startContactSelectionActivityForResult(intent);
                 break;
             }
             case ACTION_GET_CONTENT_CONTACT_LEGACY: {
                 Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
                 intent.setType(People.CONTENT_ITEM_TYPE);
-                startContactsListActivityForResult(intent);
+                startContactSelectionActivityForResult(intent);
                 break;
             }
             case ACTION_GET_CONTENT_CONTACT_FILTER: {
-                startContactsListActivityForResult(
+                startContactSelectionActivityForResult(
                         buildFilterIntent(ContactsRequest.ACTION_PICK_OR_CREATE_CONTACT, false));
                 break;
             }
             case ACTION_GET_CONTENT_CONTACT_FILTER_LEGACY: {
-                startContactsListActivityForResult(
+                startContactSelectionActivityForResult(
                         buildFilterIntent(ContactsRequest.ACTION_PICK_OR_CREATE_CONTACT,
                                 true));
                 break;
@@ -260,40 +260,40 @@
             case ACTION_GET_CONTENT_PHONE: {
                 Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
                 intent.setType(Phone.CONTENT_ITEM_TYPE);
-                startContactsListActivityForResult(intent);
+                startContactSelectionActivityForResult(intent);
                 break;
             }
             case ACTION_GET_CONTENT_PHONE_FILTER: {
-                startContactsListActivityForResult(
+                startContactSelectionActivityForResult(
                         buildFilterIntent(ContactsRequest.ACTION_PICK_PHONE, true));
                 break;
             }
             case ACTION_GET_CONTENT_PHONE_LEGACY: {
                 Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
                 intent.setType(Phones.CONTENT_ITEM_TYPE);
-                startContactsListActivityForResult(intent);
+                startContactSelectionActivityForResult(intent);
                 break;
             }
             case ACTION_GET_CONTENT_POSTAL: {
                 Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
                 intent.setType(StructuredPostal.CONTENT_ITEM_TYPE);
-                startContactsListActivityForResult(intent);
+                startContactSelectionActivityForResult(intent);
                 break;
             }
             case ACTION_GET_CONTENT_POSTAL_FILTER: {
-                startContactsListActivityForResult(
+                startContactSelectionActivityForResult(
                         buildFilterIntent(ContactsRequest.ACTION_PICK_POSTAL, false));
                 break;
             }
             case ACTION_GET_CONTENT_POSTAL_LEGACY: {
                 Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
                 intent.setType(ContactMethods.CONTENT_POSTAL_ITEM_TYPE);
-                startContactsListActivityForResult(intent);
+                startContactSelectionActivityForResult(intent);
                 break;
             }
             case ACTION_INSERT_OR_EDIT: {
                 Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
-                startContactsListActivity(intent);
+                startContactListActivity(intent);
                 break;
             }
             case ACTION_SEARCH_CALL: {
@@ -328,7 +328,7 @@
                     Intent intent = new Intent(Intents.SEARCH_SUGGESTION_CLICKED);
                     intent.setData(contactUri);
                     intent.putExtra(SearchManager.ACTION_MSG, "call");
-                    startContactsListActivity(intent);
+                    startContactListActivity(intent);
                 }
                 break;
             }
@@ -338,20 +338,20 @@
                     Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
                     Intent intent = new Intent(Intents.SEARCH_SUGGESTION_CLICKED);
                     intent.setData(contactUri);
-                    startContactsListActivity(intent);
+                    startContactListActivity(intent);
                 }
                 break;
             }
             case SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED: {
                 Intent intent = new Intent(Intents.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED);
                 intent.setData(Uri.parse("tel:800-4664411"));
-                startContactsListActivity(intent);
+                startContactListActivity(intent);
                 break;
             }
             case SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED: {
                 Intent intent = new Intent(Intents.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED);
                 intent.setData(Uri.parse("tel:800-4664411"));
-                startContactsListActivity(intent);
+                startContactListActivity(intent);
                 break;
             }
             case JOIN_CONTACT: {
@@ -438,16 +438,14 @@
         return intent;
     }
 
-    private void startContactsListActivity(Intent intent) {
+    private void startContactListActivity(Intent intent) {
         intent.setComponent(
-                new ComponentName(ANDROID_CONTACTS_PACKAGE, CONTACTS_LIST_ACTIVITY_CLASS_NAME));
+                new ComponentName(ANDROID_CONTACTS_PACKAGE, CONTACT_LIST_ACTIVITY_CLASS_NAME));
         intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         startActivity(intent);
     }
 
-    private void startContactsListActivityForResult(Intent intent) {
-        intent.setComponent(
-                new ComponentName(ANDROID_CONTACTS_PACKAGE, CONTACTS_LIST_ACTIVITY_CLASS_NAME));
+    private void startContactSelectionActivityForResult(Intent intent) {
         startActivityForResult(intent, 12);
     }
 
