diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-22 05:54:31 -0400 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-22 05:54:31 -0400 |
commit | 976e363fe8206fcac5f2342ed3a0c3e0df66d32d (patch) | |
tree | 6e6814bed71ff15eabd959108266ea5eb7e51376 /core | |
parent | 5f55d8c9d447f492aed955ac29454e0c482a4956 (diff) | |
parent | be5b73c5926cbebd508d8323bdeaafa2e048a93c (diff) | |
download | frameworks_base-976e363fe8206fcac5f2342ed3a0c3e0df66d32d.zip frameworks_base-976e363fe8206fcac5f2342ed3a0c3e0df66d32d.tar.gz frameworks_base-976e363fe8206fcac5f2342ed3a0c3e0df66d32d.tar.bz2 |
Merge change 26260 into eclair
* changes:
Add search_mode flag to intents launched by QSB suggestions
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/SearchDialog.java | 12 | ||||
-rw-r--r-- | core/java/android/app/SearchManager.java | 19 |
2 files changed, 28 insertions, 3 deletions
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index caf72af..c0a0480 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()); diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java index 6a0285d..f0876f4 100644 --- a/core/java/android/app/SearchManager.java +++ b/core/java/android/app/SearchManager.java @@ -1289,6 +1289,25 @@ public class SearchManager public final static String SOURCE = "source"; /** + * Intent extra data key: Use {@link android.content.Intent#getBundleExtra + * content.Intent.getBundleExtra(SEARCH_MODE)} to get the search mode used + * to launch the intent. + * The only current value for this is {@link #MODE_GLOBAL_SEARCH_SUGGESTION}. + * + * @hide + */ + public final static String SEARCH_MODE = "search_mode"; + + /** + * Value for the {@link #SEARCH_MODE} key. + * This is used if the intent was launched by clicking a suggestion in global search + * mode (Quick Search Box). + * + * @hide + */ + public static final String MODE_GLOBAL_SEARCH_SUGGESTION = "global_search_suggestion"; + + /** * Intent extra data key: Use this key with Intent.ACTION_SEARCH and * {@link android.content.Intent#getIntExtra content.Intent.getIntExtra()} * to obtain the keycode that the user used to trigger this query. It will be zero if the |