DO NOT MERGE Use previous version if version is a codename
When the version is reported as a codename, use the previous version in the user agent string. Bug: 4347787 Change-Id: I4ed804a7334d6ca242446176ff042c4ac7938a0f
This commit is contained in:
@@ -19,7 +19,6 @@ package android.webkit;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@@ -139,6 +138,9 @@ public class WebSettings {
|
||||
OFF
|
||||
}
|
||||
|
||||
// TODO: Keep this up to date
|
||||
private static final String PREVIOUS_VERSION = "3.1";
|
||||
|
||||
// WebView associated with this WebSettings.
|
||||
private WebView mWebView;
|
||||
// BrowserFrame used to access the native frame pointer.
|
||||
@@ -471,7 +473,14 @@ public class WebSettings {
|
||||
// Add version
|
||||
final String version = Build.VERSION.RELEASE;
|
||||
if (version.length() > 0) {
|
||||
buffer.append(version);
|
||||
if (Character.isDigit(version.charAt(0))) {
|
||||
// Release is a version, eg "3.1"
|
||||
buffer.append(version);
|
||||
} else {
|
||||
// Release is a codename, eg "Honeycomb"
|
||||
// In this case, use the previous release's version
|
||||
buffer.append(PREVIOUS_VERSION);
|
||||
}
|
||||
} else {
|
||||
// default to "1.0"
|
||||
buffer.append("1.0");
|
||||
|
||||
Reference in New Issue
Block a user