summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSatish Sampath <satish@android.com>2009-06-11 23:44:03 +0100
committerSatish Sampath <satish@android.com>2009-06-11 23:44:03 +0100
commit1983ac5904491be7ad158bdb8181cf170f004a02 (patch)
tree57d7ede8f160eb0c98b10f84977abce478ad3dec
parente4c571808e41ce182ebf063a72e9b0ffe1824bb9 (diff)
downloadGoogleSearch-1983ac5904491be7ad158bdb8181cf170f004a02.tar.gz
Use ACTION_SEARCH to launch search URLs.
This was done so that the browser can identify them as search requests and add location information to the request if enabled. Also adding internet permission to the manifest as without that it was throwing errors in the debug log infrequently (we need it anyway since this provider accesses the internet for google searches, but in the past it was running inside the acore process so perhaps was not required and this design may have changed now).
-rw-r--r--AndroidManifest.xml2
-rw-r--r--src/com/android/googlesearch/GoogleSearch.java6
2 files changed, 7 insertions, 1 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 0cd5033..055a1e7 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -21,6 +21,8 @@
package="com.android.googlesearch"
android:sharedUserId="android.uid.shared">
+ <uses-permission android:name="android.permission.INTERNET" />
+
<application
android:process="android.process.acore"
android:label="@string/search_label">
diff --git a/src/com/android/googlesearch/GoogleSearch.java b/src/com/android/googlesearch/GoogleSearch.java
index d429e3a..e704fb3 100644
--- a/src/com/android/googlesearch/GoogleSearch.java
+++ b/src/com/android/googlesearch/GoogleSearch.java
@@ -24,6 +24,7 @@ import java.util.Locale;
import android.app.Activity;
import android.app.SearchManager;
+import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
@@ -83,7 +84,10 @@ public class GoogleSearch extends Activity {
try {
String searchUri = googleSearchUrlBase + URLEncoder.encode(query, "UTF-8");
- Intent launchUriIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(searchUri));
+ Intent launchUriIntent = new Intent(Intent.ACTION_SEARCH);
+ launchUriIntent.putExtra(SearchManager.QUERY, searchUri);
+ launchUriIntent.setComponent(new ComponentName(
+ "com.android.browser", "com.android.browser.BrowserActivity"));
launchUriIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(launchUriIntent);
} catch (UnsupportedEncodingException e) {