diff options
-rw-r--r-- | res/values/strings.xml | 4 | ||||
-rw-r--r-- | src/com/android/browser/BrowserProvider.java | 24 | ||||
-rw-r--r-- | src/com/android/browser/provider/BrowserProvider2.java | 4 |
3 files changed, 22 insertions, 10 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 9684fcf..e754ea9 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -815,10 +815,10 @@ user signs up the device with a Google sites account, the site's domain will be appended. --> <string name="homepage_base" translatable="false"> - http://www.google.com/webhp?client=ms-{CID}&source=android-home</string> + http://www.google.com/webhp?client={CID}&source=android-home</string> <!-- The default url for the instant_base_page. --> <string name="instant_base" translatable="false"> - http://www.google.com/webhp?client=ms-{CID}&source=android-omnibox-instant&ion=1</string> + http://www.google.com/webhp?client={CID}&source=android-omnibox-instant&ion=1</string> <!-- Bookmarks --> <string-array name="bookmarks" translatable="false"> diff --git a/src/com/android/browser/BrowserProvider.java b/src/com/android/browser/BrowserProvider.java index cba16a0..f69665c 100644 --- a/src/com/android/browser/BrowserProvider.java +++ b/src/com/android/browser/BrowserProvider.java @@ -181,18 +181,30 @@ public class BrowserProvider extends ContentProvider { // its content provider. http://b/issue?id=2425179 static String getClientId(ContentResolver cr) { String ret = "android-google"; - Cursor c = null; + Cursor legacyClientIdCursor = null; + Cursor searchClientIdCursor = null; + + // search_client_id includes search prefix, legacy client_id does not include prefix try { - c = cr.query(Uri.parse("content://com.google.settings/partner"), + searchClientIdCursor = cr.query(Uri.parse("content://com.google.settings/partner"), + new String[] { "value" }, "name='search_client_id'", null, null); + if (searchClientIdCursor != null && searchClientIdCursor.moveToNext()) { + ret = searchClientIdCursor.getString(0); + } else { + legacyClientIdCursor = cr.query(Uri.parse("content://com.google.settings/partner"), new String[] { "value" }, "name='client_id'", null, null); - if (c != null && c.moveToNext()) { - ret = c.getString(0); + if (legacyClientIdCursor != null && legacyClientIdCursor.moveToNext()) { + ret = "ms-" + legacyClientIdCursor.getString(0); + } } } catch (RuntimeException ex) { // fall through to return the default } finally { - if (c != null) { - c.close(); + if (legacyClientIdCursor != null) { + legacyClientIdCursor.close(); + } + if (searchClientIdCursor != null) { + searchClientIdCursor.close(); } } return ret; diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java index 305c794..d154f20 100644 --- a/src/com/android/browser/provider/BrowserProvider2.java +++ b/src/com/android/browser/provider/BrowserProvider2.java @@ -1266,11 +1266,11 @@ public class BrowserProvider2 extends SQLiteContentProvider { } } - // Filters out the client=ms- param for search urls + // Filters out the client= param for search urls private String filterSearchClient(String url) { // remove "client" before updating it to the history so that it wont // show up in the auto-complete list. - int index = url.indexOf("client=ms-"); + int index = url.indexOf("client="); if (index > 0 && url.contains(".google.")) { int end = url.indexOf('&', index); if (end > 0) { |