Dialog for showing phone numbers on devices that can not be used as phones

Bug:3116684

Change-Id: I000df5fa6d83812a60fa5eb4c7e621cca2adb4fe
diff --git a/src/com/android/contacts/DialtactsActivity.java b/src/com/android/contacts/DialtactsActivity.java
index ce8d3f4..dc69194 100644
--- a/src/com/android/contacts/DialtactsActivity.java
+++ b/src/com/android/contacts/DialtactsActivity.java
@@ -43,12 +43,6 @@
  */
 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";
-
-    /** Opens the Contacts app in the state the user has last set it to */
-    private static final String CONTACTS_LAUNCH_ACTIVITY =
-            "com.android.contacts.ContactsLaunchActivity";
 
     private static final int TAB_INDEX_DIALER = 0;
     private static final int TAB_INDEX_CALL_LOG = 1;
@@ -231,8 +225,16 @@
 
         // Choose the tab based on the inbound intent
         if (intent.getBooleanExtra(ContactsFrontDoor.EXTRA_FRONT_DOOR, false)) {
-            // Launched through the contacts front door, set the proper contacts tab
-            setContactsTab();
+            // Launched through the contacts front door, set the proper contacts tab (sticky
+            // between favorites and contacts)
+            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);
+            }
         } else {
             // Not launched through the front door, look at the component to determine the tab
             String componentName = intent.getComponent().getClassName();
@@ -242,12 +244,8 @@
                 } else {
                     mTabHost.setCurrentTab(TAB_INDEX_DIALER);
                 }
-            } else if (FAVORITES_ENTRY_COMPONENT.equals(componentName)) {
-                mTabHost.setCurrentTab(TAB_INDEX_FAVORITES);
-            } else if (CONTACTS_LAUNCH_ACTIVITY.equals(componentName)) {
-                mTabHost.setCurrentTab(mLastManuallySelectedTab);
             } else {
-                setContactsTab();
+                mTabHost.setCurrentTab(mLastManuallySelectedTab);
             }
         }
 
@@ -259,17 +257,6 @@
         intent.putExtra(EXTRA_IGNORE_STATE, false);
     }
 
-    private void setContactsTab() {
-        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);
-        }
-    }
-
     @Override
     public void onNewIntent(Intent newIntent) {
         setIntent(newIntent);