Make more room in the ActionBar

See bug #14898161

- allow Search Option Menu only on the Dashboard (and no more
in the Settings screens)
- push the "Start Now" Day Dream Option Menu to be a real Menu
so that we can see the "Day Dream" title

Change-Id: I4a7c21fb3599ada8efc82bd5bd8c9f5049937ceb
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 7a9adaf..f814a9b 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -304,6 +304,8 @@
     private ActionBar mActionBar;
     private boolean mDisplayHomeAsUpEnabled;
 
+    private boolean mIsShowingDashboard;
+
     private SearchView mSearchView;
     private MenuItem mSearchMenuItem;
     private boolean mSearchMenuItemExpanded = false;
@@ -387,6 +389,11 @@
 
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
+        // Only show the Search menu on the main screen (Dashboard)
+        if (!mIsShowingDashboard) {
+            return true;
+        }
+
         MenuInflater inflater = getMenuInflater();
         inflater.inflate(R.menu.options_menu, menu);
 
@@ -442,7 +449,9 @@
         // Getting Intent properties can only be done after the super.onCreate(...)
         final String initialFragmentName = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT);
 
-        if (initialFragmentName == null) {
+        mIsShowingDashboard = (initialFragmentName == null);
+
+        if (mIsShowingDashboard) {
             Index.getInstance(this).update();
         }
 
@@ -468,7 +477,7 @@
             // We need to build the Categories in all cases
             buildDashboardCategories(mCategories);
 
-            if (initialFragmentName != null) {
+            if (!mIsShowingDashboard) {
                 final ComponentName cn = getIntent().getComponent();
                 // No UP is we are launched thru a Settings shortcut
                 if (!cn.getClassName().equals(SubSettings.class.getName())) {