Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Pass along our package name as the app id if one is not passed in for

web search intents.

Fixes http://b/2020191
  • Loading branch information...
commit f681c0a23b8876a9a371a34ad46638f40265c799 1 parent 2a499b3
Mike LeBeau authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/com/android/googlesearch/GoogleSearch.java
10 src/com/android/googlesearch/GoogleSearch.java
View
@@ -109,17 +109,19 @@ private void handleWebSearchIntent(Intent intent) {
// The browser can pass along an application id which it uses to figure out which
// window to place a new search into. So if this exists, we'll pass it back to
- // the browser.
+ // the browser. Otherwise, add our own package name as the application id, so that
+ // the browser can organize all searches launched from this provider together.
String applicationId = intent.getStringExtra(Browser.EXTRA_APPLICATION_ID);
+ if (applicationId == null) {
+ applicationId = getPackageName();
+ }
try {
String searchUri = googleSearchUrlBase
+ "&source=android-" + source
+ "&q=" + URLEncoder.encode(query, "UTF-8");
Intent launchUriIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(searchUri));
- if (applicationId != null) {
- launchUriIntent.putExtra(Browser.EXTRA_APPLICATION_ID, applicationId);
- }
+ launchUriIntent.putExtra(Browser.EXTRA_APPLICATION_ID, applicationId);
launchUriIntent.putExtra(Browser.EXTRA_POST_DATA, getLocationData());
launchUriIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(launchUriIntent);
Please sign in to comment.
Something went wrong with that request. Please try again.