Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e134279f authored by Mike LeBeau's avatar Mike LeBeau Committed by Android (Google) Code Review
Browse files

Merge "Also send EXTRA_CALLING_PACKAGE for voice search intents that do web...

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
parents 83d4eb6c 6af5ad5e
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -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.