Revert "Keep overflow menu button from closing on changing orientation"

Bug: 21650562

This reverts commit ff603b5e045c596c88cf1a70b9320d36437a80cb.

Change-Id: I8916df1ea8fb2ac8ebc617caea9bdd22c7bca117
diff --git a/res/values/integers.xml b/res/values/integers.xml
index a823a30..86a8e26 100644
--- a/res/values/integers.xml
+++ b/res/values/integers.xml
@@ -27,7 +27,4 @@
     <!-- Max suggestions limit showing in quick contact suggestion card [CHAR LIMIT=30]-->
     <integer name="quickcontact_suggestions_limit">10</integer>
 
-    <!-- The delay (in milliseconds) until the overflow options menu is shown automatically -->
-    <integer name="open_overflow_menu_delay_millis">250</integer>
-
 </resources>
diff --git a/src/com/android/contacts/activities/ActionBarAdapter.java b/src/com/android/contacts/activities/ActionBarAdapter.java
index 0f1dbbb..ad70d92 100644
--- a/src/com/android/contacts/activities/ActionBarAdapter.java
+++ b/src/com/android/contacts/activities/ActionBarAdapter.java
@@ -75,14 +75,11 @@
     private static final String EXTRA_KEY_QUERY = "navBar.query";
     private static final String EXTRA_KEY_SELECTED_TAB = "navBar.selectedTab";
     private static final String EXTRA_KEY_SELECTED_MODE = "navBar.selectionMode";
-    private static final String EXTRA_KEY_SHOULD_OPEN_OVERFLOW = "navBar.shouldOpenOverflow";
 
     private static final String PERSISTENT_LAST_TAB = "actionBarAdapter.lastTab";
 
     private boolean mSelectionMode;
     private boolean mSearchMode;
-    private boolean mShouldOverflowOpen;
-    private boolean mIsOverflowOpen;
     private String mQueryString;
 
     private EditText mSearchView;
@@ -203,12 +200,11 @@
             mQueryString = request.getQueryString();
             mCurrentTab = loadLastTabPreference();
             mSelectionMode = false;
-            setShouldOpenOverflow(false);
         } else {
             mSearchMode = savedState.getBoolean(EXTRA_KEY_SEARCH_MODE);
             mSelectionMode = savedState.getBoolean(EXTRA_KEY_SELECTED_MODE);
             mQueryString = savedState.getString(EXTRA_KEY_QUERY);
-            setShouldOpenOverflow(savedState.getBoolean(EXTRA_KEY_SHOULD_OPEN_OVERFLOW));
+
             // Just set to the field here.  The listener will be notified by update().
             mCurrentTab = savedState.getInt(EXTRA_KEY_SELECTED_TAB);
         }
@@ -325,22 +321,6 @@
         }
     }
 
-    public void setShouldOpenOverflow(boolean shouldOpenOverflow) {
-        mShouldOverflowOpen = shouldOpenOverflow;
-    }
-
-    public boolean shouldOpenOverflow() {
-        return mShouldOverflowOpen;
-    }
-
-    public void setOverflowOpen(boolean isOverflowOpen) {
-        mIsOverflowOpen = isOverflowOpen;
-    }
-
-    public boolean isOverflowOpen() {
-        return mIsOverflowOpen;
-    }
-
     public String getQueryString() {
         return mSearchMode ? mQueryString : null;
     }
@@ -573,7 +553,6 @@
     public void onSaveInstanceState(Bundle outState) {
         outState.putBoolean(EXTRA_KEY_SEARCH_MODE, mSearchMode);
         outState.putBoolean(EXTRA_KEY_SELECTED_MODE, mSelectionMode);
-        outState.putBoolean(EXTRA_KEY_SHOULD_OPEN_OVERFLOW, mShouldOverflowOpen);
         outState.putString(EXTRA_KEY_QUERY, mQueryString);
         outState.putInt(EXTRA_KEY_SELECTED_TAB, mCurrentTab);
     }
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index f0ad19d..c495ee8 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -31,7 +31,6 @@
 import android.os.Bundle;
 import android.os.Parcelable;
 import android.os.UserManager;
-import android.os.Handler;
 import android.preference.PreferenceActivity;
 import android.provider.ContactsContract;
 import android.provider.ContactsContract.Contacts;
@@ -438,16 +437,6 @@
         // Current tab may have changed since the last onSaveInstanceState().  Make sure
         // the actual contents match the tab.
         updateFragmentsVisibility();
-
-        if (mActionBarAdapter.shouldOpenOverflow() && !mActionBarAdapter.isOverflowOpen()) {
-            new Handler().postDelayed(new Runnable() {
-                @Override
-                public void run() {
-                    openOptionsMenu();
-                }
-            }, /* delayMillis = */ getResources().getInteger(R.integer.
-                    open_overflow_menu_delay_millis));
-        }
     }
 
     @Override
@@ -1480,24 +1469,4 @@
         }
         return position;
     }
-
-    @Override
-    public boolean onMenuOpened(int featureId, Menu menu) {
-        // When the overflow menu button opens (both manually and automatically), we need to
-        // update both variables; same for closing event.
-        mActionBarAdapter.setOverflowOpen(true);
-        mActionBarAdapter.setShouldOpenOverflow(true);
-        return super.onMenuOpened(featureId, menu);
-    }
-
-    @Override
-    public void onPanelClosed(int featureId, Menu menu) {
-        // Since onPanelClosed will be called when the activity is destroyed on rotation even if
-        // user leaves the menu open, we are relying on onSaveInstanceState being called before
-        // onDestroy and onPanelClosed are invoked in order to store the "opening" status of the
-        // menu.
-        mActionBarAdapter.setOverflowOpen(false);
-        mActionBarAdapter.setShouldOpenOverflow(false);
-        super.onMenuOpened(featureId, menu);
-    }
 }