summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike LeBeau <mlebeau@android.com>2009-07-29 16:44:43 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2009-07-29 16:44:43 -0700
commit68f051a185db6cb89ca5249fe4ded4ec89283909 (patch)
treef9a1a17896a016fe502e4b4ddf3ebe6a1e9ebbde
parenta63672277adf507dfb94d5bdc0f61245e9437628 (diff)
parentf681c0a23b8876a9a371a34ad46638f40265c799 (diff)
downloadGoogleSearch-68f051a185db6cb89ca5249fe4ded4ec89283909.tar.gz
am f681c0a2: Pass along our package name as the app id if one is not passed in for web search intents.
Merge commit 'f681c0a23b8876a9a371a34ad46638f40265c799' * commit 'f681c0a23b8876a9a371a34ad46638f40265c799': Pass along our package name as the app id if one is not passed in for
-rw-r--r--src/com/android/googlesearch/GoogleSearch.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/com/android/googlesearch/GoogleSearch.java b/src/com/android/googlesearch/GoogleSearch.java
index ea0652a..c0db663 100644
--- a/src/com/android/googlesearch/GoogleSearch.java
+++ b/src/com/android/googlesearch/GoogleSearch.java
@@ -109,17 +109,19 @@ public class GoogleSearch extends Activity {
// 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);