diff options
author | Mike LeBeau <mlebeau@android.com> | 2009-07-28 18:31:28 -0700 |
---|---|---|
committer | Mike LeBeau <mlebeau@android.com> | 2009-07-28 18:39:04 -0700 |
commit | e08a461d4228d012f5b03e5f80226382029d88f8 (patch) | |
tree | b34b907eed8646affae46e51dec8ef90301d30d9 | |
parent | fc27a6cb7f8b9245c4ee0faeaef9c6b5544f157c (diff) | |
download | WebSearchProvider-e08a461d4228d012f5b03e5f80226382029d88f8.tar.gz |
Pass along our package name as the app id if one is not passed in for
web search intents.
Fixes http://b/2020191
-rw-r--r-- | src/com/android/websearch/WebSearch.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/com/android/websearch/WebSearch.java b/src/com/android/websearch/WebSearch.java index 6b97681..04391ed 100644 --- a/src/com/android/websearch/WebSearch.java +++ b/src/com/android/websearch/WebSearch.java @@ -49,8 +49,12 @@ public class WebSearch extends Activity { if (engine != null) { // 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(); + } // Format the URI to launch and open it in the browser. String query = intent.getStringExtra(SearchManager.QUERY); @@ -60,9 +64,7 @@ public class WebSearch extends Activity { + intent.getComponent()); } else { intent = new Intent(Intent.ACTION_VIEW, Uri.parse(launchUri)); - if (applicationId != null) { - intent.putExtra(Browser.EXTRA_APPLICATION_ID, applicationId); - } + intent.putExtra(Browser.EXTRA_APPLICATION_ID, applicationId); startActivity(intent); } } |