From 940ef38c7c46565a8f8fdd6bb8e0183646d0abdc Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Wed, 2 Mar 2011 18:43:23 -0800 Subject: Pass AppData to the app from SearchDialog queries. Bug: 3494468 During migration of SearchDialog to use SearchView, the appdata was not passed along. This fixes the loss. Change-Id: Ia754086d2bb95294e1d29650a72e4fdddec9c899 --- core/java/android/app/SearchDialog.java | 1 + core/java/android/widget/SearchView.java | 13 +++++++++++++ 2 files changed, 14 insertions(+) (limited to 'core/java') diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index e95a23d..db8d5e9 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -255,6 +255,7 @@ public class SearchDialog extends Dialog { // of any bad state in the AutoCompleteTextView etc createContentView(); mSearchView.setSearchableInfo(mSearchable); + mSearchView.setAppSearchData(mAppSearchData); show(); } diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java index 22edcd0..2d164fd 100644 --- a/core/java/android/widget/SearchView.java +++ b/core/java/android/widget/SearchView.java @@ -96,6 +96,7 @@ public class SearchView extends LinearLayout { private boolean mVoiceButtonEnabled; private SearchableInfo mSearchable; + private Bundle mAppSearchData; // For voice searching private final Intent mVoiceWebSearchIntent; @@ -263,6 +264,15 @@ public class SearchView extends LinearLayout { updateViewsVisibility(mIconifiedByDefault); } + /** + * Sets the APP_DATA for legacy SearchDialog use. + * @param appSearchData bundle provided by the app when launching the search dialog + * @hide + */ + public void setAppSearchData(Bundle appSearchData) { + mAppSearchData = appSearchData; + } + /** @hide */ @Override public boolean requestFocus(int direction, Rect previouslyFocusedRect) { @@ -1115,6 +1125,9 @@ public class SearchView extends LinearLayout { if (extraData != null) { intent.putExtra(SearchManager.EXTRA_DATA_KEY, extraData); } + if (mAppSearchData != null) { + intent.putExtra(SearchManager.APP_DATA, mAppSearchData); + } if (actionKey != KeyEvent.KEYCODE_UNKNOWN) { intent.putExtra(SearchManager.ACTION_KEY, actionKey); intent.putExtra(SearchManager.ACTION_MSG, actionMsg); -- cgit v1.1