diff options
author | Ignacio Solla <igsolla@google.com> | 2014-11-13 15:20:29 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-13 15:20:29 +0000 |
commit | b993a4c70b55344d35b0435cd3cdbb29c3a50809 (patch) | |
tree | 4ce3dde9c51eb3e6f547be49c37e679e1bc2fbfe /core/java/android/webkit | |
parent | a3b4ab20156a06ffecb76e82852f904db3a39473 (diff) | |
parent | f3bd15cf80ecc748fbd232fec31fdf18d06e48a1 (diff) | |
download | frameworks_base-b993a4c70b55344d35b0435cd3cdbb29c3a50809.zip frameworks_base-b993a4c70b55344d35b0435cd3cdbb29c3a50809.tar.gz frameworks_base-b993a4c70b55344d35b0435cd3cdbb29c3a50809.tar.bz2 |
am f3bd15cf: am bf79cbab: Merge "[WebView] Allow the WebView to be compiled against the system SDK." into lmp-mr1-dev
* commit 'f3bd15cf80ecc748fbd232fec31fdf18d06e48a1':
[WebView] Allow the WebView to be compiled against the system SDK.
Diffstat (limited to 'core/java/android/webkit')
23 files changed, 277 insertions, 603 deletions
diff --git a/core/java/android/webkit/CookieManager.java b/core/java/android/webkit/CookieManager.java index 20ef646..eca96f9 100644 --- a/core/java/android/webkit/CookieManager.java +++ b/core/java/android/webkit/CookieManager.java @@ -16,18 +16,14 @@ package android.webkit; +import android.annotation.SystemApi; import android.net.WebAddress; /** * Manages the cookies used by an application's {@link WebView} instances. * Cookies are manipulated according to RFC2109. */ -public class CookieManager { - /** - * @hide Only for use by WebViewProvider implementations - */ - protected CookieManager() { - } +public abstract class CookieManager { @Override protected Object clone() throws CloneNotSupportedException { @@ -59,9 +55,7 @@ public class CookieManager { * @param accept whether {@link WebView} instances should send and accept * cookies */ - public synchronized void setAcceptCookie(boolean accept) { - throw new MustOverrideException(); - } + public abstract void setAcceptCookie(boolean accept); /** * Gets whether the application's {@link WebView} instances send and accept @@ -69,9 +63,7 @@ public class CookieManager { * * @return true if {@link WebView} instances send and accept cookies */ - public synchronized boolean acceptCookie() { - throw new MustOverrideException(); - } + public abstract boolean acceptCookie(); /** * Sets whether the {@link WebView} should allow third party cookies to be set. @@ -87,9 +79,7 @@ public class CookieManager { * @param accept whether the {@link WebView} instance should accept * third party cookies */ - public void setAcceptThirdPartyCookies(WebView webview, boolean accept) { - throw new MustOverrideException(); - } + public abstract void setAcceptThirdPartyCookies(WebView webview, boolean accept); /** * Gets whether the {@link WebView} should allow third party cookies to be set. @@ -97,9 +87,7 @@ public class CookieManager { * @param webview the {@link WebView} instance to get the cookie policy for * @return true if the {@link WebView} accepts third party cookies */ - public boolean acceptThirdPartyCookies(WebView webview) { - throw new MustOverrideException(); - } + public abstract boolean acceptThirdPartyCookies(WebView webview); /** * Sets a cookie for the given URL. Any existing cookie with the same host, @@ -110,9 +98,7 @@ public class CookieManager { * @param value the cookie as a string, using the format of the 'Set-Cookie' * HTTP response header */ - public void setCookie(String url, String value) { - throw new MustOverrideException(); - } + public abstract void setCookie(String url, String value); /** * Sets a cookie for the given URL. Any existing cookie with the same host, @@ -133,9 +119,7 @@ public class CookieManager { * HTTP response header * @param callback a callback to be executed when the cookie has been set */ - public void setCookie(String url, String value, ValueCallback<Boolean> callback) { - throw new MustOverrideException(); - } + public abstract void setCookie(String url, String value, ValueCallback<Boolean> callback); /** * Gets the cookies for the given URL. @@ -144,9 +128,7 @@ public class CookieManager { * @return value the cookies as a string, using the format of the 'Cookie' * HTTP request header */ - public String getCookie(String url) { - throw new MustOverrideException(); - } + public abstract String getCookie(String url); /** * See {@link #getCookie(String)}. @@ -155,11 +137,10 @@ public class CookieManager { * @param privateBrowsing whether to use the private browsing cookie jar * @return value the cookies as a string, using the format of the 'Cookie' * HTTP request header - * @hide Used by Browser, no intention to publish. + * @hide Used by Browser and by WebViewProvider implementations. */ - public String getCookie(String url, boolean privateBrowsing) { - throw new MustOverrideException(); - } + @SystemApi + public abstract String getCookie(String url, boolean privateBrowsing); /** * Gets cookie(s) for a given uri so that it can be set to "cookie:" in http @@ -168,10 +149,11 @@ public class CookieManager { * @param uri the WebAddress for which the cookies are requested * @return value the cookies as a string, using the format of the 'Cookie' * HTTP request header - * @hide Used by RequestHandle, no intention to publish. + * @hide Used by RequestHandle and by WebViewProvider implementations. */ + @SystemApi public synchronized String getCookie(WebAddress uri) { - throw new MustOverrideException(); + return getCookie(uri.toString()); } /** @@ -179,9 +161,7 @@ public class CookieManager { * date. * @deprecated use {@link #removeSessionCookies(ValueCallback)} instead. */ - public void removeSessionCookie() { - throw new MustOverrideException(); - } + public abstract void removeSessionCookie(); /** * Removes all session cookies, which are cookies without an expiration @@ -197,18 +177,14 @@ public class CookieManager { * method from a thread without a Looper. * @param callback a callback which is executed when the session cookies have been removed */ - public void removeSessionCookies(ValueCallback<Boolean> callback) { - throw new MustOverrideException(); - } + public abstract void removeSessionCookies(ValueCallback<Boolean> callback); /** * Removes all cookies. * @deprecated Use {@link #removeAllCookies(ValueCallback)} instead. */ @Deprecated - public void removeAllCookie() { - throw new MustOverrideException(); - } + public abstract void removeAllCookie(); /** * Removes all cookies. @@ -223,54 +199,37 @@ public class CookieManager { * method from a thread without a Looper. * @param callback a callback which is executed when the cookies have been removed */ - public void removeAllCookies(ValueCallback<Boolean> callback) { - throw new MustOverrideException(); - } + public abstract void removeAllCookies(ValueCallback<Boolean> callback); /** * Gets whether there are stored cookies. * * @return true if there are stored cookies */ - public synchronized boolean hasCookies() { - throw new MustOverrideException(); - } + public abstract boolean hasCookies(); /** * See {@link #hasCookies()}. * * @param privateBrowsing whether to use the private browsing cookie jar - * @hide Used by Browser, no intention to publish. + * @hide Used by Browser and WebViewProvider implementations. */ - public synchronized boolean hasCookies(boolean privateBrowsing) { - throw new MustOverrideException(); - } + @SystemApi + public abstract boolean hasCookies(boolean privateBrowsing); /** * Removes all expired cookies. * @deprecated The WebView handles removing expired cookies automatically. */ @Deprecated - public void removeExpiredCookie() { - throw new MustOverrideException(); - } + public abstract void removeExpiredCookie(); /** * Ensures all cookies currently accessible through the getCookie API are * written to persistent storage. * This call will block the caller until it is done and may perform I/O. */ - public void flush() { - flushCookieStore(); - } - - /** - * Flushes all cookies managed by the Chrome HTTP stack to flash. - * - * @hide Package level api, called from CookieSyncManager - */ - protected void flushCookieStore() { - } + public abstract void flush(); /** * Gets whether the application's {@link WebView} instances send and accept @@ -289,9 +248,8 @@ public class CookieManager { * * @hide Only for use by WebViewProvider implementations */ - protected boolean allowFileSchemeCookiesImpl() { - throw new MustOverrideException(); - } + @SystemApi + protected abstract boolean allowFileSchemeCookiesImpl(); /** * Sets whether the application's {@link WebView} instances should send and @@ -314,7 +272,6 @@ public class CookieManager { * * @hide Only for use by WebViewProvider implementations */ - protected void setAcceptFileSchemeCookiesImpl(boolean accept) { - throw new MustOverrideException(); - } + @SystemApi + protected abstract void setAcceptFileSchemeCookiesImpl(boolean accept); } diff --git a/core/java/android/webkit/DebugFlags.java b/core/java/android/webkit/DebugFlags.java deleted file mode 100644 index 7b3cb1b..0000000 --- a/core/java/android/webkit/DebugFlags.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.webkit; - -/** - * This class is a container for all of the debug flags used in the Java - * components of webkit. These flags must be final in order to ensure that - * the compiler optimizes the code that uses them out of the final executable. - * - * The name of each flags maps directly to the name of the class in which that - * flag is used. - * - * @hide Only used by WebView implementations. - */ -public class DebugFlags { - - public static final boolean COOKIE_SYNC_MANAGER = false; - public static final boolean TRACE_API = false; - public static final boolean TRACE_CALLBACK = false; - public static final boolean URL_UTIL = false; - public static final boolean WEB_SYNC_MANAGER = false; - -} diff --git a/core/java/android/webkit/FindActionModeCallback.java b/core/java/android/webkit/FindActionModeCallback.java index c68b450..ab6a2f9 100644 --- a/core/java/android/webkit/FindActionModeCallback.java +++ b/core/java/android/webkit/FindActionModeCallback.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.SystemApi; import android.content.Context; import android.content.res.Resources; import android.graphics.Point; @@ -36,6 +37,7 @@ import android.widget.TextView; /** * @hide */ +@SystemApi public class FindActionModeCallback implements ActionMode.Callback, TextWatcher, View.OnClickListener, WebView.FindListener { private View mCustomView; diff --git a/core/java/android/webkit/GeolocationPermissions.java b/core/java/android/webkit/GeolocationPermissions.java index bc3d035..7187f22 100644 --- a/core/java/android/webkit/GeolocationPermissions.java +++ b/core/java/android/webkit/GeolocationPermissions.java @@ -16,6 +16,8 @@ package android.webkit; +import android.annotation.SystemApi; + import java.util.Set; /** @@ -136,5 +138,6 @@ public class GeolocationPermissions { * way to call createHandler() and createUIHandler(), so it would not work). * @hide Only for use by WebViewProvider implementations */ + @SystemApi public GeolocationPermissions() {} } diff --git a/core/java/android/webkit/HttpAuthHandler.java b/core/java/android/webkit/HttpAuthHandler.java index ee3b369..45fc1f5 100644 --- a/core/java/android/webkit/HttpAuthHandler.java +++ b/core/java/android/webkit/HttpAuthHandler.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.SystemApi; import android.os.Handler; /** @@ -30,6 +31,7 @@ public class HttpAuthHandler extends Handler { /** * @hide Only for use by WebViewProvider implementations. */ + @SystemApi public HttpAuthHandler() { } diff --git a/core/java/android/webkit/JsDialogHelper.java b/core/java/android/webkit/JsDialogHelper.java index bb0339e..cc475c3 100644 --- a/core/java/android/webkit/JsDialogHelper.java +++ b/core/java/android/webkit/JsDialogHelper.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.SystemApi; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; @@ -34,8 +35,9 @@ import java.net.URL; * Helper class to create JavaScript dialogs. It is used by * different WebView implementations. * - * @hide Helper class for internal use + * @hide */ +@SystemApi public class JsDialogHelper { private static final String TAG = "JsDialogHelper"; diff --git a/core/java/android/webkit/JsPromptResult.java b/core/java/android/webkit/JsPromptResult.java index a1bf124..771cc32 100644 --- a/core/java/android/webkit/JsPromptResult.java +++ b/core/java/android/webkit/JsPromptResult.java @@ -16,6 +16,8 @@ package android.webkit; +import android.annotation.SystemApi; + /** * Public class for handling JavaScript prompt requests. The WebChromeClient will receive a @@ -39,6 +41,7 @@ public class JsPromptResult extends JsResult { /** * @hide Only for use by WebViewProvider implementations */ + @SystemApi public JsPromptResult(ResultReceiver receiver) { super(receiver); } @@ -46,6 +49,7 @@ public class JsPromptResult extends JsResult { /** * @hide Only for use by WebViewProvider implementations */ + @SystemApi public String getStringResult() { return mStringResult; } diff --git a/core/java/android/webkit/JsResult.java b/core/java/android/webkit/JsResult.java index e4e6851..d36ab41 100644 --- a/core/java/android/webkit/JsResult.java +++ b/core/java/android/webkit/JsResult.java @@ -16,6 +16,8 @@ package android.webkit; +import android.annotation.SystemApi; + /** * An instance of this class is passed as a parameter in various {@link WebChromeClient} action * notifications. The object is used as a handle onto the underlying JavaScript-originated request, @@ -27,6 +29,7 @@ public class JsResult { * notifications when the JavaScript result represented by a JsResult instance has * @hide Only for use by WebViewProvider implementations */ + @SystemApi public interface ResultReceiver { public void onJsResultComplete(JsResult result); } @@ -54,6 +57,7 @@ public class JsResult { /** * @hide Only for use by WebViewProvider implementations */ + @SystemApi public JsResult(ResultReceiver receiver) { mReceiver = receiver; } @@ -61,6 +65,7 @@ public class JsResult { /** * @hide Only for use by WebViewProvider implementations */ + @SystemApi public final boolean getResult() { return mResult; } diff --git a/core/java/android/webkit/MustOverrideException.java b/core/java/android/webkit/MustOverrideException.java deleted file mode 100644 index 0643bf0..0000000 --- a/core/java/android/webkit/MustOverrideException.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.webkit; - -// TODO: Remove MustOverrideException and make all methods throwing it abstract instead; -// needs API file update. -class MustOverrideException extends RuntimeException { - MustOverrideException() { - super("abstract function called: must be overriden!"); - } -}
\ No newline at end of file diff --git a/core/java/android/webkit/SslErrorHandler.java b/core/java/android/webkit/SslErrorHandler.java index af31544..537065d 100644 --- a/core/java/android/webkit/SslErrorHandler.java +++ b/core/java/android/webkit/SslErrorHandler.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.SystemApi; import android.os.Handler; /** @@ -30,6 +31,7 @@ public class SslErrorHandler extends Handler { /** * @hide Only for use by WebViewProvider implementations. */ + @SystemApi public SslErrorHandler() {} /** diff --git a/core/java/android/webkit/URLUtil.java b/core/java/android/webkit/URLUtil.java index d115984..f5233b6 100644 --- a/core/java/android/webkit/URLUtil.java +++ b/core/java/android/webkit/URLUtil.java @@ -29,6 +29,7 @@ import android.util.Log; public final class URLUtil { private static final String LOGTAG = "webkit"; + private static final boolean TRACE = false; // to refer to bar.png under your package's asset/foo/ directory, use // "file:///android_asset/foo/bar.png". @@ -49,7 +50,7 @@ public final class URLUtil { String retVal = inUrl; WebAddress webAddress; - if (DebugFlags.URL_UTIL) Log.v(LOGTAG, "guessURL before queueRequest: " + inUrl); + if (TRACE) Log.v(LOGTAG, "guessURL before queueRequest: " + inUrl); if (inUrl.length() == 0) return inUrl; if (inUrl.startsWith("about:")) return inUrl; @@ -69,7 +70,7 @@ public final class URLUtil { webAddress = new WebAddress(inUrl); } catch (ParseException ex) { - if (DebugFlags.URL_UTIL) { + if (TRACE) { Log.v(LOGTAG, "smartUrlFilter: failed to parse url = " + inUrl); } return retVal; @@ -286,7 +287,7 @@ public final class URLUtil { } return url; } - + /** * Guesses canonical filename that a download would have, using * the URL and contentDisposition. File extension, if not defined, @@ -294,7 +295,7 @@ public final class URLUtil { * @param url Url to the content * @param contentDisposition Content-Disposition HTTP header or null * @param mimeType Mime-type of the content or null - * + * * @return suggested filename */ public static final String guessFileName( diff --git a/core/java/android/webkit/WebBackForwardList.java b/core/java/android/webkit/WebBackForwardList.java index bfef2e7..e671376 100644 --- a/core/java/android/webkit/WebBackForwardList.java +++ b/core/java/android/webkit/WebBackForwardList.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.SystemApi; import java.io.Serializable; /** @@ -23,56 +24,38 @@ import java.io.Serializable; * WebView.copyBackForwardList() will return a copy of this class used to * inspect the entries in the list. */ -public class WebBackForwardList implements Cloneable, Serializable { - - /** - * @hide - */ - public WebBackForwardList() { - } - +public abstract class WebBackForwardList implements Cloneable, Serializable { /** * Return the current history item. This method returns null if the list is * empty. * @return The current history item. */ - public synchronized WebHistoryItem getCurrentItem() { - throw new MustOverrideException(); - } + public abstract WebHistoryItem getCurrentItem(); /** * Get the index of the current history item. This index can be used to * directly index into the array list. * @return The current index from 0...n or -1 if the list is empty. */ - public synchronized int getCurrentIndex() { - throw new MustOverrideException(); - } + public abstract int getCurrentIndex(); /** * Get the history item at the given index. The index range is from 0...n * where 0 is the first item and n is the last item. * @param index The index to retrieve. */ - public synchronized WebHistoryItem getItemAtIndex(int index) { - throw new MustOverrideException(); - } + public abstract WebHistoryItem getItemAtIndex(int index); /** * Get the total size of the back/forward list. * @return The size of the list. */ - public synchronized int getSize() { - throw new MustOverrideException(); - } + public abstract int getSize(); /** * Clone the entire object to be used in the UI thread by clients of * WebView. This creates a copy that should never be modified by any of the * webkit package classes. */ - protected synchronized WebBackForwardList clone() { - throw new MustOverrideException(); - } - + protected abstract WebBackForwardList clone(); } diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java index 46a7fd0..768dc9f 100644 --- a/core/java/android/webkit/WebChromeClient.java +++ b/core/java/android/webkit/WebChromeClient.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.SystemApi; import android.content.Intent; import android.content.pm.ActivityInfo; import android.graphics.Bitmap; @@ -509,6 +510,7 @@ public class WebChromeClient { * @deprecated Use {@link #showFileChooser} instead. * @hide This method was not published in any SDK version. */ + @SystemApi @Deprecated public void openFileChooser(ValueCallback<Uri> uploadFile, String acceptType, String capture) { uploadFile.onReceiveValue(null); diff --git a/core/java/android/webkit/WebHistoryItem.java b/core/java/android/webkit/WebHistoryItem.java index 9a588e4..569fccd 100644 --- a/core/java/android/webkit/WebHistoryItem.java +++ b/core/java/android/webkit/WebHistoryItem.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.SystemApi; import android.graphics.Bitmap; /** @@ -24,14 +25,7 @@ import android.graphics.Bitmap; * item. Each history item may be updated during the load of a page. * @see WebBackForwardList */ -public class WebHistoryItem implements Cloneable { - - /** - * @hide - */ - public WebHistoryItem() { - } - +public abstract class WebHistoryItem implements Cloneable { /** * Return an identifier for this history item. If an item is a copy of * another item, the identifiers will be the same even if they are not the @@ -40,10 +34,9 @@ public class WebHistoryItem implements Cloneable { * @deprecated This method is now obsolete. * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ + @SystemApi @Deprecated - public int getId() { - throw new MustOverrideException(); - } + public abstract int getId(); /** * Return the url of this history item. The url is the base url of this @@ -53,29 +46,23 @@ public class WebHistoryItem implements Cloneable { * Note: The VM ensures 32-bit atomic read/write operations so we don't have * to synchronize this method. */ - public String getUrl() { - throw new MustOverrideException(); - } + public abstract String getUrl(); /** * Return the original url of this history item. This was the requested - * url, the final url may be different as there might have been + * url, the final url may be different as there might have been * redirects while loading the site. * @return The original url of this history item. */ - public String getOriginalUrl() { - throw new MustOverrideException(); - } - + public abstract String getOriginalUrl(); + /** * Return the document title of this history item. * @return The document title of this history item. * Note: The VM ensures 32-bit atomic read/write operations so we don't have * to synchronize this method. */ - public String getTitle() { - throw new MustOverrideException(); - } + public abstract String getTitle(); /** * Return the favicon of this history item or null if no favicon was found. @@ -83,15 +70,10 @@ public class WebHistoryItem implements Cloneable { * Note: The VM ensures 32-bit atomic read/write operations so we don't have * to synchronize this method. */ - public Bitmap getFavicon() { - throw new MustOverrideException(); - } + public abstract Bitmap getFavicon(); /** * Clone the history item for use by clients of WebView. */ - protected synchronized WebHistoryItem clone() { - throw new MustOverrideException(); - } - + protected abstract WebHistoryItem clone(); } diff --git a/core/java/android/webkit/WebIconDatabase.java b/core/java/android/webkit/WebIconDatabase.java index e574593..08956e0 100644 --- a/core/java/android/webkit/WebIconDatabase.java +++ b/core/java/android/webkit/WebIconDatabase.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.SystemApi; import android.content.ContentResolver; import android.graphics.Bitmap; @@ -32,7 +33,7 @@ import android.graphics.Bitmap; * up to {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} */ @Deprecated -public class WebIconDatabase { +public abstract class WebIconDatabase { /** * Interface for receiving icons from the database. * @deprecated This interface is obsolete. @@ -52,23 +53,17 @@ public class WebIconDatabase { * Open a the icon database and store the icons in the given path. * @param path The directory path where the icon database will be stored. */ - public void open(String path) { - throw new MustOverrideException(); - } + public abstract void open(String path); /** * Close the shared instance of the icon database. */ - public void close() { - throw new MustOverrideException(); - } + public abstract void close(); /** * Removes all the icons in the database. */ - public void removeAllIcons() { - throw new MustOverrideException(); - } + public abstract void removeAllIcons(); /** * Request the Bitmap representing the icon for the given page @@ -76,32 +71,25 @@ public class WebIconDatabase { * @param url The page's url. * @param listener An implementation on IconListener to receive the result. */ - public void requestIconForPageUrl(String url, IconListener listener) { - throw new MustOverrideException(); - } + public abstract void requestIconForPageUrl(String url, IconListener listener); /** {@hide} */ - public void bulkRequestIconForPageUrl(ContentResolver cr, String where, - IconListener listener) { - throw new MustOverrideException(); - } + @SystemApi + public abstract void bulkRequestIconForPageUrl(ContentResolver cr, String where, + IconListener listener); /** * Retain the icon for the given page url. * @param url The page's url. */ - public void retainIconForPageUrl(String url) { - throw new MustOverrideException(); - } + public abstract void retainIconForPageUrl(String url); /** * Release the icon for the given page url. * @param url The page's url. */ - public void releaseIconForPageUrl(String url) { - throw new MustOverrideException(); - } + public abstract void releaseIconForPageUrl(String url); /** * Get the global instance of WebIconDatabase. @@ -113,9 +101,4 @@ public class WebIconDatabase { // XXX: Must be created in the UI thread. return WebViewFactory.getProvider().getWebIconDatabase(); } - - /** - * @hide Only for use by WebViewProvider implementations - */ - protected WebIconDatabase() {} } diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index 7cf3cb5..1d2c311 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -204,25 +204,15 @@ public abstract class WebSettings { public static final int MIXED_CONTENT_COMPATIBILITY_MODE = 2; /** - * Hidden constructor to prevent clients from creating a new settings - * instance or deriving the class. - * - * @hide - */ - protected WebSettings() { - } - - /** * Enables dumping the pages navigation cache to a text file. The default * is false. * * @deprecated This method is now obsolete. * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ + @SystemApi @Deprecated - public void setNavDump(boolean enabled) { - throw new MustOverrideException(); - } + public abstract void setNavDump(boolean enabled); /** * Gets whether dumping the navigation cache is enabled. @@ -232,10 +222,9 @@ public abstract class WebSettings { * @deprecated This method is now obsolete. * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ + @SystemApi @Deprecated - public boolean getNavDump() { - throw new MustOverrideException(); - } + public abstract boolean getNavDump(); /** * Sets whether the WebView should support zooming using its on-screen zoom @@ -246,9 +235,7 @@ public abstract class WebSettings { * * @param support whether the WebView should support zoom */ - public void setSupportZoom(boolean support) { - throw new MustOverrideException(); - } + public abstract void setSupportZoom(boolean support); /** * Gets whether the WebView supports zoom. @@ -256,9 +243,7 @@ public abstract class WebSettings { * @return true if the WebView supports zoom * @see #setSupportZoom */ - public boolean supportZoom() { - throw new MustOverrideException(); - } + public abstract boolean supportZoom(); /** * Sets whether the WebView requires a user gesture to play media. @@ -266,9 +251,7 @@ public abstract class WebSettings { * * @param require whether the WebView requires a user gesture to play media */ - public void setMediaPlaybackRequiresUserGesture(boolean require) { - throw new MustOverrideException(); - } + public abstract void setMediaPlaybackRequiresUserGesture(boolean require); /** * Gets whether the WebView requires a user gesture to play media. @@ -276,9 +259,7 @@ public abstract class WebSettings { * @return true if the WebView requires a user gesture to play media * @see #setMediaPlaybackRequiresUserGesture */ - public boolean getMediaPlaybackRequiresUserGesture() { - throw new MustOverrideException(); - } + public abstract boolean getMediaPlaybackRequiresUserGesture(); /** * Sets whether the WebView should use its built-in zoom mechanisms. The @@ -295,9 +276,7 @@ public abstract class WebSettings { // This method was intended to select between the built-in zoom mechanisms // and the separate zoom controls. The latter were obtained using // {@link WebView#getZoomControls}, which is now hidden. - public void setBuiltInZoomControls(boolean enabled) { - throw new MustOverrideException(); - } + public abstract void setBuiltInZoomControls(boolean enabled); /** * Gets whether the zoom mechanisms built into WebView are being used. @@ -305,9 +284,7 @@ public abstract class WebSettings { * @return true if the zoom mechanisms built into WebView are being used * @see #setBuiltInZoomControls */ - public boolean getBuiltInZoomControls() { - throw new MustOverrideException(); - } + public abstract boolean getBuiltInZoomControls(); /** * Sets whether the WebView should display on-screen zoom controls when @@ -316,9 +293,7 @@ public abstract class WebSettings { * * @param enabled whether the WebView should display on-screen zoom controls */ - public void setDisplayZoomControls(boolean enabled) { - throw new MustOverrideException(); - } + public abstract void setDisplayZoomControls(boolean enabled); /** * Gets whether the WebView displays on-screen zoom controls when using @@ -328,9 +303,7 @@ public abstract class WebSettings { * the built-in zoom mechanisms * @see #setDisplayZoomControls */ - public boolean getDisplayZoomControls() { - throw new MustOverrideException(); - } + public abstract boolean getDisplayZoomControls(); /** * Enables or disables file access within WebView. File access is enabled by @@ -338,36 +311,28 @@ public abstract class WebSettings { * Assets and resources are still accessible using file:///android_asset and * file:///android_res. */ - public void setAllowFileAccess(boolean allow) { - throw new MustOverrideException(); - } + public abstract void setAllowFileAccess(boolean allow); /** * Gets whether this WebView supports file access. * * @see #setAllowFileAccess */ - public boolean getAllowFileAccess() { - throw new MustOverrideException(); - } + public abstract boolean getAllowFileAccess(); /** * Enables or disables content URL access within WebView. Content URL * access allows WebView to load content from a content provider installed * in the system. The default is enabled. */ - public void setAllowContentAccess(boolean allow) { - throw new MustOverrideException(); - } + public abstract void setAllowContentAccess(boolean allow); /** * Gets whether this WebView supports content URL access. * * @see #setAllowContentAccess */ - public boolean getAllowContentAccess() { - throw new MustOverrideException(); - } + public abstract boolean getAllowContentAccess(); /** * Sets whether the WebView loads pages in overview mode, that is, @@ -376,9 +341,7 @@ public abstract class WebSettings { * of the WebView control, for example, when {@link #getUseWideViewPort} * is enabled. The default is false. */ - public void setLoadWithOverviewMode(boolean overview) { - throw new MustOverrideException(); - } + public abstract void setLoadWithOverviewMode(boolean overview); /** * Gets whether this WebView loads pages in overview mode. @@ -386,9 +349,7 @@ public abstract class WebSettings { * @return whether this WebView loads pages in overview mode * @see #setLoadWithOverviewMode */ - public boolean getLoadWithOverviewMode() { - throw new MustOverrideException(); - } + public abstract boolean getLoadWithOverviewMode(); /** * Sets whether the WebView will enable smooth transition while panning or @@ -400,9 +361,7 @@ public abstract class WebSettings { * @deprecated This method is now obsolete, and will become a no-op in future. */ @Deprecated - public void setEnableSmoothTransition(boolean enable) { - throw new MustOverrideException(); - } + public abstract void setEnableSmoothTransition(boolean enable); /** * Gets whether the WebView enables smooth transition while panning or @@ -413,9 +372,7 @@ public abstract class WebSettings { * @deprecated This method is now obsolete, and will become a no-op in future. */ @Deprecated - public boolean enableSmoothTransition() { - throw new MustOverrideException(); - } + public abstract boolean enableSmoothTransition(); /** * Sets whether the WebView uses its background for over scroll background. @@ -425,10 +382,9 @@ public abstract class WebSettings { * @deprecated This method is now obsolete. * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ + @SystemApi @Deprecated - public void setUseWebViewBackgroundForOverscrollBackground(boolean view) { - throw new MustOverrideException(); - } + public abstract void setUseWebViewBackgroundForOverscrollBackground(boolean view); /** * Gets whether this WebView uses WebView's background instead of @@ -438,17 +394,14 @@ public abstract class WebSettings { * @deprecated This method is now obsolete. * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ + @SystemApi @Deprecated - public boolean getUseWebViewBackgroundForOverscrollBackground() { - throw new MustOverrideException(); - } + public abstract boolean getUseWebViewBackgroundForOverscrollBackground(); /** * Sets whether the WebView should save form data. The default is true. */ - public void setSaveFormData(boolean save) { - throw new MustOverrideException(); - } + public abstract void setSaveFormData(boolean save); /** * Gets whether the WebView saves form data. @@ -456,18 +409,14 @@ public abstract class WebSettings { * @return whether the WebView saves form data * @see #setSaveFormData */ - public boolean getSaveFormData() { - throw new MustOverrideException(); - } + public abstract boolean getSaveFormData(); /** * 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(); - } + public abstract void setSavePassword(boolean save); /** * Gets whether the WebView saves passwords. @@ -477,18 +426,14 @@ public abstract class WebSettings { * @deprecated Saving passwords in WebView will not be supported in future versions. */ @Deprecated - public boolean getSavePassword() { - throw new MustOverrideException(); - } + public abstract boolean getSavePassword(); /** * Sets the text zoom of the page in percent. The default is 100. * * @param textZoom the text zoom in percent */ - public synchronized void setTextZoom(int textZoom) { - throw new MustOverrideException(); - } + public abstract void setTextZoom(int textZoom); /** * Gets the text zoom of the page in percent. @@ -496,27 +441,23 @@ public abstract class WebSettings { * @return the text zoom of the page in percent * @see #setTextZoom */ - public synchronized int getTextZoom() { - throw new MustOverrideException(); - } + public abstract int getTextZoom(); /** * Sets policy for third party cookies. * Developers should access this via {@link CookieManager#setShouldAcceptThirdPartyCookies}. * @hide Internal API. */ - public void setAcceptThirdPartyCookies(boolean accept) { - throw new MustOverrideException(); - } + @SystemApi + public abstract void setAcceptThirdPartyCookies(boolean accept); /** * Gets policy for third party cookies. * Developers should access this via {@link CookieManager#getShouldAcceptThirdPartyCookies}. * @hide Internal API */ - public boolean getAcceptThirdPartyCookies() { - throw new MustOverrideException(); - } + @SystemApi + public abstract boolean getAcceptThirdPartyCookies(); /** * Sets the text size of the page. The default is {@link TextSize#NORMAL}. @@ -569,9 +510,7 @@ public abstract class WebSettings { * recommended alternatives. */ @Deprecated - public void setDefaultZoom(ZoomDensity zoom) { - throw new MustOverrideException(); - } + public abstract void setDefaultZoom(ZoomDensity zoom); /** * Gets the default zoom density of the page. This should be called from @@ -583,9 +522,7 @@ public abstract class WebSettings { * @see #setDefaultZoom * @deprecated Will only return the default value. */ - public ZoomDensity getDefaultZoom() { - throw new MustOverrideException(); - } + public abstract ZoomDensity getDefaultZoom(); /** * Enables using light touches to make a selection and activate mouseovers. @@ -593,9 +530,7 @@ public abstract class WebSettings { * setting is obsolete and has no effect. */ @Deprecated - public void setLightTouchEnabled(boolean enabled) { - throw new MustOverrideException(); - } + public abstract void setLightTouchEnabled(boolean enabled); /** * Gets whether light touches are enabled. @@ -603,9 +538,7 @@ public abstract class WebSettings { * @deprecated This setting is obsolete. */ @Deprecated - public boolean getLightTouchEnabled() { - throw new MustOverrideException(); - } + public abstract boolean getLightTouchEnabled(); /** * Controlled a rendering optimization that is no longer present. Setting @@ -615,7 +548,7 @@ public abstract class WebSettings { * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated - public synchronized void setUseDoubleTree(boolean use) { + public void setUseDoubleTree(boolean use) { // Specified to do nothing, so no need for derived classes to override. } @@ -627,7 +560,7 @@ public abstract class WebSettings { * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated - public synchronized boolean getUseDoubleTree() { + public boolean getUseDoubleTree() { // Returns false unconditionally, so no need for derived classes to override. return false; } @@ -645,10 +578,9 @@ public abstract class WebSettings { * @deprecated Please use {@link #setUserAgentString} instead. * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ + @SystemApi @Deprecated - public synchronized void setUserAgent(int ua) { - throw new MustOverrideException(); - } + public abstract void setUserAgent(int ua); /** * Gets the user-agent as an integer code. @@ -664,10 +596,9 @@ public abstract class WebSettings { * @deprecated Please use {@link #getUserAgentString} instead. * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ + @SystemApi @Deprecated - public synchronized int getUserAgent() { - throw new MustOverrideException(); - } + public abstract int getUserAgent(); /** * Sets whether the WebView should enable support for the "viewport" @@ -680,9 +611,7 @@ public abstract class WebSettings { * * @param use whether to enable support for the viewport meta tag */ - public synchronized void setUseWideViewPort(boolean use) { - throw new MustOverrideException(); - } + public abstract void setUseWideViewPort(boolean use); /** * Gets whether the WebView supports the "viewport" @@ -691,9 +620,7 @@ public abstract class WebSettings { * @return true if the WebView supports the viewport meta tag * @see #setUseWideViewPort */ - public synchronized boolean getUseWideViewPort() { - throw new MustOverrideException(); - } + public abstract boolean getUseWideViewPort(); /** * Sets whether the WebView whether supports multiple windows. If set to @@ -702,9 +629,7 @@ public abstract class WebSettings { * * @param support whether to suport multiple windows */ - public synchronized void setSupportMultipleWindows(boolean support) { - throw new MustOverrideException(); - } + public abstract void setSupportMultipleWindows(boolean support); /** * Gets whether the WebView supports multiple windows. @@ -712,9 +637,7 @@ public abstract class WebSettings { * @return true if the WebView supports multiple windows * @see #setSupportMultipleWindows */ - public synchronized boolean supportMultipleWindows() { - throw new MustOverrideException(); - } + public abstract boolean supportMultipleWindows(); /** * Sets the underlying layout algorithm. This will cause a relayout of the @@ -722,9 +645,7 @@ public abstract class WebSettings { * * @param l the layout algorithm to use, as a {@link LayoutAlgorithm} value */ - public synchronized void setLayoutAlgorithm(LayoutAlgorithm l) { - throw new MustOverrideException(); - } + public abstract void setLayoutAlgorithm(LayoutAlgorithm l); /** * Gets the current layout algorithm. @@ -732,18 +653,14 @@ public abstract class WebSettings { * @return the layout algorithm in use, as a {@link LayoutAlgorithm} value * @see #setLayoutAlgorithm */ - public synchronized LayoutAlgorithm getLayoutAlgorithm() { - throw new MustOverrideException(); - } + public abstract LayoutAlgorithm getLayoutAlgorithm(); /** * Sets the standard font family name. The default is "sans-serif". * * @param font a font family name */ - public synchronized void setStandardFontFamily(String font) { - throw new MustOverrideException(); - } + public abstract void setStandardFontFamily(String font); /** * Gets the standard font family name. @@ -751,18 +668,14 @@ public abstract class WebSettings { * @return the standard font family name as a string * @see #setStandardFontFamily */ - public synchronized String getStandardFontFamily() { - throw new MustOverrideException(); - } + public abstract String getStandardFontFamily(); /** * Sets the fixed font family name. The default is "monospace". * * @param font a font family name */ - public synchronized void setFixedFontFamily(String font) { - throw new MustOverrideException(); - } + public abstract void setFixedFontFamily(String font); /** * Gets the fixed font family name. @@ -770,18 +683,14 @@ public abstract class WebSettings { * @return the fixed font family name as a string * @see #setFixedFontFamily */ - public synchronized String getFixedFontFamily() { - throw new MustOverrideException(); - } + public abstract String getFixedFontFamily(); /** * Sets the sans-serif font family name. The default is "sans-serif". * * @param font a font family name */ - public synchronized void setSansSerifFontFamily(String font) { - throw new MustOverrideException(); - } + public abstract void setSansSerifFontFamily(String font); /** * Gets the sans-serif font family name. @@ -789,18 +698,14 @@ public abstract class WebSettings { * @return the sans-serif font family name as a string * @see #setSansSerifFontFamily */ - public synchronized String getSansSerifFontFamily() { - throw new MustOverrideException(); - } + public abstract String getSansSerifFontFamily(); /** * Sets the serif font family name. The default is "sans-serif". * * @param font a font family name */ - public synchronized void setSerifFontFamily(String font) { - throw new MustOverrideException(); - } + public abstract void setSerifFontFamily(String font); /** * Gets the serif font family name. The default is "serif". @@ -808,18 +713,14 @@ public abstract class WebSettings { * @return the serif font family name as a string * @see #setSerifFontFamily */ - public synchronized String getSerifFontFamily() { - throw new MustOverrideException(); - } + public abstract String getSerifFontFamily(); /** * Sets the cursive font family name. The default is "cursive". * * @param font a font family name */ - public synchronized void setCursiveFontFamily(String font) { - throw new MustOverrideException(); - } + public abstract void setCursiveFontFamily(String font); /** * Gets the cursive font family name. @@ -827,18 +728,14 @@ public abstract class WebSettings { * @return the cursive font family name as a string * @see #setCursiveFontFamily */ - public synchronized String getCursiveFontFamily() { - throw new MustOverrideException(); - } + public abstract String getCursiveFontFamily(); /** * Sets the fantasy font family name. The default is "fantasy". * * @param font a font family name */ - public synchronized void setFantasyFontFamily(String font) { - throw new MustOverrideException(); - } + public abstract void setFantasyFontFamily(String font); /** * Gets the fantasy font family name. @@ -846,9 +743,7 @@ public abstract class WebSettings { * @return the fantasy font family name as a string * @see #setFantasyFontFamily */ - public synchronized String getFantasyFontFamily() { - throw new MustOverrideException(); - } + public abstract String getFantasyFontFamily(); /** * Sets the minimum font size. The default is 8. @@ -856,9 +751,7 @@ public abstract class WebSettings { * @param size a non-negative integer between 1 and 72. Any number outside * the specified range will be pinned. */ - public synchronized void setMinimumFontSize(int size) { - throw new MustOverrideException(); - } + public abstract void setMinimumFontSize(int size); /** * Gets the minimum font size. @@ -866,9 +759,7 @@ public abstract class WebSettings { * @return a non-negative integer between 1 and 72 * @see #setMinimumFontSize */ - public synchronized int getMinimumFontSize() { - throw new MustOverrideException(); - } + public abstract int getMinimumFontSize(); /** * Sets the minimum logical font size. The default is 8. @@ -876,9 +767,7 @@ public abstract class WebSettings { * @param size a non-negative integer between 1 and 72. Any number outside * the specified range will be pinned. */ - public synchronized void setMinimumLogicalFontSize(int size) { - throw new MustOverrideException(); - } + public abstract void setMinimumLogicalFontSize(int size); /** * Gets the minimum logical font size. @@ -886,9 +775,7 @@ public abstract class WebSettings { * @return a non-negative integer between 1 and 72 * @see #setMinimumLogicalFontSize */ - public synchronized int getMinimumLogicalFontSize() { - throw new MustOverrideException(); - } + public abstract int getMinimumLogicalFontSize(); /** * Sets the default font size. The default is 16. @@ -896,9 +783,7 @@ public abstract class WebSettings { * @param size a non-negative integer between 1 and 72. Any number outside * the specified range will be pinned. */ - public synchronized void setDefaultFontSize(int size) { - throw new MustOverrideException(); - } + public abstract void setDefaultFontSize(int size); /** * Gets the default font size. @@ -906,9 +791,7 @@ public abstract class WebSettings { * @return a non-negative integer between 1 and 72 * @see #setDefaultFontSize */ - public synchronized int getDefaultFontSize() { - throw new MustOverrideException(); - } + public abstract int getDefaultFontSize(); /** * Sets the default fixed font size. The default is 16. @@ -916,9 +799,7 @@ public abstract class WebSettings { * @param size a non-negative integer between 1 and 72. Any number outside * the specified range will be pinned. */ - public synchronized void setDefaultFixedFontSize(int size) { - throw new MustOverrideException(); - } + public abstract void setDefaultFixedFontSize(int size); /** * Gets the default fixed font size. @@ -926,9 +807,7 @@ public abstract class WebSettings { * @return a non-negative integer between 1 and 72 * @see #setDefaultFixedFontSize */ - public synchronized int getDefaultFixedFontSize() { - throw new MustOverrideException(); - } + public abstract int getDefaultFixedFontSize(); /** * Sets whether the WebView should load image resources. Note that this method @@ -941,9 +820,7 @@ public abstract class WebSettings { * * @param flag whether the WebView should load image resources */ - public synchronized void setLoadsImagesAutomatically(boolean flag) { - throw new MustOverrideException(); - } + public abstract void setLoadsImagesAutomatically(boolean flag); /** * Gets whether the WebView loads image resources. This includes @@ -952,9 +829,7 @@ public abstract class WebSettings { * @return true if the WebView loads image resources * @see #setLoadsImagesAutomatically */ - public synchronized boolean getLoadsImagesAutomatically() { - throw new MustOverrideException(); - } + public abstract boolean getLoadsImagesAutomatically(); /** * Sets whether the WebView should not load image resources from the @@ -971,9 +846,7 @@ public abstract class WebSettings { * network * @see #setBlockNetworkLoads */ - public synchronized void setBlockNetworkImage(boolean flag) { - throw new MustOverrideException(); - } + public abstract void setBlockNetworkImage(boolean flag); /** * Gets whether the WebView does not load image resources from the network. @@ -981,9 +854,7 @@ public abstract class WebSettings { * @return true if the WebView does not load image resources from the network * @see #setBlockNetworkImage */ - public synchronized boolean getBlockNetworkImage() { - throw new MustOverrideException(); - } + public abstract boolean getBlockNetworkImage(); /** * Sets whether the WebView should not load resources from the network. @@ -1003,9 +874,7 @@ public abstract class WebSettings { * network * @see android.webkit.WebView#reload */ - public synchronized void setBlockNetworkLoads(boolean flag) { - throw new MustOverrideException(); - } + public abstract void setBlockNetworkLoads(boolean flag); /** * Gets whether the WebView does not load any resources from the network. @@ -1013,9 +882,7 @@ public abstract class WebSettings { * @return true if the WebView does not load any resources from the network * @see #setBlockNetworkLoads */ - public synchronized boolean getBlockNetworkLoads() { - throw new MustOverrideException(); - } + public abstract boolean getBlockNetworkLoads(); /** * Tells the WebView to enable JavaScript execution. @@ -1023,9 +890,7 @@ public abstract class WebSettings { * * @param flag true if the WebView should execute JavaScript */ - public synchronized void setJavaScriptEnabled(boolean flag) { - throw new MustOverrideException(); - } + public abstract void setJavaScriptEnabled(boolean flag); /** * Sets whether JavaScript running in the context of a file scheme URL @@ -1076,10 +941,9 @@ public abstract class WebSettings { * {@link #setPluginState} * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} */ + @SystemApi @Deprecated - public synchronized void setPluginsEnabled(boolean flag) { - throw new MustOverrideException(); - } + public abstract void setPluginsEnabled(boolean flag); /** * Tells the WebView to enable, disable, or have plugins on demand. On @@ -1092,9 +956,7 @@ public abstract class WebSettings { * @deprecated Plugins will not be supported in future, and should not be used. */ @Deprecated - public synchronized void setPluginState(PluginState state) { - throw new MustOverrideException(); - } + public abstract void setPluginState(PluginState state); /** * Sets a custom path to plugins used by the WebView. This method is @@ -1106,7 +968,7 @@ public abstract class WebSettings { * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} */ @Deprecated - public synchronized void setPluginsPath(String pluginsPath) { + public void setPluginsPath(String pluginsPath) { // Specified to do nothing, so no need for derived classes to override. } @@ -1125,9 +987,7 @@ public abstract class WebSettings { // Note that the WebCore Database Tracker only allows the path to be set // once. @Deprecated - public synchronized void setDatabasePath(String databasePath) { - throw new MustOverrideException(); - } + public abstract void setDatabasePath(String databasePath); /** * Sets the path where the Geolocation databases should be saved. In order @@ -1138,9 +998,7 @@ public abstract class WebSettings { * saved. */ // This will update WebCore when the Sync runs in the C++ side. - public synchronized void setGeolocationDatabasePath(String databasePath) { - throw new MustOverrideException(); - } + public abstract void setGeolocationDatabasePath(String databasePath); /** * Sets whether the Application Caches API should be enabled. The default @@ -1150,9 +1008,7 @@ public abstract class WebSettings { * * @param flag true if the WebView should enable Application Caches */ - public synchronized void setAppCacheEnabled(boolean flag) { - throw new MustOverrideException(); - } + public abstract void setAppCacheEnabled(boolean flag); /** * Sets the path to the Application Caches files. In order for the @@ -1164,9 +1020,7 @@ public abstract class WebSettings { * Application Caches files. * @see #setAppCacheEnabled */ - public synchronized void setAppCachePath(String appCachePath) { - throw new MustOverrideException(); - } + public abstract void setAppCachePath(String appCachePath); /** * Sets the maximum size for the Application Cache content. The passed size @@ -1180,9 +1034,7 @@ public abstract class WebSettings { * @deprecated In future quota will be managed automatically. */ @Deprecated - public synchronized void setAppCacheMaxSize(long appCacheMaxSize) { - throw new MustOverrideException(); - } + public abstract void setAppCacheMaxSize(long appCacheMaxSize); /** * Sets whether the database storage API is enabled. The default value is @@ -1196,18 +1048,14 @@ public abstract class WebSettings { * * @param flag true if the WebView should use the database storage API */ - public synchronized void setDatabaseEnabled(boolean flag) { - throw new MustOverrideException(); - } + public abstract void setDatabaseEnabled(boolean flag); /** * Sets whether the DOM storage API is enabled. The default value is false. * * @param flag true if the WebView should use the DOM storage API */ - public synchronized void setDomStorageEnabled(boolean flag) { - throw new MustOverrideException(); - } + public abstract void setDomStorageEnabled(boolean flag); /** * Gets whether the DOM Storage APIs are enabled. @@ -1215,9 +1063,8 @@ public abstract class WebSettings { * @return true if the DOM Storage APIs are enabled * @see #setDomStorageEnabled */ - public synchronized boolean getDomStorageEnabled() { - throw new MustOverrideException(); - } + public abstract boolean getDomStorageEnabled(); + /** * Gets the path to where database storage API databases are saved. * @@ -1226,9 +1073,7 @@ public abstract class WebSettings { * @deprecated Database paths are managed by the implementation this method is obsolete. */ @Deprecated - public synchronized String getDatabasePath() { - throw new MustOverrideException(); - } + public abstract String getDatabasePath(); /** * Gets whether the database storage API is enabled. @@ -1236,9 +1081,7 @@ public abstract class WebSettings { * @return true if the database storage API is enabled * @see #setDatabaseEnabled */ - public synchronized boolean getDatabaseEnabled() { - throw new MustOverrideException(); - } + public abstract boolean getDatabaseEnabled(); /** * Sets whether Geolocation is enabled. The default is true. @@ -1260,9 +1103,7 @@ public abstract class WebSettings { * * @param flag whether Geolocation should be enabled */ - public synchronized void setGeolocationEnabled(boolean flag) { - throw new MustOverrideException(); - } + public abstract void setGeolocationEnabled(boolean flag); /** * Gets whether JavaScript is enabled. @@ -1270,9 +1111,7 @@ public abstract class WebSettings { * @return true if JavaScript is enabled * @see #setJavaScriptEnabled */ - public synchronized boolean getJavaScriptEnabled() { - throw new MustOverrideException(); - } + public abstract boolean getJavaScriptEnabled(); /** * Gets whether JavaScript running in the context of a file scheme URL can @@ -1303,10 +1142,9 @@ public abstract class WebSettings { * @deprecated This method has been replaced by {@link #getPluginState} * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} */ + @SystemApi @Deprecated - public synchronized boolean getPluginsEnabled() { - throw new MustOverrideException(); - } + public abstract boolean getPluginsEnabled(); /** * Gets the current state regarding whether plugins are enabled. @@ -1316,9 +1154,7 @@ public abstract class WebSettings { * @deprecated Plugins will not be supported in future, and should not be used. */ @Deprecated - public synchronized PluginState getPluginState() { - throw new MustOverrideException(); - } + public abstract PluginState getPluginState(); /** * Gets the directory that contains the plugin libraries. This method is @@ -1330,7 +1166,7 @@ public abstract class WebSettings { * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} */ @Deprecated - public synchronized String getPluginsPath() { + public String getPluginsPath() { // Unconditionally returns empty string, so no need for derived classes to override. return ""; } @@ -1341,9 +1177,7 @@ public abstract class WebSettings { * * @param flag true if JavaScript can open windows automatically */ - public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean flag) { - throw new MustOverrideException(); - } + public abstract void setJavaScriptCanOpenWindowsAutomatically(boolean flag); /** * Gets whether JavaScript can open windows automatically. @@ -1352,9 +1186,7 @@ public abstract class WebSettings { * window.open() * @see #setJavaScriptCanOpenWindowsAutomatically */ - public synchronized boolean getJavaScriptCanOpenWindowsAutomatically() { - throw new MustOverrideException(); - } + public abstract boolean getJavaScriptCanOpenWindowsAutomatically(); /** * Sets the default text encoding name to use when decoding html pages. @@ -1362,9 +1194,7 @@ public abstract class WebSettings { * * @param encoding the text encoding name */ - public synchronized void setDefaultTextEncodingName(String encoding) { - throw new MustOverrideException(); - } + public abstract void setDefaultTextEncodingName(String encoding); /** * Gets the default text encoding name. @@ -1372,17 +1202,13 @@ public abstract class WebSettings { * @return the default text encoding name as a string * @see #setDefaultTextEncodingName */ - public synchronized String getDefaultTextEncodingName() { - throw new MustOverrideException(); - } + public abstract String getDefaultTextEncodingName(); /** * Sets the WebView's user-agent string. If the string is null or empty, * the system default value will be used. */ - public synchronized void setUserAgentString(String ua) { - throw new MustOverrideException(); - } + public abstract void setUserAgentString(String ua); /** * Gets the WebView's user-agent string. @@ -1390,9 +1216,7 @@ public abstract class WebSettings { * @return the WebView's user-agent string * @see #setUserAgentString */ - public synchronized String getUserAgentString() { - throw new MustOverrideException(); - } + public abstract String getUserAgentString(); /** * Returns the default User-Agent used by a WebView. @@ -1412,9 +1236,7 @@ public abstract class WebSettings { * * @param flag whether the WebView needs to set a node */ - public void setNeedInitialFocus(boolean flag) { - throw new MustOverrideException(); - } + public abstract void setNeedInitialFocus(boolean flag); /** * Sets the priority of the Render thread. Unlike the other settings, this @@ -1426,9 +1248,7 @@ public abstract class WebSettings { * not be supported in future versions. */ @Deprecated - public synchronized void setRenderPriority(RenderPriority priority) { - throw new MustOverrideException(); - } + public abstract void setRenderPriority(RenderPriority priority); /** * Overrides the way the cache is used. The way the cache is used is based @@ -1442,9 +1262,7 @@ public abstract class WebSettings { * * @param mode the mode to use */ - public void setCacheMode(int mode) { - throw new MustOverrideException(); - } + public abstract void setCacheMode(int mode); /** * Gets the current setting for overriding the cache mode. @@ -1452,9 +1270,7 @@ public abstract class WebSettings { * @return the current setting for overriding the cache mode * @see #setCacheMode */ - public int getCacheMode() { - throw new MustOverrideException(); - } + public abstract int getCacheMode(); /** * Configures the WebView's behavior when a secure origin attempts to load a resource from an diff --git a/core/java/android/webkit/WebStorage.java b/core/java/android/webkit/WebStorage.java index 3bfe9cf..947d0cb 100644 --- a/core/java/android/webkit/WebStorage.java +++ b/core/java/android/webkit/WebStorage.java @@ -16,6 +16,8 @@ package android.webkit; +import android.annotation.SystemApi; + import java.util.Map; /** @@ -65,23 +67,13 @@ public class WebStorage { private long mUsage = 0; /** @hide */ + @SystemApi protected Origin(String origin, long quota, long usage) { mOrigin = origin; mQuota = quota; mUsage = usage; } - /** @hide */ - protected Origin(String origin, long quota) { - mOrigin = origin; - mQuota = quota; - } - - /** @hide */ - protected Origin(String origin) { - mOrigin = origin; - } - /** * Gets the string representation of this origin. * @@ -210,5 +202,6 @@ public class WebStorage { * way to call createHandler() and createUIHandler(), so it would not work). * @hide */ + @SystemApi public WebStorage() {} } diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 592d6e2..6793634 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.SystemApi; import android.annotation.Widget; import android.content.Context; import android.content.res.Configuration; @@ -256,10 +257,12 @@ public class WebView extends AbsoluteLayout * always stay as a hidden API. * @hide */ + @SystemApi public static final String DATA_REDUCTION_PROXY_SETTING_CHANGED = "android.webkit.DATA_REDUCTION_PROXY_SETTING_CHANGED"; private static final String LOGTAG = "WebView"; + private static final boolean TRACE = false; // Throwing an exception for incorrect thread usage if the // build target is JB MR2 or newer. Defaults to false, and is @@ -394,6 +397,7 @@ public class WebView extends AbsoluteLayout /** * @hide Only for use by WebViewProvider implementations */ + @SystemApi public HitTestResult() { mType = UNKNOWN_TYPE; } @@ -401,6 +405,7 @@ public class WebView extends AbsoluteLayout /** * @hide Only for use by WebViewProvider implementations */ + @SystemApi public void setType(int type) { mType = type; } @@ -408,6 +413,7 @@ public class WebView extends AbsoluteLayout /** * @hide Only for use by WebViewProvider implementations */ + @SystemApi public void setExtra(String extra) { mExtra = extra; } @@ -542,7 +548,7 @@ public class WebView extends AbsoluteLayout sEnforceThreadChecking = context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2; checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "WebView<init>"); + if (TRACE) Log.d(LOGTAG, "WebView<init>"); ensureProviderCreated(); mProvider.init(javaScriptInterfaces, privateBrowsing); @@ -557,7 +563,7 @@ public class WebView extends AbsoluteLayout */ public void setHorizontalScrollbarOverlay(boolean overlay) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "setHorizontalScrollbarOverlay=" + overlay); + if (TRACE) Log.d(LOGTAG, "setHorizontalScrollbarOverlay=" + overlay); mProvider.setHorizontalScrollbarOverlay(overlay); } @@ -568,7 +574,7 @@ public class WebView extends AbsoluteLayout */ public void setVerticalScrollbarOverlay(boolean overlay) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "setVerticalScrollbarOverlay=" + overlay); + if (TRACE) Log.d(LOGTAG, "setVerticalScrollbarOverlay=" + overlay); mProvider.setVerticalScrollbarOverlay(overlay); } @@ -623,7 +629,7 @@ public class WebView extends AbsoluteLayout @Deprecated public void setCertificate(SslCertificate certificate) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "setCertificate=" + certificate); + if (TRACE) Log.d(LOGTAG, "setCertificate=" + certificate); mProvider.setCertificate(certificate); } @@ -647,7 +653,7 @@ public class WebView extends AbsoluteLayout @Deprecated public void savePassword(String host, String username, String password) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "savePassword=" + host); + if (TRACE) Log.d(LOGTAG, "savePassword=" + host); mProvider.savePassword(host, username, password); } @@ -667,7 +673,7 @@ public class WebView extends AbsoluteLayout public void setHttpAuthUsernamePassword(String host, String realm, String username, String password) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "setHttpAuthUsernamePassword=" + host); + if (TRACE) Log.d(LOGTAG, "setHttpAuthUsernamePassword=" + host); mProvider.setHttpAuthUsernamePassword(host, realm, username, password); } @@ -697,7 +703,7 @@ public class WebView extends AbsoluteLayout */ public void destroy() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "destroy"); + if (TRACE) Log.d(LOGTAG, "destroy"); mProvider.destroy(); } @@ -743,7 +749,7 @@ public class WebView extends AbsoluteLayout */ public void setNetworkAvailable(boolean networkUp) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "setNetworkAvailable=" + networkUp); + if (TRACE) Log.d(LOGTAG, "setNetworkAvailable=" + networkUp); mProvider.setNetworkAvailable(networkUp); } @@ -760,7 +766,7 @@ public class WebView extends AbsoluteLayout */ public WebBackForwardList saveState(Bundle outState) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "saveState"); + if (TRACE) Log.d(LOGTAG, "saveState"); return mProvider.saveState(outState); } @@ -777,7 +783,7 @@ public class WebView extends AbsoluteLayout @Deprecated public boolean savePicture(Bundle b, final File dest) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "savePicture=" + dest.getName()); + if (TRACE) Log.d(LOGTAG, "savePicture=" + dest.getName()); return mProvider.savePicture(b, dest); } @@ -795,7 +801,7 @@ public class WebView extends AbsoluteLayout @Deprecated public boolean restorePicture(Bundle b, File src) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "restorePicture=" + src.getName()); + if (TRACE) Log.d(LOGTAG, "restorePicture=" + src.getName()); return mProvider.restorePicture(b, src); } @@ -813,7 +819,7 @@ public class WebView extends AbsoluteLayout */ public WebBackForwardList restoreState(Bundle inState) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "restoreState"); + if (TRACE) Log.d(LOGTAG, "restoreState"); return mProvider.restoreState(inState); } @@ -830,7 +836,7 @@ public class WebView extends AbsoluteLayout */ public void loadUrl(String url, Map<String, String> additionalHttpHeaders) { checkThread(); - if (DebugFlags.TRACE_API) { + if (TRACE) { StringBuilder headers = new StringBuilder(); if (additionalHttpHeaders != null) { for (Map.Entry<String, String> entry : additionalHttpHeaders.entrySet()) { @@ -849,7 +855,7 @@ public class WebView extends AbsoluteLayout */ public void loadUrl(String url) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "loadUrl=" + url); + if (TRACE) Log.d(LOGTAG, "loadUrl=" + url); mProvider.loadUrl(url); } @@ -864,7 +870,7 @@ public class WebView extends AbsoluteLayout */ public void postUrl(String url, byte[] postData) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "postUrl=" + url); + if (TRACE) Log.d(LOGTAG, "postUrl=" + url); if (URLUtil.isNetworkUrl(url)) { mProvider.postUrl(url, postData); } else { @@ -903,7 +909,7 @@ public class WebView extends AbsoluteLayout */ public void loadData(String data, String mimeType, String encoding) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "loadData"); + if (TRACE) Log.d(LOGTAG, "loadData"); mProvider.loadData(data, mimeType, encoding); } @@ -936,7 +942,7 @@ public class WebView extends AbsoluteLayout public void loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, String historyUrl) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "loadDataWithBaseURL=" + baseUrl); + if (TRACE) Log.d(LOGTAG, "loadDataWithBaseURL=" + baseUrl); mProvider.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl); } @@ -953,7 +959,7 @@ public class WebView extends AbsoluteLayout */ public void evaluateJavascript(String script, ValueCallback<String> resultCallback) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "evaluateJavascript=" + script); + if (TRACE) Log.d(LOGTAG, "evaluateJavascript=" + script); mProvider.evaluateJavaScript(script, resultCallback); } @@ -964,7 +970,7 @@ public class WebView extends AbsoluteLayout */ public void saveWebArchive(String filename) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "saveWebArchive=" + filename); + if (TRACE) Log.d(LOGTAG, "saveWebArchive=" + filename); mProvider.saveWebArchive(filename); } @@ -982,7 +988,7 @@ public class WebView extends AbsoluteLayout */ public void saveWebArchive(String basename, boolean autoname, ValueCallback<String> callback) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "saveWebArchive(auto)=" + basename); + if (TRACE) Log.d(LOGTAG, "saveWebArchive(auto)=" + basename); mProvider.saveWebArchive(basename, autoname, callback); } @@ -991,7 +997,7 @@ public class WebView extends AbsoluteLayout */ public void stopLoading() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "stopLoading"); + if (TRACE) Log.d(LOGTAG, "stopLoading"); mProvider.stopLoading(); } @@ -1000,7 +1006,7 @@ public class WebView extends AbsoluteLayout */ public void reload() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "reload"); + if (TRACE) Log.d(LOGTAG, "reload"); mProvider.reload(); } @@ -1019,7 +1025,7 @@ public class WebView extends AbsoluteLayout */ public void goBack() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "goBack"); + if (TRACE) Log.d(LOGTAG, "goBack"); mProvider.goBack(); } @@ -1038,7 +1044,7 @@ public class WebView extends AbsoluteLayout */ public void goForward() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "goForward"); + if (TRACE) Log.d(LOGTAG, "goForward"); mProvider.goForward(); } @@ -1064,7 +1070,7 @@ public class WebView extends AbsoluteLayout */ public void goBackOrForward(int steps) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "goBackOrForwad=" + steps); + if (TRACE) Log.d(LOGTAG, "goBackOrForwad=" + steps); mProvider.goBackOrForward(steps); } @@ -1084,7 +1090,7 @@ public class WebView extends AbsoluteLayout */ public boolean pageUp(boolean top) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "pageUp"); + if (TRACE) Log.d(LOGTAG, "pageUp"); return mProvider.pageUp(top); } @@ -1096,7 +1102,7 @@ public class WebView extends AbsoluteLayout */ public boolean pageDown(boolean bottom) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "pageDown"); + if (TRACE) Log.d(LOGTAG, "pageDown"); return mProvider.pageDown(bottom); } @@ -1109,7 +1115,7 @@ public class WebView extends AbsoluteLayout @Deprecated public void clearView() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "clearView"); + if (TRACE) Log.d(LOGTAG, "clearView"); mProvider.clearView(); } @@ -1140,7 +1146,7 @@ public class WebView extends AbsoluteLayout @Deprecated public Picture capturePicture() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "capturePicture"); + if (TRACE) Log.d(LOGTAG, "capturePicture"); return mProvider.capturePicture(); } @@ -1151,7 +1157,7 @@ public class WebView extends AbsoluteLayout @Deprecated public PrintDocumentAdapter createPrintDocumentAdapter() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "createPrintDocumentAdapter"); + if (TRACE) Log.d(LOGTAG, "createPrintDocumentAdapter"); return mProvider.createPrintDocumentAdapter("default"); } @@ -1170,7 +1176,7 @@ public class WebView extends AbsoluteLayout */ public PrintDocumentAdapter createPrintDocumentAdapter(String documentName) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "createPrintDocumentAdapter"); + if (TRACE) Log.d(LOGTAG, "createPrintDocumentAdapter"); return mProvider.createPrintDocumentAdapter(documentName); } @@ -1210,7 +1216,7 @@ public class WebView extends AbsoluteLayout */ public void setInitialScale(int scaleInPercent) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "setInitialScale=" + scaleInPercent); + if (TRACE) Log.d(LOGTAG, "setInitialScale=" + scaleInPercent); mProvider.setInitialScale(scaleInPercent); } @@ -1221,7 +1227,7 @@ public class WebView extends AbsoluteLayout */ public void invokeZoomPicker() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "invokeZoomPicker"); + if (TRACE) Log.d(LOGTAG, "invokeZoomPicker"); mProvider.invokeZoomPicker(); } @@ -1245,7 +1251,7 @@ public class WebView extends AbsoluteLayout */ public HitTestResult getHitTestResult() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "getHitTestResult"); + if (TRACE) Log.d(LOGTAG, "getHitTestResult"); return mProvider.getHitTestResult(); } @@ -1264,7 +1270,7 @@ public class WebView extends AbsoluteLayout */ public void requestFocusNodeHref(Message hrefMsg) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "requestFocusNodeHref"); + if (TRACE) Log.d(LOGTAG, "requestFocusNodeHref"); mProvider.requestFocusNodeHref(hrefMsg); } @@ -1277,7 +1283,7 @@ public class WebView extends AbsoluteLayout */ public void requestImageRef(Message msg) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "requestImageRef"); + if (TRACE) Log.d(LOGTAG, "requestImageRef"); mProvider.requestImageRef(msg); } @@ -1382,7 +1388,7 @@ public class WebView extends AbsoluteLayout */ public void pauseTimers() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "pauseTimers"); + if (TRACE) Log.d(LOGTAG, "pauseTimers"); mProvider.pauseTimers(); } @@ -1392,7 +1398,7 @@ public class WebView extends AbsoluteLayout */ public void resumeTimers() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "resumeTimers"); + if (TRACE) Log.d(LOGTAG, "resumeTimers"); mProvider.resumeTimers(); } @@ -1405,7 +1411,7 @@ public class WebView extends AbsoluteLayout */ public void onPause() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "onPause"); + if (TRACE) Log.d(LOGTAG, "onPause"); mProvider.onPause(); } @@ -1414,7 +1420,7 @@ public class WebView extends AbsoluteLayout */ public void onResume() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "onResume"); + if (TRACE) Log.d(LOGTAG, "onResume"); mProvider.onResume(); } @@ -1437,7 +1443,7 @@ public class WebView extends AbsoluteLayout @Deprecated public void freeMemory() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "freeMemory"); + if (TRACE) Log.d(LOGTAG, "freeMemory"); mProvider.freeMemory(); } @@ -1449,7 +1455,7 @@ public class WebView extends AbsoluteLayout */ public void clearCache(boolean includeDiskFiles) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "clearCache"); + if (TRACE) Log.d(LOGTAG, "clearCache"); mProvider.clearCache(includeDiskFiles); } @@ -1461,7 +1467,7 @@ public class WebView extends AbsoluteLayout */ public void clearFormData() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "clearFormData"); + if (TRACE) Log.d(LOGTAG, "clearFormData"); mProvider.clearFormData(); } @@ -1470,7 +1476,7 @@ public class WebView extends AbsoluteLayout */ public void clearHistory() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "clearHistory"); + if (TRACE) Log.d(LOGTAG, "clearHistory"); mProvider.clearHistory(); } @@ -1480,7 +1486,7 @@ public class WebView extends AbsoluteLayout */ public void clearSslPreferences() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "clearSslPreferences"); + if (TRACE) Log.d(LOGTAG, "clearSslPreferences"); mProvider.clearSslPreferences(); } @@ -1496,7 +1502,7 @@ public class WebView extends AbsoluteLayout * callback. The runnable will be called in UI thread. */ public static void clearClientCertPreferences(Runnable onCleared) { - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "clearClientCertPreferences"); + if (TRACE) Log.d(LOGTAG, "clearClientCertPreferences"); getFactory().getStatics().clearClientCertPreferences(onCleared); } @@ -1538,7 +1544,7 @@ public class WebView extends AbsoluteLayout */ public void findNext(boolean forward) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "findNext"); + if (TRACE) Log.d(LOGTAG, "findNext"); mProvider.findNext(forward); } @@ -1554,7 +1560,7 @@ public class WebView extends AbsoluteLayout @Deprecated public int findAll(String find) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "findAll"); + if (TRACE) Log.d(LOGTAG, "findAll"); StrictMode.noteSlowCall("findAll blocks UI: prefer findAllAsync"); return mProvider.findAll(find); } @@ -1569,7 +1575,7 @@ public class WebView extends AbsoluteLayout */ public void findAllAsync(String find) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "findAllAsync"); + if (TRACE) Log.d(LOGTAG, "findAllAsync"); mProvider.findAllAsync(find); } @@ -1590,7 +1596,7 @@ public class WebView extends AbsoluteLayout @Deprecated public boolean showFindDialog(String text, boolean showIme) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "showFindDialog"); + if (TRACE) Log.d(LOGTAG, "showFindDialog"); return mProvider.showFindDialog(text, showIme); } @@ -1646,7 +1652,7 @@ public class WebView extends AbsoluteLayout */ public void clearMatches() { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "clearMatches"); + if (TRACE) Log.d(LOGTAG, "clearMatches"); mProvider.clearMatches(); } @@ -1707,7 +1713,7 @@ public class WebView extends AbsoluteLayout @Deprecated public void setPictureListener(PictureListener listener) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "setPictureListener=" + listener); + if (TRACE) Log.d(LOGTAG, "setPictureListener=" + listener); mProvider.setPictureListener(listener); } @@ -1764,7 +1770,7 @@ public class WebView extends AbsoluteLayout */ public void addJavascriptInterface(Object object, String name) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "addJavascriptInterface=" + name); + if (TRACE) Log.d(LOGTAG, "addJavascriptInterface=" + name); mProvider.addJavascriptInterface(object, name); } @@ -1777,7 +1783,7 @@ public class WebView extends AbsoluteLayout */ public void removeJavascriptInterface(String name) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "removeJavascriptInterface=" + name); + if (TRACE) Log.d(LOGTAG, "removeJavascriptInterface=" + name); mProvider.removeJavascriptInterface(name); } @@ -1881,7 +1887,7 @@ public class WebView extends AbsoluteLayout public void flingScroll(int vx, int vy) { checkThread(); - if (DebugFlags.TRACE_API) Log.d(LOGTAG, "flingScroll"); + if (TRACE) Log.d(LOGTAG, "flingScroll"); mProvider.flingScroll(vx, vy); } @@ -2006,6 +2012,7 @@ public class WebView extends AbsoluteLayout * * @hide WebViewProvider is not public API. */ + @SystemApi public WebViewProvider getWebViewProvider() { return mProvider; } @@ -2015,6 +2022,7 @@ public class WebView extends AbsoluteLayout * and fields, and make super-class calls in this WebView instance. * @hide Only for use by WebViewProvider implementations */ + @SystemApi public class PrivateAccess { // ---- Access to super-class methods ---- public int super_getScrollBarStyle() { diff --git a/core/java/android/webkit/WebViewDatabase.java b/core/java/android/webkit/WebViewDatabase.java index 99e0ffb..bfea481 100644 --- a/core/java/android/webkit/WebViewDatabase.java +++ b/core/java/android/webkit/WebViewDatabase.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.SystemApi; import android.content.Context; /** @@ -28,18 +29,12 @@ import android.content.Context; * <li>Data entered into text fields (e.g. for autocomplete suggestions)</li> * </ul> */ -public class WebViewDatabase { +public abstract class WebViewDatabase { /** * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ protected static final String LOGTAG = "webviewdatabase"; - /** - * @hide Only for use by WebViewProvider implementations. - */ - protected WebViewDatabase() { - } - public static WebViewDatabase getInstance(Context context) { return WebViewFactory.getProvider().getWebViewDatabase(context); } @@ -54,9 +49,7 @@ public class WebViewDatabase { * @deprecated Saving passwords in WebView will not be supported in future versions. */ @Deprecated - public boolean hasUsernamePassword() { - throw new MustOverrideException(); - } + public abstract boolean hasUsernamePassword(); /** * Clears any saved username/password pairs for web forms. @@ -67,9 +60,7 @@ public class WebViewDatabase { * @deprecated Saving passwords in WebView will not be supported in future versions. */ @Deprecated - public void clearUsernamePassword() { - throw new MustOverrideException(); - } + public abstract void clearUsernamePassword(); /** * Gets whether there are any saved credentials for HTTP authentication. @@ -79,9 +70,7 @@ public class WebViewDatabase { * @see WebView#setHttpAuthUsernamePassword * @see #clearHttpAuthUsernamePassword */ - public boolean hasHttpAuthUsernamePassword() { - throw new MustOverrideException(); - } + public abstract boolean hasHttpAuthUsernamePassword(); /** * Clears any saved credentials for HTTP authentication. @@ -90,9 +79,7 @@ public class WebViewDatabase { * @see WebView#setHttpAuthUsernamePassword * @see #hasHttpAuthUsernamePassword */ - public void clearHttpAuthUsernamePassword() { - throw new MustOverrideException(); - } + public abstract void clearHttpAuthUsernamePassword(); /** * Gets whether there is any saved data for web forms. @@ -100,16 +87,12 @@ public class WebViewDatabase { * @return whether there is any saved data for web forms * @see #clearFormData */ - public boolean hasFormData() { - throw new MustOverrideException(); - } + public abstract boolean hasFormData(); /** * Clears any saved data for web forms. * * @see #hasFormData */ - public void clearFormData() { - throw new MustOverrideException(); - } + public abstract void clearFormData(); } diff --git a/core/java/android/webkit/WebViewDelegate.java b/core/java/android/webkit/WebViewDelegate.java index c878b3d..3dcfda3 100644 --- a/core/java/android/webkit/WebViewDelegate.java +++ b/core/java/android/webkit/WebViewDelegate.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.SystemApi; import android.app.ActivityThread; import android.app.Application; import android.content.Context; @@ -35,6 +36,7 @@ import android.view.ViewRootImpl; * * @hide */ +@SystemApi public final class WebViewDelegate { /* package */ WebViewDelegate() { } diff --git a/core/java/android/webkit/WebViewFactory.java b/core/java/android/webkit/WebViewFactory.java index ca9f378..7b23d8f 100644 --- a/core/java/android/webkit/WebViewFactory.java +++ b/core/java/android/webkit/WebViewFactory.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.SystemApi; import android.app.ActivityManagerInternal; import android.app.Application; import android.app.AppGlobals; @@ -46,6 +47,7 @@ import com.android.internal.os.Zygote; * * @hide */ +@SystemApi public final class WebViewFactory { private static final String CHROMIUM_WEBVIEW_FACTORY = diff --git a/core/java/android/webkit/WebViewFactoryProvider.java b/core/java/android/webkit/WebViewFactoryProvider.java index d37d217..9105394 100644 --- a/core/java/android/webkit/WebViewFactoryProvider.java +++ b/core/java/android/webkit/WebViewFactoryProvider.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.SystemApi; import android.content.Context; import android.content.Intent; import android.net.Uri; @@ -26,6 +27,7 @@ import android.net.Uri; * implementation of this interface, and make it available to the WebView via mechanism TBD. * @hide */ +@SystemApi public interface WebViewFactoryProvider { /** * This Interface provides glue for implementing the backend of WebView static methods which diff --git a/core/java/android/webkit/WebViewProvider.java b/core/java/android/webkit/WebViewProvider.java index fe18138..2aee57b 100644 --- a/core/java/android/webkit/WebViewProvider.java +++ b/core/java/android/webkit/WebViewProvider.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.SystemApi; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -53,6 +54,7 @@ import java.util.Map; * * @hide Not part of the public API; only required by system implementors. */ +@SystemApi public interface WebViewProvider { //------------------------------------------------------------------------- // Main interface for backend provider of the WebView class. |