diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2013-06-21 00:48:53 +0100 |
---|---|---|
committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2013-06-21 18:22:55 +0100 |
commit | 09abf58fc98130df8ebcb3fbb79d1160d933d2ac (patch) | |
tree | d5082a5ca00225b167d2f67e125d108d64d0b741 /core/java | |
parent | 12c158f05ca43e941f9e971ffd51256db2f74557 (diff) | |
download | frameworks_base-09abf58fc98130df8ebcb3fbb79d1160d933d2ac.zip frameworks_base-09abf58fc98130df8ebcb3fbb79d1160d933d2ac.tar.gz frameworks_base-09abf58fc98130df8ebcb3fbb79d1160d933d2ac.tar.bz2 |
WebSettings: Move CM tag to the end of the user-agent
Append it at the end of everything to make it less obtrusive to
agent parsers, and append the CM device identifier so we can present
smarter choices when our sites are accessed.
Change-Id: I1e60d13be4cca9043e434a31bfc4fa08e01a12c0
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/webkit/WebSettingsClassic.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/core/java/android/webkit/WebSettingsClassic.java b/core/java/android/webkit/WebSettingsClassic.java index d012382..fdbe460 100644 --- a/core/java/android/webkit/WebSettingsClassic.java +++ b/core/java/android/webkit/WebSettingsClassic.java @@ -435,14 +435,21 @@ public class WebSettingsClassic extends WebSettings { buffer.append(" Build/"); buffer.append(id); } - final String cmversion = SystemProperties.get("ro.cm.version"); - if (cmversion != null && cmversion.length() > 0) - buffer.append("; CyanogenMod-" + cmversion.replaceAll("([0-9\\.]+?)-.*","$1")); String mobile = context.getResources().getText( com.android.internal.R.string.web_user_agent_target_content).toString(); final String base = context.getResources().getText( com.android.internal.R.string.web_user_agent).toString(); - return String.format(base, buffer, mobile); + + String cmtag = ""; + final String cmversion = SystemProperties.get("ro.cm.version"); + if (cmversion != null && cmversion.length() > 0) { + cmtag = " CyanogenMod/" + cmversion.replaceAll("([0-9\\.]+?)-.*","$1"); + final String cmdevice = SystemProperties.get("ro.cm.device"); + if (cmdevice != null && cmdevice.length() > 0) + cmtag = cmtag.concat("/" + cmdevice); + } + + return String.format(base, buffer, mobile).concat(cmtag); } /** |