Merge change 26260 into eclair
* changes: Add search_mode flag to intents launched by QSB suggestions
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -1288,6 +1288,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()}
|
||||
|
||||
Reference in New Issue
Block a user