Merge "Also send EXTRA_CALLING_PACKAGE for voice search intents that do web search (not just for in-app search). Needed as part of http://b/2546173" into froyo
This commit is contained in:
@@ -795,7 +795,9 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
|
||||
SearchableInfo searchable = mSearchable;
|
||||
try {
|
||||
if (searchable.getVoiceSearchLaunchWebSearch()) {
|
||||
getContext().startActivity(mVoiceWebSearchIntent);
|
||||
Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
|
||||
searchable);
|
||||
getContext().startActivity(webSearchIntent);
|
||||
} else if (searchable.getVoiceSearchLaunchRecognizer()) {
|
||||
Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
|
||||
searchable);
|
||||
@@ -810,6 +812,17 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Create and return an Intent that can launch the voice search activity for web search.
|
||||
*/
|
||||
private Intent createVoiceWebSearchIntent(Intent baseIntent, SearchableInfo searchable) {
|
||||
Intent voiceIntent = new Intent(baseIntent);
|
||||
ComponentName searchActivity = searchable.getSearchActivity();
|
||||
voiceIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
|
||||
searchActivity == null ? null : searchActivity.toShortString());
|
||||
return voiceIntent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and return an Intent that can launch the voice search activity, perform a specific
|
||||
* voice transcription, and forward the results to the searchable activity.
|
||||
|
||||
Reference in New Issue
Block a user