diff options
| author | Bjorn Bringert <bringert@android.com> | 2009-09-21 23:05:23 +0100 |
|---|---|---|
| committer | Bjorn Bringert <bringert@android.com> | 2009-09-21 23:05:23 +0100 |
| commit | be5b73c5926cbebd508d8323bdeaafa2e048a93c (patch) | |
| tree | d5b8d628ae71795654a1e2b943b854b93962a9f2 /core/java/android/app/SearchDialog.java | |
| parent | 77fa24a5ef3ee3bc108d4bf3c77b7b4c7d0d5451 (diff) | |
Add search_mode flag to intents launched by QSB suggestions
This lets recipents determine whether an intent was launched
by a global search suggestion. This will for example
be used when deciding how to log clicks on web search suggestions.
Needed for http://b/issue?id=2097469
Change-Id: Ifc25ec3477a63be8bad094951bfffa7a5e703e7c
Diffstat (limited to 'core/java/android/app/SearchDialog.java')
| -rw-r--r-- | core/java/android/app/SearchDialog.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index caf72af9b693..c0a04807f630 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -1144,7 +1144,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS String query = mSearchAutoComplete.getText().toString(); String action = mGlobalSearchMode ? Intent.ACTION_WEB_SEARCH : Intent.ACTION_SEARCH; Intent intent = createIntent(action, null, null, query, null, - actionKey, actionMsg); + actionKey, actionMsg, null); // Allow GlobalSearch to log and create shortcut for searches launched by // the search button, enter key or an action key. if (mGlobalSearchMode) { @@ -1579,9 +1579,10 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS String query = getColumnString(c, SearchManager.SUGGEST_COLUMN_QUERY); String extraData = getColumnString(c, SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA); + String mode = mGlobalSearchMode ? SearchManager.MODE_GLOBAL_SEARCH_SUGGESTION : null; return createIntent(action, dataUri, extraData, query, componentName, actionKey, - actionMsg); + actionMsg, mode); } catch (RuntimeException e ) { int rowNum; try { // be really paranoid now @@ -1607,10 +1608,12 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS * or {@link KeyEvent#KEYCODE_UNKNOWN} if none. * @param actionMsg The message for the action key that was pressed, * or <code>null</code> if none. + * @param mode The search mode, one of the acceptable values for + * {@link SearchManager#SEARCH_MODE}, or {@code null}. * @return The intent. */ private Intent createIntent(String action, Uri data, String extraData, String query, - String componentName, int actionKey, String actionMsg) { + String componentName, int actionKey, String actionMsg, String mode) { // Now build the Intent Intent intent = new Intent(action); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); @@ -1634,6 +1637,9 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS intent.putExtra(SearchManager.ACTION_KEY, actionKey); intent.putExtra(SearchManager.ACTION_MSG, actionMsg); } + if (mode != null) { + intent.putExtra(SearchManager.SEARCH_MODE, mode); + } // Only allow 3rd-party intents from GlobalSearch if (!mGlobalSearchMode) { intent.setComponent(mSearchable.getSearchActivity()); |
