From 1bcfe84179417cda57176fe8661a4a749cb843b6 Mon Sep 17 00:00:00 2001 From: Jorge Ruesga Date: Mon, 3 Sep 2012 01:26:59 +0200 Subject: [PATCH] SearchWidget: passing APP_DATA to voice intent SearchView uses SearchManager.APP_DATA to pass data between the origin activity and the search activity. This works for text searches (keyboard), but it's not implemented by voice recognition searches. The method createVoiceAppSearchIntent initializes a empty bundle that is filled with the QUERY parameter. This patch adds the SearchManager.APP_DATA parameter if is present, let the search activity access to the data passed by the origin activity Patch 2: Fix code style Change-Id: I52dce34e1efd07a30ad74d52bfc60fbae1c4310b --- core/java/android/widget/SearchView.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java index c44ce8a8cff0f..86433d4f8f168 100644 --- a/core/java/android/widget/SearchView.java +++ b/core/java/android/widget/SearchView.java @@ -1506,6 +1506,9 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { // because the voice search activity will always need to insert "QUERY" into // it anyway. Bundle queryExtras = new Bundle(); + if (mAppSearchData != null) { + queryExtras.putParcelable(SearchManager.APP_DATA, mAppSearchData); + } // Now build the intent to launch the voice search. Add all necessary // extras to launch the voice recognizer, and then all the necessary extras