Merge "user agent string change: remove "Mobile" for large screen configuration"
This commit is contained in:
@@ -19,6 +19,7 @@ package android.webkit;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@@ -107,7 +108,7 @@ public class WebSettings {
|
||||
* Use with {@link #setCacheMode}.
|
||||
*/
|
||||
public static final int LOAD_NO_CACHE = 2;
|
||||
|
||||
|
||||
/**
|
||||
* Don't use the network, load from cache only.
|
||||
* Use with {@link #setCacheMode}.
|
||||
@@ -432,11 +433,14 @@ public class WebSettings {
|
||||
buffer.append(" Build/");
|
||||
buffer.append(id);
|
||||
}
|
||||
String mobile = ((mContext.getResources().getConfiguration().screenLayout
|
||||
& Configuration.SCREENLAYOUT_SIZE_MASK)
|
||||
== Configuration.SCREENLAYOUT_SIZE_XLARGE) ? "" : "Mobile ";
|
||||
final String base = mContext.getResources().getText(
|
||||
com.android.internal.R.string.web_user_agent).toString();
|
||||
return String.format(base, buffer);
|
||||
return String.format(base, buffer, mobile);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enables dumping the pages navigation cache to a text file.
|
||||
*/
|
||||
@@ -488,14 +492,14 @@ public class WebSettings {
|
||||
mBuiltInZoomControls = enabled;
|
||||
mWebView.updateMultiTouchSupport(mContext);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the zoom mechanism built into WebView is being used.
|
||||
*/
|
||||
public boolean getBuiltInZoomControls() {
|
||||
return mBuiltInZoomControls;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enable or disable file access within WebView. File access is enabled by
|
||||
* default.
|
||||
@@ -1044,8 +1048,8 @@ public class WebSettings {
|
||||
|
||||
private void verifyNetworkAccess() {
|
||||
if (!mBlockNetworkLoads) {
|
||||
if (mContext.checkPermission("android.permission.INTERNET",
|
||||
android.os.Process.myPid(), android.os.Process.myUid()) !=
|
||||
if (mContext.checkPermission("android.permission.INTERNET",
|
||||
android.os.Process.myPid(), android.os.Process.myUid()) !=
|
||||
PackageManager.PERMISSION_GRANTED) {
|
||||
throw new SecurityException
|
||||
("Permission denied - " +
|
||||
@@ -1071,6 +1075,7 @@ public class WebSettings {
|
||||
* @deprecated This method has been deprecated in favor of
|
||||
* {@link #setPluginState}
|
||||
*/
|
||||
@Deprecated
|
||||
public synchronized void setPluginsEnabled(boolean flag) {
|
||||
setPluginState(PluginState.ON);
|
||||
}
|
||||
@@ -1260,6 +1265,7 @@ public class WebSettings {
|
||||
* @return True if plugins are enabled.
|
||||
* @deprecated This method has been replaced by {@link #getPluginState}
|
||||
*/
|
||||
@Deprecated
|
||||
public synchronized boolean getPluginsEnabled() {
|
||||
return mPluginState == PluginState.ON;
|
||||
}
|
||||
@@ -1328,7 +1334,7 @@ public class WebSettings {
|
||||
public synchronized void setUserAgentString(String ua) {
|
||||
if (ua == null || ua.length() == 0) {
|
||||
synchronized(sLockForLocaleSettings) {
|
||||
Locale currentLocale = Locale.getDefault();
|
||||
Locale currentLocale = Locale.getDefault();
|
||||
if (!sLocale.equals(currentLocale)) {
|
||||
sLocale = currentLocale;
|
||||
mAcceptLanguage = getCurrentAcceptLanguage();
|
||||
@@ -1383,11 +1389,11 @@ public class WebSettings {
|
||||
}
|
||||
return mAcceptLanguage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tell the WebView whether it needs to set a node to have focus when
|
||||
* {@link WebView#requestFocus(int, android.graphics.Rect)} is called.
|
||||
*
|
||||
*
|
||||
* @param flag
|
||||
*/
|
||||
public void setNeedInitialFocus(boolean flag) {
|
||||
@@ -1414,7 +1420,7 @@ public class WebSettings {
|
||||
EventHandler.PRIORITY));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Override the way the cache is used. The way the cache is used is based
|
||||
* on the navigation option. For a normal page load, the cache is checked
|
||||
@@ -1428,7 +1434,7 @@ public class WebSettings {
|
||||
mOverrideCacheMode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the current setting for overriding the cache mode. For a full
|
||||
* description, see the {@link #setCacheMode(int)} function.
|
||||
@@ -1436,7 +1442,7 @@ public class WebSettings {
|
||||
public int getCacheMode() {
|
||||
return mOverrideCacheMode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If set, webkit alternately shrinks and expands images viewed outside
|
||||
* of an HTML page to fit the screen. This conflicts with attempts by
|
||||
|
||||
@@ -1604,8 +1604,8 @@
|
||||
<string name="factorytest_reboot">Reboot</string>
|
||||
|
||||
<!-- Do not translate. WebView User Agent string -->
|
||||
<string name="web_user_agent" translatable="false"><xliff:g id="x">Mozilla/5.0 (Linux; U; Android %s)
|
||||
AppleWebKit/534.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.1</xliff:g></string>
|
||||
<string name="web_user_agent" translatable="false">Mozilla/5.0 (Linux; U; <xliff:g id="x">Android %s</xliff:g>)
|
||||
AppleWebKit/534.1 (KHTML, like Gecko) Version/4.0 <xliff:g id="mobile">%s</xliff:g>Safari/534.1</string>
|
||||
|
||||
<!-- Title for a JavaScript dialog. "The page at <url of current page> says:" -->
|
||||
<string name="js_dialog_title">The page at \'<xliff:g id="title">%s</xliff:g>\' says:</string>
|
||||
|
||||
Reference in New Issue
Block a user