Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13c24022 authored by Torne (Richard Coles)'s avatar Torne (Richard Coles)
Browse files

Remove WebView AppCache APIs.

These are no-ops since WebView 95; remove them from the SDK to make it
clear to apps that they're nonfunctional.

Bug: 199287927
Test: atest CtsWebkitTestCases
Change-Id: I498aff6f8a0c2901504d777f597dbf77f982cd3a
parent 0a25520f
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -53434,7 +53434,6 @@ package android.webkit {
    method public void onPermissionRequest(android.webkit.PermissionRequest);
    method public void onPermissionRequestCanceled(android.webkit.PermissionRequest);
    method public void onProgressChanged(android.webkit.WebView, int);
    method @Deprecated public void onReachedMaxAppCacheSize(long, long, android.webkit.WebStorage.QuotaUpdater);
    method public void onReceivedIcon(android.webkit.WebView, android.graphics.Bitmap);
    method public void onReceivedTitle(android.webkit.WebView, String);
    method public void onReceivedTouchIconUrl(android.webkit.WebView, String, boolean);
@@ -53586,9 +53585,6 @@ package android.webkit {
    method public abstract void setAllowFileAccess(boolean);
    method @Deprecated public abstract void setAllowFileAccessFromFileURLs(boolean);
    method @Deprecated public abstract void setAllowUniversalAccessFromFileURLs(boolean);
    method @Deprecated public abstract void setAppCacheEnabled(boolean);
    method @Deprecated public abstract void setAppCacheMaxSize(long);
    method @Deprecated public abstract void setAppCachePath(String);
    method public abstract void setBlockNetworkImage(boolean);
    method public abstract void setBlockNetworkLoads(boolean);
    method public abstract void setBuiltInZoomControls(boolean);
+10 −0
Original line number Diff line number Diff line
@@ -568,6 +568,16 @@ package android.view.translation {

package android.webkit {

  public class WebChromeClient {
    method @Deprecated public void onReachedMaxAppCacheSize(long, long, android.webkit.WebStorage.QuotaUpdater);
  }

  public abstract class WebSettings {
    method @Deprecated public void setAppCacheEnabled(boolean);
    method @Deprecated public void setAppCacheMaxSize(long);
    method @Deprecated public void setAppCachePath(String);
  }

  public class WebViewClient {
    method public void onUnhandledInputEvent(android.webkit.WebView, android.view.InputEvent);
  }
+2 −0
Original line number Diff line number Diff line
@@ -376,6 +376,8 @@ public class WebChromeClient {
    *                     must be used to inform the WebView of the new quota.
    * @deprecated This method is no longer called; WebView now uses the HTML5 / JavaScript Quota
    *             Management API.
    * @removed This method is no longer called; WebView now uses the HTML5 / JavaScript Quota
    *          Management API.
    */
    @Deprecated
    public void onReachedMaxAppCacheSize(long requiredStorage, long quota,
+12 −3
Original line number Diff line number Diff line
@@ -1131,8 +1131,12 @@ public abstract class WebSettings {
     *             become a no-op on all Android versions once support is
     *             removed in Chromium. Consider using Service Workers instead.
     *             See https://web.dev/appcache-removal/ for more information.
     * @removed The Application Cache API is no longer supported and this method
     *          is a no-op on WebView 95 and later. Consider using Service Workers
     *          instead. See https://web.dev/appcache-removal/ for more information.
     */
    public abstract void setAppCacheEnabled(boolean flag);
    @Deprecated
    public void setAppCacheEnabled(boolean flag) {}

    /**
     * Sets the path to the Application Caches files. In order for the
@@ -1147,8 +1151,12 @@ public abstract class WebSettings {
     *             become a no-op on all Android versions once support is
     *             removed in Chromium. Consider using Service Workers instead.
     *             See https://web.dev/appcache-removal/ for more information.
     * @removed The Application Cache API is no longer supported and this method
     *          is a no-op on WebView 95 and later. Consider using Service Workers
     *          instead. See https://web.dev/appcache-removal/ for more information.
     */
    public abstract void setAppCachePath(String appCachePath);
    @Deprecated
    public void setAppCachePath(String appCachePath) {}

    /**
     * Sets the maximum size for the Application Cache content. The passed size
@@ -1160,9 +1168,10 @@ public abstract class WebSettings {
     *
     * @param appCacheMaxSize the maximum size in bytes
     * @deprecated Quota is managed automatically; this method is a no-op.
     * @removed Quota is managed automatically; this method is a no-op.
     */
    @Deprecated
    public abstract void setAppCacheMaxSize(long appCacheMaxSize);
    public void setAppCacheMaxSize(long appCacheMaxSize) {}

    /**
     * Sets whether the database storage API is enabled. The default value is
+16 −27
Original line number Diff line number Diff line
@@ -22,18 +22,12 @@ import java.util.Map;

/**
 * This class is used to manage the JavaScript storage APIs provided by the
 * {@link WebView}. It manages the Application Cache API, the Web SQL Database
 * API and the HTML5 Web Storage API.
 *
 * The Application Cache API provides a mechanism to create and maintain an
 * application cache to power offline Web applications. Use of the Application
 * Cache API can be attributed to an origin {@link WebStorage.Origin}, however
 * it is not possible to set per-origin quotas. Note that there can be only
 * one application cache per application.
 * {@link WebView}. It manages the Web SQL Database API and the HTML5 Web
 * Storage API.
 *
 * The Web SQL Database API provides storage which is private to a given origin.
 * Similar to the Application Cache, use of the Web SQL Database can be attributed
 * to an origin. It is also possible to set per-origin quotas.
 * Use of the Web SQL Database can be attributed to an origin. It is also
 * possible to set per-origin quotas.
 */
public class WebStorage {

@@ -41,8 +35,7 @@ public class WebStorage {
     * Encapsulates a callback function which is used to provide a new quota
     * for a JavaScript storage API.
     * See
     * {@link WebChromeClient#onExceededDatabaseQuota} and
     * {@link WebChromeClient#onReachedMaxAppCacheSize}.
     * {@link WebChromeClient#onExceededDatabaseQuota}.
     * @deprecated This class is obsolete and no longer used.
     */
    @Deprecated
@@ -123,9 +116,9 @@ public class WebStorage {
     */

    /**
     * Gets the origins currently using either the Application Cache or Web SQL
     * Database APIs. This method operates asynchronously, with the result
     * being provided via a {@link ValueCallback}. The origins are provided as
     * Gets the origins currently using the Web SQL Database APIs. This method
     * operates asynchronously, with the result being provided via a
     * {@link ValueCallback}. The origins are provided as
     * a map, of type {@code Map<String, WebStorage.Origin>}, from the string
     * representation of the origin to a {@link WebStorage.Origin} object.
     */
@@ -134,9 +127,9 @@ public class WebStorage {
    }

    /**
     * Gets the amount of storage currently being used by both the Application
     * Cache and Web SQL Database APIs by the given origin. The amount is given
     * in bytes and the origin is specified using its string representation.
     * Gets the amount of storage currently being used by the Web SQL Database
     * APIs by the given origin. The amount is given in bytes and the origin
     * is specified using its string representation.
     * This method operates asynchronously, with the result being provided via
     * a {@link ValueCallback}.
     */
@@ -148,8 +141,7 @@ public class WebStorage {
     * Gets the storage quota for the Web SQL Database API for the given origin.
     * The quota is given in bytes and the origin is specified using its string
     * representation. This method operates asynchronously, with the result
     * being provided via a {@link ValueCallback}. Note that a quota is not
     * enforced on a per-origin basis for the Application Cache API.
     * being provided via a {@link ValueCallback}.
     */
    public void getQuotaForOrigin(String origin, ValueCallback<Long> callback) {
        // Must be a no-op for backward compatibility: see the hidden constructor for reason.
@@ -158,8 +150,7 @@ public class WebStorage {
    /**
     * Sets the storage quota for the Web SQL Database API for the given origin.
     * 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.
     * representation.
     * @deprecated Controlling quota per-origin will not be supported in future.
     */
    @Deprecated
@@ -168,9 +159,8 @@ public class WebStorage {
    }

    /**
     * Clears the storage currently being used by both the Application Cache and
     * Web SQL Database APIs by the given origin. The origin is specified using
     * its string representation.
     * Clears the storage currently being used by the Web SQL Database APIs by
     * the given origin. The origin is specified using its string representation.
     */
    public void deleteOrigin(String origin) {
        // Must be a no-op for backward compatibility: see the hidden constructor for reason.
@@ -178,8 +168,7 @@ public class WebStorage {

    /**
     * Clears all storage currently being used by the JavaScript storage APIs.
     * This includes the Application Cache, Web SQL Database and the HTML5 Web
     * Storage APIs.
     * This includes Web SQL Database and the HTML5 Web Storage APIs.
     */
    public void deleteAllData() {
        // Must be a no-op for backward compatibility: see the hidden constructor for reason.