Fix broken key-type to search with keyboard

Remember the query text before updating the SearchView,
and restore it again after the update is done to prevent
the loss of the first typed character after going into
search mode.
Bug: 6332454

Change-Id: I2f6eb930cbbeef57c61e830e048a40295e07df30
diff --git a/src/com/android/contacts/activities/ActionBarAdapter.java b/src/com/android/contacts/activities/ActionBarAdapter.java
index d50c240..c22f058 100644
--- a/src/com/android/contacts/activities/ActionBarAdapter.java
+++ b/src/com/android/contacts/activities/ActionBarAdapter.java
@@ -416,7 +416,11 @@
             // expanding the {@link SearchView} when a search is initiated. Note that a side effect
             // of this method is that the {@link SearchView} query text is set to empty string.
             if (isIconifiedChanging) {
+                final CharSequence queryText = mSearchView.getQuery();
                 mSearchView.onActionViewExpanded();
+                if (!TextUtils.isEmpty(queryText)) {
+                    mSearchView.setQuery(queryText, false);
+                }
             }
             if (mActionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD) {
                 mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);