From 6747e0a22235ee1652e81f40e62828268f30c1cb Mon Sep 17 00:00:00 2001 From: Bjorn Bringert Date: Wed, 10 Aug 2011 16:16:46 -0700 Subject: Use EXTRA_WEB_SEARCH_PENDINGINTENT This avoids a chooser dialog when web searches are done in the address bar when there are multiple browsers installed. Bug: 4988580 Change-Id: I3afb5f7dc10acf1aa2a0107e76061de0e534d8fe --- .../browser/search/.DefaultSearchEngine.java.swp | Bin 16384 -> 0 bytes src/com/android/browser/search/DefaultSearchEngine.java | 7 +++++++ 2 files changed, 7 insertions(+) delete mode 100644 src/com/android/browser/search/.DefaultSearchEngine.java.swp diff --git a/src/com/android/browser/search/.DefaultSearchEngine.java.swp b/src/com/android/browser/search/.DefaultSearchEngine.java.swp deleted file mode 100644 index 441153c..0000000 Binary files a/src/com/android/browser/search/.DefaultSearchEngine.java.swp and /dev/null differ diff --git a/src/com/android/browser/search/DefaultSearchEngine.java b/src/com/android/browser/search/DefaultSearchEngine.java index 0a7afcf..a575404 100644 --- a/src/com/android/browser/search/DefaultSearchEngine.java +++ b/src/com/android/browser/search/DefaultSearchEngine.java @@ -15,6 +15,7 @@ */ package com.android.browser.search; +import android.app.PendingIntent; import android.app.SearchManager; import android.app.SearchableInfo; import android.content.ActivityNotFoundException; @@ -92,6 +93,12 @@ public class DefaultSearchEngine implements SearchEngine { intent.putExtra(SearchManager.EXTRA_DATA_KEY, extraData); } intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName()); + Intent viewIntent = new Intent(Intent.ACTION_VIEW); + viewIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + viewIntent.setPackage(context.getPackageName()); + PendingIntent pending = PendingIntent.getActivity(context, 0, viewIntent, + PendingIntent.FLAG_ONE_SHOT); + intent.putExtra(SearchManager.EXTRA_WEB_SEARCH_PENDINGINTENT, pending); context.startActivity(intent); } catch (ActivityNotFoundException ex) { Log.e(TAG, "Web search activity not found: " + mSearchable.getSearchActivity()); -- cgit v1.1