Deprecate various WebView related methods
WebSettings:
PluginState - plugins depreacted and will not be supported in future.
setRenderPriotity - b/6335436
setLightTouchEnabled - b/7683972 it's s no-op.
setAppCacheMaxSize - has a sensible default and will be obsolete in
future with HTML Quota Management API. b/6236763
WebStorage.setQuotaForOrigin - same as setAppCacheMaxSize
WebView:
clearView, showFindDialog - buggy, can be achieved otherways
savePassword - not useful/usable in practice; see b/5012826
- stock browser used hidden APIs to achieve this feature
WebIconDatabase:
Other than the open() method, this does nothing useful. b/7331507
Change-Id: I01793f7b34978046eb54033477fca2da96e69c2e
diff --git a/api/current.txt b/api/current.txt
index 86353d1..3e60881 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -27453,7 +27453,7 @@
method public java.lang.String getUrl();
}
- public class WebIconDatabase {
+ public deprecated class WebIconDatabase {
method public void close();
method public static android.webkit.WebIconDatabase getInstance();
method public void open(java.lang.String);
@@ -27463,7 +27463,7 @@
method public void retainIconForPageUrl(java.lang.String);
}
- public static abstract interface WebIconDatabase.IconListener {
+ public static abstract deprecated interface WebIconDatabase.IconListener {
method public abstract void onReceivedIcon(java.lang.String, android.graphics.Bitmap);
}
@@ -27502,18 +27502,18 @@
method public synchronized boolean getJavaScriptCanOpenWindowsAutomatically();
method public synchronized boolean getJavaScriptEnabled();
method public synchronized android.webkit.WebSettings.LayoutAlgorithm getLayoutAlgorithm();
- method public boolean getLightTouchEnabled();
+ method public deprecated boolean getLightTouchEnabled();
method public boolean getLoadWithOverviewMode();
method public synchronized boolean getLoadsImagesAutomatically();
method public boolean getMediaPlaybackRequiresUserGesture();
method public synchronized int getMinimumFontSize();
method public synchronized int getMinimumLogicalFontSize();
- method public synchronized android.webkit.WebSettings.PluginState getPluginState();
+ method public deprecated synchronized android.webkit.WebSettings.PluginState getPluginState();
method public deprecated synchronized boolean getPluginsEnabled();
method public deprecated synchronized java.lang.String getPluginsPath();
method public synchronized java.lang.String getSansSerifFontFamily();
method public boolean getSaveFormData();
- method public boolean getSavePassword();
+ method public deprecated boolean getSavePassword();
method public synchronized java.lang.String getSerifFontFamily();
method public synchronized java.lang.String getStandardFontFamily();
method public deprecated synchronized android.webkit.WebSettings.TextSize getTextSize();
@@ -27525,7 +27525,7 @@
method public abstract void setAllowFileAccessFromFileURLs(boolean);
method public abstract void setAllowUniversalAccessFromFileURLs(boolean);
method public synchronized void setAppCacheEnabled(boolean);
- method public synchronized void setAppCacheMaxSize(long);
+ method public deprecated synchronized void setAppCacheMaxSize(long);
method public synchronized void setAppCachePath(java.lang.String);
method public synchronized void setBlockNetworkImage(boolean);
method public synchronized void setBlockNetworkLoads(boolean);
@@ -27548,20 +27548,20 @@
method public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean);
method public synchronized void setJavaScriptEnabled(boolean);
method public synchronized void setLayoutAlgorithm(android.webkit.WebSettings.LayoutAlgorithm);
- method public void setLightTouchEnabled(boolean);
+ method public deprecated void setLightTouchEnabled(boolean);
method public void setLoadWithOverviewMode(boolean);
method public synchronized void setLoadsImagesAutomatically(boolean);
method public void setMediaPlaybackRequiresUserGesture(boolean);
method public synchronized void setMinimumFontSize(int);
method public synchronized void setMinimumLogicalFontSize(int);
method public void setNeedInitialFocus(boolean);
- method public synchronized void setPluginState(android.webkit.WebSettings.PluginState);
+ method public deprecated synchronized void setPluginState(android.webkit.WebSettings.PluginState);
method public deprecated synchronized void setPluginsEnabled(boolean);
method public deprecated synchronized void setPluginsPath(java.lang.String);
- method public synchronized void setRenderPriority(android.webkit.WebSettings.RenderPriority);
+ method public deprecated synchronized void setRenderPriority(android.webkit.WebSettings.RenderPriority);
method public synchronized void setSansSerifFontFamily(java.lang.String);
method public void setSaveFormData(boolean);
- method public void setSavePassword(boolean);
+ method public deprecated void setSavePassword(boolean);
method public synchronized void setSerifFontFamily(java.lang.String);
method public synchronized void setStandardFontFamily(java.lang.String);
method public synchronized void setSupportMultipleWindows(boolean);
@@ -27628,7 +27628,7 @@
method public void getOrigins(android.webkit.ValueCallback<java.util.Map>);
method public void getQuotaForOrigin(java.lang.String, android.webkit.ValueCallback<java.lang.Long>);
method public void getUsageForOrigin(java.lang.String, android.webkit.ValueCallback<java.lang.Long>);
- method public void setQuotaForOrigin(java.lang.String, long);
+ method public deprecated void setQuotaForOrigin(java.lang.String, long);
}
public static class WebStorage.Origin {
@@ -27671,7 +27671,7 @@
method public void clearHistory();
method public void clearMatches();
method public void clearSslPreferences();
- method public void clearView();
+ method public deprecated void clearView();
method public android.webkit.WebBackForwardList copyBackForwardList();
method public void destroy();
method public void documentHasImages(android.os.Message);
@@ -27718,7 +27718,7 @@
method public void requestImageRef(android.os.Message);
method public android.webkit.WebBackForwardList restoreState(android.os.Bundle);
method public void resumeTimers();
- method public void savePassword(java.lang.String, java.lang.String, java.lang.String);
+ method public deprecated void savePassword(java.lang.String, java.lang.String, java.lang.String);
method public android.webkit.WebBackForwardList saveState(android.os.Bundle);
method public void saveWebArchive(java.lang.String);
method public void saveWebArchive(java.lang.String, boolean, android.webkit.ValueCallback<java.lang.String>);
@@ -27734,7 +27734,7 @@
method public void setVerticalScrollbarOverlay(boolean);
method public void setWebChromeClient(android.webkit.WebChromeClient);
method public void setWebViewClient(android.webkit.WebViewClient);
- method public boolean showFindDialog(java.lang.String, boolean);
+ method public deprecated boolean showFindDialog(java.lang.String, boolean);
method public void stopLoading();
method public boolean zoomIn();
method public boolean zoomOut();
diff --git a/core/java/android/webkit/WebIconDatabase.java b/core/java/android/webkit/WebIconDatabase.java
index 99f20ff..787997b 100644
--- a/core/java/android/webkit/WebIconDatabase.java
+++ b/core/java/android/webkit/WebIconDatabase.java
@@ -25,11 +25,19 @@
* and WebView.getIconDatabase() will return a WebIconDatabase object. This
* WebIconDatabase object is a single instance and all methods operate on that
* single object.
+ * The main use-case for this class is calling {@link WebIconDatabase#open()}
+ * to enable favicon functionality on all WebView instances in this process.
+ *
+ * @deprecated This class is only required when running on devices
+ * up to {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
*/
+@Deprecated
public class WebIconDatabase {
/**
* Interface for receiving icons from the database.
+ * @deprecated
*/
+ @Deprecated
public interface IconListener {
/**
* Called when the icon has been retrieved from the database and the
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 728bcd3..a69c8cfd 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -422,7 +422,9 @@
/**
* Sets whether the WebView should save passwords. The default is true.
+ * @deprecated Saving passwords in WebView will not be supported in future versions.
*/
+ @Deprecated
public void setSavePassword(boolean save) {
throw new MustOverrideException();
}
@@ -432,7 +434,9 @@
*
* @return whether the WebView saves passwords
* @see #setSavePassword
+ * @deprecated Saving passwords in WebView will not be supported in future versions.
*/
+ @Deprecated
public boolean getSavePassword() {
throw new MustOverrideException();
}
@@ -515,18 +519,20 @@
/**
* Enables using light touches to make a selection and activate mouseovers.
- * The default is false.
+ * @deprecated From {@link android.os.Build.VERSION_CODES#JELLY_BEAN} this
+ * setting is obsolete and has no effect.
*/
+ @Deprecated
public void setLightTouchEnabled(boolean enabled) {
throw new MustOverrideException();
}
/**
* Gets whether light touches are enabled.
- *
- * @return whether light touches are enabled
* @see #setLightTouchEnabled
+ * @deprecated
*/
+ @Deprecated
public boolean getLightTouchEnabled() {
throw new MustOverrideException();
}
@@ -1012,7 +1018,9 @@
* {@link PluginState#OFF}.
*
* @param state a PluginState value
+ * @deprecated Plugins will not be supported in future, and should not be used.
*/
+ @Deprecated
public synchronized void setPluginState(PluginState state) {
throw new MustOverrideException();
}
@@ -1091,9 +1099,12 @@
* this should be viewed as a guide, not a hard limit. Setting the
* size to a value less than current database size does not cause the
* database to be trimmed. The default size is {@link Long#MAX_VALUE}.
+ * It is recommended to leave the maximum size set to the default value.
*
* @param appCacheMaxSize the maximum size in bytes
+ * @deprecated In future quota will be managed automatically.
*/
+ @Deprecated
public synchronized void setAppCacheMaxSize(long appCacheMaxSize) {
throw new MustOverrideException();
}
@@ -1219,7 +1230,9 @@
*
* @return the plugin state as a {@link PluginState} value
* @see #setPluginState
+ * @deprecated Plugins will not be supported in future, and should not be used.
*/
+ @Deprecated
public synchronized PluginState getPluginState() {
throw new MustOverrideException();
}
@@ -1324,7 +1337,10 @@
* {@link RenderPriority#NORMAL}.
*
* @param priority the priority
+ * @deprecated It is not recommended to adjust thread priorities, and this will
+ * not be supported in future versions.
*/
+ @Deprecated
public synchronized void setRenderPriority(RenderPriority priority) {
throw new MustOverrideException();
}
diff --git a/core/java/android/webkit/WebStorage.java b/core/java/android/webkit/WebStorage.java
index 1e955bd..7d9373c 100644
--- a/core/java/android/webkit/WebStorage.java
+++ b/core/java/android/webkit/WebStorage.java
@@ -171,7 +171,9 @@
* The quota is specified in bytes and the origin is specified using its string
* representation. Note that a quota is not enforced on a per-origin basis
* for the Application Cache API.
+ * @deprecated Controlling quota per-origin will not be supported in future.
*/
+ @Deprecated
public void setQuotaForOrigin(String origin, long quota) {
// Must be a no-op for backward compatibility: see the hidden constructor for reason.
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 1321515..f780193 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -601,7 +601,9 @@
* @param password the password for the given host
* @see WebViewDatabase#clearUsernamePassword
* @see WebViewDatabase#hasUsernamePassword
+ * @deprecated Saving passwords in WebView will not be supported in future versions.
*/
+ @Deprecated
public void savePassword(String host, String username, String password) {
checkThread();
mProvider.savePassword(host, username, password);
@@ -998,7 +1000,10 @@
/**
* Clears this WebView so that onDraw() will draw nothing but white background,
* and onMeasure() will return 0 if MeasureSpec is not MeasureSpec.EXACTLY.
+ * @deprecated Use WebView.loadUrl("about:blank") to reliably reset the view state
+ * and release page resources (including any running JavaScript).
*/
+ @Deprecated
public void clearView() {
checkThread();
mProvider.clearView();
@@ -1388,7 +1393,11 @@
* @param showIme if true, show the IME, assuming the user will begin typing.
* If false and text is non-null, perform a find all.
* @return true if the find dialog is shown, false otherwise
+ * @deprecated This method does not work reliably on all Android versions;
+ * implementing a custom find dialog using WebView.findAllAsync()
+ * provides a more robust solution.
*/
+ @Deprecated
public boolean showFindDialog(String text, boolean showIme) {
checkThread();
return mProvider.showFindDialog(text, showIme);