From 050453eaf51bb3a267680dc1db2b53cb2fbfcefc Mon Sep 17 00:00:00 2001 From: Mathew Inwood Date: Thu, 13 Oct 2011 11:00:39 +0100 Subject: Allow setting of source bounds on global search intents. This is to allow the launcher to include the source bounds of the search affordance on the homescreen when launching the global search app. Bug: 5235747 Change-Id: I7af1a651d593b6d946aa2fe42d900a9c4470b4e2 --- core/java/android/app/SearchManager.java | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java index 3290b9d5ad19..3aa159e71078 100644 --- a/core/java/android/app/SearchManager.java +++ b/core/java/android/app/SearchManager.java @@ -24,6 +24,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.pm.ResolveInfo; import android.database.Cursor; +import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -498,8 +499,24 @@ public class SearchManager ComponentName launchActivity, Bundle appSearchData, boolean globalSearch) { + startSearch(initialQuery, selectInitialQuery, launchActivity, + appSearchData, globalSearch, null); + } + + /** + * As {@link #startSearch(String, boolean, ComponentName, Bundle, boolean)} but including + * source bounds for the global search intent. + * + * @hide + */ + public void startSearch(String initialQuery, + boolean selectInitialQuery, + ComponentName launchActivity, + Bundle appSearchData, + boolean globalSearch, + Rect sourceBounds) { if (globalSearch) { - startGlobalSearch(initialQuery, selectInitialQuery, appSearchData); + startGlobalSearch(initialQuery, selectInitialQuery, appSearchData, sourceBounds); return; } @@ -520,7 +537,7 @@ public class SearchManager * Starts the global search activity. */ /* package */ void startGlobalSearch(String initialQuery, boolean selectInitialQuery, - Bundle appSearchData) { + Bundle appSearchData, Rect sourceBounds) { ComponentName globalSearchActivity = getGlobalSearchActivity(); if (globalSearchActivity == null) { Log.w(TAG, "No global search activity found."); @@ -546,6 +563,7 @@ public class SearchManager if (selectInitialQuery) { intent.putExtra(EXTRA_SELECT_QUERY, selectInitialQuery); } + intent.setSourceBounds(sourceBounds); try { if (DBG) Log.d(TAG, "Starting global search: " + intent.toUri(0)); mContext.startActivity(intent); -- cgit v1.2.3-59-g8ed1b