Add client=android parameter to Google suggest client.
This is to be compliant with the suggest CGI API. Also updated user-agent
to include real Android version, instead of just '1.0'.
This is a cherry-pick of change I65fcac04bc513a9a197b0d95dbdd76a1d50a6b46
in Honeycomb.
Bug: 3327779
Change-Id: I5ca504ef61b55deb05b62fcca3995b169de278bc
diff --git a/res/values-mcc204/strings.xml b/res/values-mcc204/strings.xml
index 14c1b7c..b50731e 100644
--- a/res/values-mcc204/strings.xml
+++ b/res/values-mcc204/strings.xml
@@ -25,5 +25,5 @@
<!-- should be mirrored by changes in apps/Browser. -->
<!-- Do not translate. This string is an internal URI, not seen in the UI. -->
<string name="google_suggest_base" translatable="false">
- http://www.google.com/complete/search?hl=%1$s&gl=nl&</string>
+ http://www.google.com/complete/search?hl=%1$s&gl=nl&client=android&q=</string>
</resources>
diff --git a/res/values-mcc230/strings.xml b/res/values-mcc230/strings.xml
index faa7784..ee535af 100644
--- a/res/values-mcc230/strings.xml
+++ b/res/values-mcc230/strings.xml
@@ -24,5 +24,5 @@
<!-- should be mirrored by changes in apps/Browser. -->
<!-- Do not translate. This string is an internal URI, not seen in the UI. -->
<string name="google_suggest_base" translatable="false">
- http://www.google.com/complete/search?hl=%1$s&gl=cz&</string>
+ http://www.google.com/complete/search?hl=%1$s&gl=cz&client=android&q=</string>
</resources>
diff --git a/res/values-mcc232/strings.xml b/res/values-mcc232/strings.xml
index c1fb564..ef7fd3c 100644
--- a/res/values-mcc232/strings.xml
+++ b/res/values-mcc232/strings.xml
@@ -24,5 +24,5 @@
<!-- should be mirrored by changes in apps/Browser. -->
<!-- Do not translate. This string is an internal URI, not seen in the UI. -->
<string name="google_suggest_base" translatable="false">
- http://www.google.com/complete/search?hl=%1$s&gl=at&</string>
+ http://www.google.com/complete/search?hl=%1$s&gl=at&client=android&q=</string>
</resources>
diff --git a/res/values-mcc260/strings.xml b/res/values-mcc260/strings.xml
index 6eb1ad6..5b6ef54 100644
--- a/res/values-mcc260/strings.xml
+++ b/res/values-mcc260/strings.xml
@@ -23,5 +23,5 @@
<!-- don't support this countries locale. -->
<!-- Any changes to this (especially in terms of adding/removing the MCC-specific flavors) -->
<!-- should be mirrored by changes in apps/Browser. -->
- <string translatable="false" name="google_suggest_base">http://www.google.com/complete/search?hl=%1$s&gl=pl&</string>
+ <string translatable="false" name="google_suggest_base">http://www.google.com/complete/search?hl=%1$s&gl=pl&client=android&q=</string>
</resources>
diff --git a/res/values-mcc262/strings.xml b/res/values-mcc262/strings.xml
index 1d191a9..5208c28 100644
--- a/res/values-mcc262/strings.xml
+++ b/res/values-mcc262/strings.xml
@@ -24,5 +24,5 @@
<!-- should be mirrored by changes in apps/Browser. -->
<!-- Do not translate. This string is an internal URI, not seen in the UI. -->
<string name="google_suggest_base" translatable="false">
- http://www.google.com/complete/search?hl=%1$s&gl=de&</string>
+ http://www.google.com/complete/search?hl=%1$s&gl=de&client=android&q=</string>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 75cafc4..f3a0631 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -122,6 +122,6 @@
<!-- should be mirrored by changes in GenieProvider -->
<!-- Do not translate. This string is an internal URI, not seen in the UI. -->
<string name="google_suggest_base" translatable="false">
- http://www.google.com/complete/search?hl=%1$s&gl=%2$s&</string>
+ http://www.google.com/complete/search?hl=%1$s&gl=%2$s&client=android&q=</string>
</resources>
diff --git a/src/com/android/quicksearchbox/google/GoogleSuggestClient.java b/src/com/android/quicksearchbox/google/GoogleSuggestClient.java
index e903a5c..5902b02 100644
--- a/src/com/android/quicksearchbox/google/GoogleSuggestClient.java
+++ b/src/com/android/quicksearchbox/google/GoogleSuggestClient.java
@@ -35,6 +35,7 @@
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
+import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
@@ -51,7 +52,7 @@
private static final boolean DBG = false;
private static final String LOG_TAG = "GoogleSearch";
- private static final String USER_AGENT = "Android/1.0";
+ private static final String USER_AGENT = "Android/" + Build.VERSION.RELEASE;
private String mSuggestUri;
private static final int HTTP_TIMEOUT_MS = 1000;
@@ -134,8 +135,7 @@
}
mSuggestUri = getContext().getResources().getString(R.string.google_suggest_base,
language,
- country)
- + "json=true&q=";
+ country);
}
String suggestUri = mSuggestUri + query;