diff options
| author | Mathew Inwood <mathewi@google.com> | 2011-10-13 11:00:39 +0100 |
|---|---|---|
| committer | Mathew Inwood <mathewi@google.com> | 2011-10-14 14:11:52 +0100 |
| commit | 050453eaf51bb3a267680dc1db2b53cb2fbfcefc (patch) | |
| tree | 127538488e89711a34ceb34c7e0b4f2bf146298b /core/java/android/app/SearchManager.java | |
| parent | 7a3ba4d732d5ce394aab9783e4099b2e71f1903f (diff) | |
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
Diffstat (limited to 'core/java/android/app/SearchManager.java')
| -rw-r--r-- | core/java/android/app/SearchManager.java | 22 |
1 files 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); |
