Switch back to the single 4 tab activity model.
diff --git a/src/com/android/contacts/ContactsActivity.java b/src/com/android/contacts/ContactsActivity.java
deleted file mode 100644
index cda4ba8..0000000
--- a/src/com/android/contacts/ContactsActivity.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2008 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;
-
-import android.app.Activity;
-import android.app.TabActivity;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.provider.Contacts;
-import android.provider.Contacts.Intents.UI;
-import android.view.KeyEvent;
-import android.view.Window;
-import android.widget.TabHost;
-
-/**
- * The contacts activity that has one tab with social activity stream and
- * another with contact list. This is the container and the tabs are embedded
- * using intents.
- */
-public class ContactsActivity extends TabActivity implements TabHost.OnTabChangeListener {
-    private static final String TAG = "Contacts";
-    private static final String FAVORITES_ENTRY_COMPONENT =
-            "com.android.contacts.DialtactsFavoritesEntryActivity";
-
-    private static final int TAB_INDEX_CONTACTS = 0;
-    private static final int TAB_INDEX_FAVORITES = 1;
-
-    static final String EXTRA_IGNORE_STATE = "ignore-state";
-
-    /** Name of the dialtacts shared preferences */
-    static final String PREFS_DIALTACTS = "dialtacts";
-    /** If true, when handling the contacts intent the favorites tab will be shown instead */
-    static final String PREF_FAVORITES_AS_CONTACTS = "favorites_as_contacts";
-    static final boolean PREF_FAVORITES_AS_CONTACTS_DEFAULT = false;
-
-    private TabHost mTabHost;
-    private String mFilterText;
-
-    @Override
-    protected void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-
-        final Intent intent = getIntent();
-
-        requestWindowFeature(Window.FEATURE_NO_TITLE);
-        setContentView(R.layout.dialer_activity);
-
-        mTabHost = getTabHost();
-        mTabHost.setOnTabChangedListener(this);
-
-        // Setup the tabs
-        setupContactsTab();
-        setupSocialStreamTab();
-        setupFavoritesTab();
-
-        setCurrentTab(intent);
-
-        if (intent.getAction().equals(Contacts.Intents.UI.FILTER_CONTACTS_ACTION)
-                && icicle == null) {
-            setupFilterText(intent);
-        }
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-
-        int currentTabIndex = mTabHost.getCurrentTab();
-        if (currentTabIndex == TAB_INDEX_CONTACTS || currentTabIndex == TAB_INDEX_FAVORITES) {
-            SharedPreferences.Editor editor = getSharedPreferences(PREFS_DIALTACTS, MODE_PRIVATE)
-                    .edit();
-            editor.putBoolean(PREF_FAVORITES_AS_CONTACTS, currentTabIndex == TAB_INDEX_FAVORITES);
-            editor.commit();
-        }
-    }
-
-    private void setupSocialStreamTab() {
-        // Just a placeholder for now
-        Intent intent = new Intent("com.android.contacts.action.SOCIAL_STREAM");
-        intent.setClass(this, SocialStreamActivity.class);
-
-        mTabHost.addTab(mTabHost.newTabSpec("social")
-                .setIndicator(getText(R.string.socialStreamIconLabel),
-                        getResources().getDrawable(R.drawable.ic_tab_friends))
-                .setContent(intent));
-    }
-
-    private void setupContactsTab() {
-        Intent intent = new Intent(UI.LIST_DEFAULT);
-        intent.setClass(this, ContactsListActivity.class);
-
-        mTabHost.addTab(mTabHost.newTabSpec("contacts")
-                .setIndicator(getText(R.string.contactsIconLabel),
-                        getResources().getDrawable(R.drawable.ic_tab_contacts))
-                .setContent(intent));
-    }
-
-    private void setupFavoritesTab() {
-        Intent intent = new Intent(UI.LIST_STARRED_ACTION);
-        intent.setClass(this, ContactsListActivity.class);
-
-        mTabHost.addTab(mTabHost.newTabSpec("favorites")
-                .setIndicator(getString(R.string.contactsFavoritesLabel),
-                        getResources().getDrawable(R.drawable.ic_tab_starred))
-                .setContent(intent));
-    }
-
-    /**
-     * Sets the current tab based on the intent's request type
-     *
-     * @param recentCallsRequest true is the recent calls tab is desired, false otherwise
-     */
-    private void setCurrentTab(Intent intent) {
-
-        // Dismiss menu provided by any children activities
-        Activity activity = getLocalActivityManager().
-                getActivity(mTabHost.getCurrentTabTag());
-        if (activity != null) {
-            activity.closeOptionsMenu();
-        }
-
-        // Tell the children activities that they should ignore any possible saved
-        // state and instead reload their state from the parent's intent
-        intent.putExtra(EXTRA_IGNORE_STATE, true);
-
-        // Choose the tab based on the inbound intent
-        String componentName = intent.getComponent().getClassName();
-        if (FAVORITES_ENTRY_COMPONENT.equals(componentName)) {
-            mTabHost.setCurrentTab(TAB_INDEX_FAVORITES);
-        } else if (Contacts.Intents.UI.FILTER_CONTACTS_ACTION.equals(intent.getAction())) {
-            mTabHost.setCurrentTab(TAB_INDEX_CONTACTS);
-        } else {
-            SharedPreferences prefs = getSharedPreferences(PREFS_DIALTACTS, MODE_PRIVATE);
-            boolean favoritesAsContacts = prefs.getBoolean(PREF_FAVORITES_AS_CONTACTS,
-                    PREF_FAVORITES_AS_CONTACTS_DEFAULT);
-            if (favoritesAsContacts) {
-                mTabHost.setCurrentTab(TAB_INDEX_FAVORITES);
-            } else {
-                mTabHost.setCurrentTab(TAB_INDEX_CONTACTS);
-            }
-        }
-
-        // Tell the children activities that they should honor their saved states
-        // instead of the state from the parent's intent
-        intent.putExtra(EXTRA_IGNORE_STATE, false);
-    }
-
-    @Override
-    public void onNewIntent(Intent newIntent) {
-        setIntent(newIntent);
-        setCurrentTab(newIntent);
-        final String action = newIntent.getAction();
-        if (action.equals(Contacts.Intents.UI.FILTER_CONTACTS_ACTION)) {
-            setupFilterText(newIntent);
-        }
-    }
-
-    /**
-     * Retrieves the filter text stored in {@link #setupFilterText(Intent)}.
-     * This text originally came from a FILTER_CONTACTS_ACTION intent received
-     * by this activity. The stored text will then be cleared after after this
-     * method returns.
-     *
-     * @return The stored filter text
-     */
-    public String getAndClearFilterText() {
-        String filterText = mFilterText;
-        mFilterText = null;
-        return filterText;
-    }
-
-    /**
-     * Stores the filter text associated with a FILTER_CONTACTS_ACTION intent.
-     * This is so child activities can check if they are supposed to display a filter.
-     *
-     * @param intent The intent received in {@link #onNewIntent(Intent)}
-     */
-    private void setupFilterText(Intent intent) {
-        // If the intent was relaunched from history, don't apply the filter text.
-        if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
-            return;
-        }
-        String filter = intent.getStringExtra(Contacts.Intents.UI.FILTER_TEXT_EXTRA_KEY);
-        if (filter != null && filter.length() > 0) {
-            mFilterText = filter;
-        }
-    }
-
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event) {
-        // Handle BACK
-        if (keyCode == KeyEvent.KEYCODE_BACK && isTaskRoot()) {
-            // Instead of stopping, simply push this to the back of the stack.
-            // This is only done when running at the top of the stack;
-            // otherwise, we have been launched by someone else so need to
-            // allow the user to go back to the caller.
-            moveTaskToBack(false);
-            return true;
-        }
-
-        return super.onKeyDown(keyCode, event);
-    }
-
-    /** {@inheritDoc} */
-    public void onTabChanged(String tabId) {
-        // Because we're using Activities as our tab children, we trigger
-        // onWindowFocusChanged() to let them know when they're active.  This may
-        // seem to duplicate the purpose of onResume(), but it's needed because
-        // onResume() can't reliably check if a keyguard is active.
-        Activity activity = getLocalActivityManager().getActivity(tabId);
-        if (activity != null) {
-            activity.onWindowFocusChanged(true);
-        }
-    }
-}
diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java
index 87eb474..6ce5f55 100644
--- a/src/com/android/contacts/ContactsListActivity.java
+++ b/src/com/android/contacts/ContactsListActivity.java
@@ -563,8 +563,8 @@
         }
 
         // See if we were invoked with a filter
-        if (parent != null && parent instanceof ContactsActivity) {
-            String filterText = ((ContactsActivity) parent).getAndClearFilterText();
+        if (parent != null && parent instanceof DialtactsActivity) {
+            String filterText = ((DialtactsActivity) parent).getAndClearFilterText();
             if (filterText != null && filterText.length() > 0) {
                 getListView().setFilterText(filterText);
                 // Don't start a new query since it will conflict with the filter
diff --git a/src/com/android/contacts/DialerActivity.java b/src/com/android/contacts/DialtactsActivity.java
similarity index 65%
rename from src/com/android/contacts/DialerActivity.java
rename to src/com/android/contacts/DialtactsActivity.java
index f86a78a..73d702b 100644
--- a/src/com/android/contacts/DialerActivity.java
+++ b/src/com/android/contacts/DialtactsActivity.java
@@ -19,16 +19,20 @@
 import android.app.Activity;
 import android.app.TabActivity;
 import android.content.Intent;
+import android.content.SharedPreferences;
+import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.RemoteException;
 import android.os.ServiceManager;
+import android.provider.CallLog;
+import android.provider.Contacts;
 import android.provider.CallLog.Calls;
+import android.provider.Contacts.Intents.UI;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.view.Window;
 import android.widget.TabHost;
-
 import com.android.internal.telephony.ITelephony;
 
 /**
@@ -36,15 +40,26 @@
  * and another tab with recent calls in it. This is the container and the tabs
  * are embedded using intents.
  */
-public class DialerActivity extends TabActivity implements TabHost.OnTabChangeListener {
-    private static final String TAG = "Dialer";
+public class DialtactsActivity extends TabActivity implements TabHost.OnTabChangeListener {
+    private static final String TAG = "Dailtacts";
+    private static final String FAVORITES_ENTRY_COMPONENT =
+            "com.android.contacts.DialtactsFavoritesEntryActivity";
 
     private static final int TAB_INDEX_DIALER = 0;
     private static final int TAB_INDEX_CALL_LOG = 1;
-
+    private static final int TAB_INDEX_CONTACTS = 2;
+    private static final int TAB_INDEX_FAVORITES = 3;
+    
     static final String EXTRA_IGNORE_STATE = "ignore-state";
 
+    /** Name of the dialtacts shared preferences */
+    static final String PREFS_DIALTACTS = "dialtacts";
+    /** If true, when handling the contacts intent the favorites tab will be shown instead */
+    static final String PREF_FAVORITES_AS_CONTACTS = "favorites_as_contacts";
+    static final boolean PREF_FAVORITES_AS_CONTACTS_DEFAULT = false;
+
     private TabHost mTabHost;
+    private String mFilterText;    
     private Uri mDialUri;
 
     @Override
@@ -53,7 +68,7 @@
 
         final Intent intent = getIntent();
         fixIntent(intent);
-
+        
         requestWindowFeature(Window.FEATURE_NO_TITLE);
         setContentView(R.layout.dialer_activity);
 
@@ -63,10 +78,30 @@
         // Setup the tabs
         setupDialerTab();
         setupCallLogTab();
+        setupContactsTab();
+        setupFavoritesTab();
 
         setCurrentTab(intent);
+
+        if (intent.getAction().equals(Contacts.Intents.UI.FILTER_CONTACTS_ACTION)
+                && icicle == null) {
+            setupFilterText(intent);
+        }
     }
 
+    @Override
+    protected void onPause() {
+        super.onPause();
+        
+        int currentTabIndex = mTabHost.getCurrentTab();
+        if (currentTabIndex == TAB_INDEX_CONTACTS || currentTabIndex == TAB_INDEX_FAVORITES) {
+            SharedPreferences.Editor editor = getSharedPreferences(PREFS_DIALTACTS, MODE_PRIVATE)
+                    .edit();
+            editor.putBoolean(PREF_FAVORITES_AS_CONTACTS, currentTabIndex == TAB_INDEX_FAVORITES);
+            editor.commit();
+        }
+    }
+    
     private void fixIntent(Intent intent) {
         // This should be cleaned up: the call key used to send an Intent
         // that just said to go to the recent calls list.  It now sends this
@@ -77,7 +112,7 @@
             setIntent(intent);
         }
     }
-
+    
     private void setupCallLogTab() {
         // Force the class since overriding tab entries doesn't work
         Intent intent = new Intent("com.android.phone.action.RECENT_CALLS");
@@ -99,12 +134,32 @@
                 .setContent(intent));
     }
 
+    private void setupContactsTab() {
+        Intent intent = new Intent(UI.LIST_DEFAULT);
+        intent.setClass(this, ContactsListActivity.class);
+
+        mTabHost.addTab(mTabHost.newTabSpec("contacts")
+                .setIndicator(getText(R.string.contactsIconLabel),
+                        getResources().getDrawable(R.drawable.ic_tab_contacts))
+                .setContent(intent));
+    }
+
+    private void setupFavoritesTab() {
+        Intent intent = new Intent(UI.LIST_STREQUENT_ACTION);
+        intent.setClass(this, ContactsListActivity.class);
+
+        mTabHost.addTab(mTabHost.newTabSpec("favorites")
+                .setIndicator(getString(R.string.contactsFavoritesLabel),
+                        getResources().getDrawable(R.drawable.ic_tab_starred))
+                .setContent(intent));
+    }
+
     /**
      * Returns true if the intent is due to hitting the green send key while in a call.
-     *
+     * 
      * @param intent the intent that launched this activity
      * @param recentCallsRequest true if the intent is requesting to view recent calls
-     * @return true if the intent is due to hitting the green send key while in a call
+     * @return true if the intent is due to hitting the green send key while in a call 
      */
     private boolean isSendKeyWhileInCall(final Intent intent, final boolean recentCallsRequest) {
         // If there is a call in progress go to the call screen
@@ -126,7 +181,7 @@
 
     /**
      * Sets the current tab based on the intent's request type
-     *
+     * 
      * @param recentCallsRequest true is the recent calls tab is desired, false otherwise
      */
     private void setCurrentTab(Intent intent) {
@@ -136,7 +191,7 @@
             finish();
             return;
         }
-
+        
         // Dismiss menu provided by any children activities
         Activity activity = getLocalActivityManager().
                 getActivity(mTabHost.getCurrentTabTag());
@@ -156,6 +211,17 @@
             } else {
                 mTabHost.setCurrentTab(TAB_INDEX_DIALER);
             }
+        } else if (FAVORITES_ENTRY_COMPONENT.equals(componentName)) {
+            mTabHost.setCurrentTab(TAB_INDEX_FAVORITES);
+        } else {
+            SharedPreferences prefs = getSharedPreferences(PREFS_DIALTACTS, MODE_PRIVATE);
+            boolean favoritesAsContacts = prefs.getBoolean(PREF_FAVORITES_AS_CONTACTS,
+                    PREF_FAVORITES_AS_CONTACTS_DEFAULT);
+            if (favoritesAsContacts) {
+                mTabHost.setCurrentTab(TAB_INDEX_FAVORITES);
+            } else {
+                mTabHost.setCurrentTab(TAB_INDEX_CONTACTS);
+            }
         }
 
         // Tell the children activities that they should honor their saved states
@@ -168,7 +234,10 @@
         setIntent(newIntent);
         fixIntent(newIntent);
         setCurrentTab(newIntent);
-        if (isDialIntent(newIntent)) {
+        final String action = newIntent.getAction();
+        if (action.equals(Contacts.Intents.UI.FILTER_CONTACTS_ACTION)) {
+            setupFilterText(newIntent);
+        } else if (isDialIntent(newIntent)) {
             setupDialUri(newIntent);
         }
     }
@@ -187,12 +256,43 @@
         }
         return false;
     }
+    
+    /**
+     * Retrieves the filter text stored in {@link #setupFilterText(Intent)}.
+     * This text originally came from a FILTER_CONTACTS_ACTION intent received
+     * by this activity. The stored text will then be cleared after after this
+     * method returns.
+     * 
+     * @return The stored filter text
+     */
+    public String getAndClearFilterText() {
+        String filterText = mFilterText;
+        mFilterText = null;
+        return filterText;
+    }
+
+    /**
+     * Stores the filter text associated with a FILTER_CONTACTS_ACTION intent.
+     * This is so child activities can check if they are supposed to display a filter.
+     * 
+     * @param intent The intent received in {@link #onNewIntent(Intent)}
+     */
+    private void setupFilterText(Intent intent) {
+        // If the intent was relaunched from history, don't apply the filter text.
+        if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
+            return;
+        }
+        String filter = intent.getStringExtra(Contacts.Intents.UI.FILTER_TEXT_EXTRA_KEY);
+        if (filter != null && filter.length() > 0) {
+            mFilterText = filter;
+        }
+    }
 
     /**
      * Retrieves the uri stored in {@link #setupDialUri(Intent)}. This uri
      * originally came from a dial intent received by this activity. The stored
      * uri will then be cleared after after this method returns.
-     *
+     * 
      * @return The stored uri
      */
     public Uri getAndClearDialUri() {
@@ -204,7 +304,7 @@
     /**
      * Stores the uri associated with a dial intent. This is so child activities can
      * check if they are supposed to display new dial info.
-     *
+     * 
      * @param intent The intent received in {@link #onNewIntent(Intent)}
      */
     private void setupDialUri(Intent intent) {
@@ -226,7 +326,7 @@
             moveTaskToBack(false);
             return true;
         }
-
+        
         return super.onKeyDown(keyCode, event);
     }
 
diff --git a/src/com/android/contacts/TwelveKeyDialer.java b/src/com/android/contacts/TwelveKeyDialer.java
index e3d0065..fb1cb4b 100644
--- a/src/com/android/contacts/TwelveKeyDialer.java
+++ b/src/com/android/contacts/TwelveKeyDialer.java
@@ -252,7 +252,7 @@
         final Intent intent;
         if (isChild()) {
             intent = getParent().getIntent();
-            ignoreState = intent.getBooleanExtra(DialerActivity.EXTRA_IGNORE_STATE, false);
+            ignoreState = intent.getBooleanExtra(DialtactsActivity.EXTRA_IGNORE_STATE, false);
         } else {
             intent = getIntent();
         }
@@ -393,8 +393,8 @@
         Activity parent = getParent();
         // See if we were invoked with a DIAL intent. If we were, fill in the appropriate
         // digits in the dialer field.
-        if (parent != null && parent instanceof DialerActivity) {
-            Uri dialUri = ((DialerActivity) parent).getAndClearDialUri();
+        if (parent != null && parent instanceof DialtactsActivity) {
+            Uri dialUri = ((DialtactsActivity) parent).getAndClearDialUri();
             if (dialUri != null) {
                 resolveIntent();
             }