diff options
19 files changed, 110 insertions, 53 deletions
diff --git a/core/java/android/webkit/CacheManager.java b/core/java/android/webkit/CacheManager.java index b8394203c61f..fc76029a8bef 100644 --- a/core/java/android/webkit/CacheManager.java +++ b/core/java/android/webkit/CacheManager.java @@ -16,13 +16,14 @@ package android.webkit; +import android.annotation.Nullable; + import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Map; - /** * Manages the HTTP cache used by an application's {@link WebView} instances. * @deprecated Access to the HTTP cache will be removed in a future release. @@ -233,6 +234,7 @@ public final class CacheManager { * @deprecated This method no longer has any effect and always returns {@code null}. */ @Deprecated + @Nullable public static File getCacheFileBaseDir() { return null; } @@ -287,6 +289,7 @@ public final class CacheManager { * @deprecated This method no longer has any effect and always returns {@code null}. */ @Deprecated + @Nullable public static CacheResult getCacheFile(String url, Map<String, String> headers) { return null; diff --git a/core/java/android/webkit/ClientCertRequest.java b/core/java/android/webkit/ClientCertRequest.java index de17534b959b..0fc47f1ed0ff 100644 --- a/core/java/android/webkit/ClientCertRequest.java +++ b/core/java/android/webkit/ClientCertRequest.java @@ -16,6 +16,8 @@ package android.webkit; +import android.annotation.Nullable; + import java.security.Principal; import java.security.PrivateKey; import java.security.cert.X509Certificate; @@ -42,14 +44,16 @@ public abstract class ClientCertRequest { public ClientCertRequest() { } /** - * Returns the acceptable types of asymmetric keys (can be {@code null}). + * Returns the acceptable types of asymmetric keys. */ + @Nullable public abstract String[] getKeyTypes(); /** * Returns the acceptable certificate issuers for the certificate - * matching the private key (can be {@code null}). + * matching the private key. */ + @Nullable public abstract Principal[] getPrincipals(); /** diff --git a/core/java/android/webkit/CookieManager.java b/core/java/android/webkit/CookieManager.java index 89892930ea89..ae6a2fd787d7 100644 --- a/core/java/android/webkit/CookieManager.java +++ b/core/java/android/webkit/CookieManager.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.Nullable; import android.annotation.SystemApi; import android.net.WebAddress; @@ -116,7 +117,8 @@ public abstract class CookieManager { * HTTP response header * @param callback a callback to be executed when the cookie has been set */ - public abstract void setCookie(String url, String value, ValueCallback<Boolean> callback); + public abstract void setCookie(String url, String value, @Nullable ValueCallback<Boolean> + callback); /** * Gets the cookies for the given URL. @@ -175,7 +177,7 @@ public abstract class CookieManager { * method from a thread without a Looper. * @param callback a callback which is executed when the session cookies have been removed */ - public abstract void removeSessionCookies(ValueCallback<Boolean> callback); + public abstract void removeSessionCookies(@Nullable ValueCallback<Boolean> callback); /** * Removes all cookies. @@ -197,7 +199,7 @@ public abstract class CookieManager { * method from a thread without a Looper. * @param callback a callback which is executed when the cookies have been removed */ - public abstract void removeAllCookies(ValueCallback<Boolean> callback); + public abstract void removeAllCookies(@Nullable ValueCallback<Boolean> callback); /** * Gets whether there are stored cookies. diff --git a/core/java/android/webkit/FindActionModeCallback.java b/core/java/android/webkit/FindActionModeCallback.java index 71f85d70e30d..6a8c256f0ae2 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.NonNull; import android.annotation.SystemApi; import android.content.Context; import android.content.res.Resources; @@ -87,10 +88,12 @@ public class FindActionModeCallback implements ActionMode.Callback, TextWatcher, mMatchesFound = false; } - /* - * Set the WebView to search. Must be non null. + /** + * Set the WebView to search. + * + * @param webView an implementation of WebView */ - public void setWebView(WebView webView) { + public void setWebView(@NonNull WebView webView) { if (null == webView) { throw new AssertionError("WebView supplied to " + "FindActionModeCallback cannot be null"); diff --git a/core/java/android/webkit/MimeTypeMap.java b/core/java/android/webkit/MimeTypeMap.java index e172c02e2466..39874e82ec03 100644 --- a/core/java/android/webkit/MimeTypeMap.java +++ b/core/java/android/webkit/MimeTypeMap.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.Nullable; import android.text.TextUtils; import libcore.net.MimeUtils; @@ -86,6 +87,7 @@ public class MimeTypeMap { * @param extension A file extension without the leading '.' * @return The MIME type for the given extension or {@code null} iff there is none. */ + @Nullable public String getMimeTypeFromExtension(String extension) { return MimeUtils.guessMimeTypeFromExtension(extension); } @@ -111,6 +113,7 @@ public class MimeTypeMap { * @param mimeType A MIME type (i.e. text/plain) * @return The extension for the given MIME type or {@code null} iff there is none. */ + @Nullable public String getExtensionFromMimeType(String mimeType) { return MimeUtils.guessExtensionFromMimeType(mimeType); } @@ -125,7 +128,7 @@ public class MimeTypeMap { * @param contentDisposition Content-disposition header given by the server. * @return The MIME type that should be used for this data. */ - /* package */ String remapGenericMimeType(String mimeType, String url, + /* package */ String remapGenericMimeType(@Nullable String mimeType, String url, String contentDisposition) { // If we have one of "generic" MIME types, try to deduce // the right MIME type from the file extension (if any): diff --git a/core/java/android/webkit/ServiceWorkerClient.java b/core/java/android/webkit/ServiceWorkerClient.java index b4964fd2fea0..d6e8f36ce101 100644 --- a/core/java/android/webkit/ServiceWorkerClient.java +++ b/core/java/android/webkit/ServiceWorkerClient.java @@ -16,6 +16,8 @@ package android.webkit; +import android.annotation.Nullable; + /** * Base class for clients to capture Service Worker related callbacks, * see {@link ServiceWorkerController} for usage example. @@ -37,6 +39,7 @@ public class ServiceWorkerClient { * resource itself. * @see WebViewClient#shouldInterceptRequest(WebView, WebResourceRequest) */ + @Nullable public WebResourceResponse shouldInterceptRequest(WebResourceRequest request) { return null; } diff --git a/core/java/android/webkit/TokenBindingService.java b/core/java/android/webkit/TokenBindingService.java index 43565c23355d..b37e1b8962c5 100644 --- a/core/java/android/webkit/TokenBindingService.java +++ b/core/java/android/webkit/TokenBindingService.java @@ -16,6 +16,8 @@ package android.webkit; +import android.annotation.NonNull; +import android.annotation.Nullable; import android.annotation.SystemApi; import android.net.Uri; @@ -84,31 +86,30 @@ public abstract class TokenBindingService { * The user can pass {@code null} if any algorithm is acceptable. * * @param origin The origin for the server. - * @param algorithm The list of algorithms. Can be {@code null}. An - * IllegalArgumentException is thrown if array is empty. + * @param algorithm The list of algorithms. An IllegalArgumentException is thrown if array is + * empty. * @param callback The callback that will be called when key is available. - * Cannot be {@code null}. */ public abstract void getKey(Uri origin, - String[] algorithm, - ValueCallback<TokenBindingKey> callback); + @Nullable String[] algorithm, + @NonNull ValueCallback<TokenBindingKey> callback); /** * Deletes specified key (for use when associated cookie is cleared). * * @param origin The origin of the server. * @param callback The callback that will be called when key is deleted. The * callback parameter (Boolean) will indicate if operation is - * successful or if failed. The callback can be {@code null}. + * successful or if failed. */ public abstract void deleteKey(Uri origin, - ValueCallback<Boolean> callback); + @Nullable ValueCallback<Boolean> callback); /** * Deletes all the keys (for use when cookies are cleared). * * @param callback The callback that will be called when keys are deleted. * The callback parameter (Boolean) will indicate if operation is - * successful or if failed. The callback can be {@code null}. + * successful or if failed. */ - public abstract void deleteAllKeys(ValueCallback<Boolean> callback); + public abstract void deleteAllKeys(@Nullable ValueCallback<Boolean> callback); } diff --git a/core/java/android/webkit/URLUtil.java b/core/java/android/webkit/URLUtil.java index c8bfb77992f1..1956df341eb6 100644 --- a/core/java/android/webkit/URLUtil.java +++ b/core/java/android/webkit/URLUtil.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.Nullable; import android.net.ParseException; import android.net.Uri; import android.net.WebAddress; @@ -300,8 +301,8 @@ public final class URLUtil { */ public static final String guessFileName( String url, - String contentDisposition, - String mimeType) { + @Nullable String contentDisposition, + @Nullable String mimeType) { String filename = null; String extension = null; diff --git a/core/java/android/webkit/UrlInterceptHandler.java b/core/java/android/webkit/UrlInterceptHandler.java index aa5c6dc76753..0a6e51f7f3bd 100644 --- a/core/java/android/webkit/UrlInterceptHandler.java +++ b/core/java/android/webkit/UrlInterceptHandler.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.Nullable; import android.webkit.CacheManager.CacheResult; import android.webkit.PluginData; @@ -35,14 +36,15 @@ public interface UrlInterceptHandler { * not interested. * * @param url URL string. - * @param headers The headers associated with the request. May be {@code null}. + * @param headers The headers associated with the request. * @return The CacheResult containing the surrogate response. * * @hide * @deprecated Do not use, this interface is deprecated. */ @Deprecated - public CacheResult service(String url, Map<String, String> headers); + @Nullable + CacheResult service(String url, @Nullable Map<String, String> headers); /** * Given an URL, returns the PluginData which contains the @@ -50,12 +52,13 @@ public interface UrlInterceptHandler { * not interested. * * @param url URL string. - * @param headers The headers associated with the request. May be {@code null}. + * @param headers The headers associated with the request. * @return The PluginData containing the surrogate response. * * @hide * @deprecated Do not use, this interface is deprecated. */ @Deprecated - public PluginData getPluginData(String url, Map<String, String> headers); + @Nullable + PluginData getPluginData(String url, @Nullable Map<String, String> headers); } diff --git a/core/java/android/webkit/UrlInterceptRegistry.java b/core/java/android/webkit/UrlInterceptRegistry.java index 67af2ad015c7..700d6d9332d6 100644 --- a/core/java/android/webkit/UrlInterceptRegistry.java +++ b/core/java/android/webkit/UrlInterceptRegistry.java @@ -16,6 +16,7 @@ package android.webkit; +import android.annotation.Nullable; import android.webkit.CacheManager.CacheResult; import android.webkit.PluginData; import android.webkit.UrlInterceptHandler; @@ -121,6 +122,7 @@ public final class UrlInterceptRegistry { * deprecated, so is this class. */ @Deprecated + @Nullable public static synchronized CacheResult getSurrogate( String url, Map<String, String> headers) { if (urlInterceptDisabled()) { @@ -149,6 +151,7 @@ public final class UrlInterceptRegistry { * deprecated, so is this class. */ @Deprecated + @Nullable public static synchronized PluginData getPluginData( String url, Map<String, String> headers) { if (urlInterceptDisabled()) { diff --git a/core/java/android/webkit/WebBackForwardList.java b/core/java/android/webkit/WebBackForwardList.java index 3349b06538d1..0c34e3c16ac6 100644 --- a/core/java/android/webkit/WebBackForwardList.java +++ b/core/java/android/webkit/WebBackForwardList.java @@ -16,6 +16,8 @@ package android.webkit; +import android.annotation.Nullable; + import java.io.Serializable; /** @@ -29,6 +31,7 @@ public abstract class WebBackForwardList implements Cloneable, Serializable { * empty. * @return The current history item. */ + @Nullable public abstract WebHistoryItem getCurrentItem(); /** diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java index 3444d49c05e5..671ef37f4d5d 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.Nullable; import android.annotation.SystemApi; import android.content.Intent; import android.content.pm.ActivityInfo; @@ -383,6 +384,7 @@ public class WebChromeClient { * @return Bitmap The image to use as a default poster, or {@code null} if no such image is * available. */ + @Nullable public Bitmap getDefaultVideoPoster() { return null; } @@ -394,6 +396,7 @@ public class WebChromeClient { * * @return View The View to be displayed whilst the video is loading. */ + @Nullable public View getVideoLoadingProgressView() { return null; } @@ -452,6 +455,7 @@ public class WebChromeClient { * @return the Uris of selected file(s) or {@code null} if the resultCode indicates * activity canceled or any other error. */ + @Nullable public static Uri[] parseResult(int resultCode, Intent data) { return WebViewFactory.getProvider().getStatics().parseFileChooserResult(resultCode, data); } @@ -477,14 +481,16 @@ public class WebChromeClient { public abstract boolean isCaptureEnabled(); /** - * Returns the title to use for this file selector, or null. If {@code null} a default - * title should be used. + * Returns the title to use for this file selector. If {@code null} a default title should + * be used. */ + @Nullable public abstract CharSequence getTitle(); /** * The file name of a default selection if specified, or {@code null}. */ + @Nullable public abstract String getFilenameHint(); /** diff --git a/core/java/android/webkit/WebHistoryItem.java b/core/java/android/webkit/WebHistoryItem.java index 1591833eee96..74db039e015d 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.Nullable; import android.annotation.SystemApi; import android.graphics.Bitmap; @@ -70,6 +71,7 @@ public abstract class WebHistoryItem implements Cloneable { * Note: The VM ensures 32-bit atomic read/write operations so we don't have * to synchronize this method. */ + @Nullable public abstract Bitmap getFavicon(); /** diff --git a/core/java/android/webkit/WebMessage.java b/core/java/android/webkit/WebMessage.java index 7fe66dc84e10..bfc00e7a0145 100644 --- a/core/java/android/webkit/WebMessage.java +++ b/core/java/android/webkit/WebMessage.java @@ -16,6 +16,8 @@ package android.webkit; +import android.annotation.Nullable; + /** * The Java representation of the HTML5 PostMessage event. See * https://html.spec.whatwg.org/multipage/comms.html#the-messageevent-interfaces @@ -56,6 +58,7 @@ public class WebMessage { * Returns the ports that are sent with the message, or {@code null} if no port * is sent. */ + @Nullable public WebMessagePort[] getPorts() { return mPorts; } diff --git a/core/java/android/webkit/WebResourceResponse.java b/core/java/android/webkit/WebResourceResponse.java index 80c43c147dbe..7bc7b07d2fc1 100644 --- a/core/java/android/webkit/WebResourceResponse.java +++ b/core/java/android/webkit/WebResourceResponse.java @@ -16,12 +16,13 @@ package android.webkit; +import android.annotation.NonNull; +import android.annotation.SystemApi; + import java.io.InputStream; import java.io.StringBufferInputStream; import java.util.Map; -import android.annotation.SystemApi; - /** * Encapsulates a resource response. Applications can return an instance of this * class from {@link WebViewClient#shouldInterceptRequest} to provide a custom @@ -63,15 +64,15 @@ public class WebResourceResponse { * @param encoding the resource response's encoding * @param statusCode the status code needs to be in the ranges [100, 299], [400, 599]. * Causing a redirect by specifying a 3xx code is not supported. - * @param reasonPhrase the phrase describing the status code, for example "OK". Must be non-null - * and not empty. + * @param reasonPhrase the phrase describing the status code, for example "OK". Must be + * non-empty. * @param responseHeaders the resource response's headers represented as a mapping of header * name -> header value. * @param data the input stream that provides the resource response's data. Must not be a * StringBufferInputStream. */ public WebResourceResponse(String mimeType, String encoding, int statusCode, - String reasonPhrase, Map<String, String> responseHeaders, InputStream data) { + @NonNull String reasonPhrase, Map<String, String> responseHeaders, InputStream data) { this(mimeType, encoding, data); setStatusCodeAndReasonPhrase(statusCode, reasonPhrase); setResponseHeaders(responseHeaders); @@ -121,10 +122,10 @@ public class WebResourceResponse { * * @param statusCode the status code needs to be in the ranges [100, 299], [400, 599]. * Causing a redirect by specifying a 3xx code is not supported. - * @param reasonPhrase the phrase describing the status code, for example "OK". Must be non-null - * and not empty. + * @param reasonPhrase the phrase describing the status code, for example "OK". Must be + * non-empty. */ - public void setStatusCodeAndReasonPhrase(int statusCode, String reasonPhrase) { + public void setStatusCodeAndReasonPhrase(int statusCode, @NonNull String reasonPhrase) { checkImmutable(); if (statusCode < 100) throw new IllegalArgumentException("statusCode can't be less than 100."); diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index 36a00ab40e46..0a4088a1d48d 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -17,6 +17,7 @@ package android.webkit; import android.annotation.IntDef; +import android.annotation.Nullable; import android.annotation.SystemApi; import android.content.Context; @@ -1238,7 +1239,7 @@ public abstract class WebSettings { * * @param ua new user-agent string */ - public abstract void setUserAgentString(String ua); + public abstract void setUserAgentString(@Nullable String ua); /** * Gets the WebView's user-agent string. diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index a930fa80e035..3c5a7e49e813 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -443,7 +443,7 @@ public class WebView extends AbsoluteLayout * @deprecated Deprecated due to internal changes. */ @Deprecated - public void onNewPicture(WebView view, Picture picture); + void onNewPicture(WebView view, @Nullable Picture picture); } public static class HitTestResult { @@ -534,6 +534,7 @@ public class WebView extends AbsoluteLayout * * @return additional type-dependant information about the result */ + @Nullable public String getExtra() { return mExtra; } @@ -722,6 +723,7 @@ public class WebView extends AbsoluteLayout * * @return the SSL certificate for the main top-level page */ + @Nullable public SslCertificate getCertificate() { checkThread(); return mProvider.getCertificate(); @@ -790,6 +792,7 @@ public class WebView extends AbsoluteLayout * @deprecated Use {@link WebViewDatabase#getHttpAuthUsernamePassword} instead */ @Deprecated + @Nullable public String[] getHttpAuthUsernamePassword(String host, String realm) { checkThread(); return mProvider.getHttpAuthUsernamePassword(host, realm); @@ -858,9 +861,10 @@ public class WebView extends AbsoluteLayout * called. * * @param outState the Bundle to store this WebView's state - * @return the same copy of the back/forward list used to save the state. If - * saveState fails, the returned list will be {@code null}. + * @return the same copy of the back/forward list used to save the state, {@code null} if the + * method fails. */ + @Nullable public WebBackForwardList saveState(Bundle outState) { checkThread(); return mProvider.saveState(outState); @@ -911,6 +915,7 @@ public class WebView extends AbsoluteLayout * @param inState the incoming Bundle of state * @return the restored back/forward list or {@code null} if restoreState failed */ + @Nullable public WebBackForwardList restoreState(Bundle inState) { checkThread(); return mProvider.restoreState(inState); @@ -990,10 +995,11 @@ public class WebView extends AbsoluteLayout * always overrides that specified in the HTML or XML document itself. * * @param data a String of data in the given encoding - * @param mimeType the MIME type of the data, e.g. 'text/html' + * @param mimeType the MIMEType of the data, e.g. 'text/html'. If {@code null}, + * defaults to 'text/html'. * @param encoding the encoding of the data */ - public void loadData(String data, String mimeType, String encoding) { + public void loadData(String data, @Nullable String mimeType, @Nullable String encoding) { checkThread(); mProvider.loadData(data, mimeType, encoding); } @@ -1027,8 +1033,8 @@ public class WebView extends AbsoluteLayout * @param historyUrl the URL to use as the history entry. If {@code null} defaults * to 'about:blank'. If non-null, this must be a valid URL. */ - public void loadDataWithBaseURL(String baseUrl, String data, - String mimeType, String encoding, String historyUrl) { + public void loadDataWithBaseURL(@Nullable String baseUrl, String data, + @Nullable String mimeType, @Nullable String encoding, @Nullable String historyUrl) { checkThread(); mProvider.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl); } @@ -1050,7 +1056,7 @@ public class WebView extends AbsoluteLayout * completes with the result of the execution (if any). * May be {@code null} if no notification of the result is required. */ - public void evaluateJavascript(String script, ValueCallback<String> resultCallback) { + public void evaluateJavascript(String script, @Nullable ValueCallback<String> resultCallback) { checkThread(); mProvider.evaluateJavaScript(script, resultCallback); } @@ -1077,7 +1083,8 @@ public class WebView extends AbsoluteLayout * under which the file was saved, or {@code null} if saving the * file failed. */ - public void saveWebArchive(String basename, boolean autoname, ValueCallback<String> callback) { + public void saveWebArchive(String basename, boolean autoname, @Nullable ValueCallback<String> + callback) { checkThread(); mProvider.saveWebArchive(basename, autoname, callback); } @@ -1400,7 +1407,7 @@ public class WebView extends AbsoluteLayout * returns the anchor's href attribute. "title" returns the * anchor's text. "src" returns the image's src attribute. */ - public void requestFocusNodeHref(Message hrefMsg) { + public void requestFocusNodeHref(@Nullable Message hrefMsg) { checkThread(); mProvider.requestFocusNodeHref(hrefMsg); } @@ -1620,10 +1627,9 @@ public class WebView extends AbsoluteLayout * shared by all the WebViews that are created by the embedder application. * * @param onCleared A runnable to be invoked when client certs are cleared. - * The embedder can pass {@code null} if not interested in the - * callback. The runnable will be called in UI thread. + * The runnable will be called in UI thread. */ - public static void clearClientCertPreferences(Runnable onCleared) { + public static void clearClientCertPreferences(@Nullable Runnable onCleared) { getFactory().getStatics().clearClientCertPreferences(onCleared); } @@ -1645,7 +1651,8 @@ public class WebView extends AbsoluteLayout * @param callback will be called on the UI thread with {@code true} if initialization is * successful, {@code false} otherwise. */ - public static void startSafeBrowsing(Context context, ValueCallback<Boolean> callback) { + public static void startSafeBrowsing(Context context, + @Nullable ValueCallback<Boolean> callback) { getFactory().getStatics().initSafeBrowsing(context, callback); } @@ -1769,7 +1776,7 @@ public class WebView extends AbsoluteLayout * provides a more robust solution. */ @Deprecated - public boolean showFindDialog(String text, boolean showIme) { + public boolean showFindDialog(@Nullable String text, boolean showIme) { checkThread(); return mProvider.showFindDialog(text, showIme); } @@ -1796,6 +1803,7 @@ public class WebView extends AbsoluteLayout * @param addr the string to search for addresses * @return the address, or if no address is found, {@code null} */ + @Nullable public static String findAddress(String addr) { // TODO: Rewrite this in Java so it is not needed to start up chromium // Could also be deprecated @@ -1896,6 +1904,7 @@ public class WebView extends AbsoluteLayout * @return the WebChromeClient, or {@code null} if not yet set * @see #setWebChromeClient */ + @Nullable public WebChromeClient getWebChromeClient() { checkThread(); return mProvider.getWebChromeClient(); @@ -1978,7 +1987,7 @@ public class WebView extends AbsoluteLayout * * @param name the name used to expose the object in JavaScript */ - public void removeJavascriptInterface(String name) { + public void removeJavascriptInterface(@NonNull String name) { checkThread(); mProvider.removeJavascriptInterface(name); } @@ -2990,6 +2999,7 @@ public class WebView extends AbsoluteLayout * next time the app starts and loads WebView it will use the new WebView package instead. * @return the current WebView package, or {@code null} if there is none. */ + @Nullable public static PackageInfo getCurrentWebViewPackage() { PackageInfo webviewPackage = WebViewFactory.getLoadedPackageInfo(); if (webviewPackage != null) { diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java index b750adadbf5f..2c9450b917ca 100644 --- a/core/java/android/webkit/WebViewClient.java +++ b/core/java/android/webkit/WebViewClient.java @@ -17,6 +17,7 @@ package android.webkit; import android.annotation.IntDef; +import android.annotation.Nullable; import android.graphics.Bitmap; import android.net.http.SslError; import android.os.Message; @@ -164,6 +165,7 @@ public class WebViewClient { * shouldInterceptRequest(WebView, WebResourceRequest)} instead. */ @Deprecated + @Nullable public WebResourceResponse shouldInterceptRequest(WebView view, String url) { return null; @@ -184,6 +186,7 @@ public class WebViewClient { * response information or {@code null} if the WebView should load the * resource itself. */ + @Nullable public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) { return shouldInterceptRequest(view, request.getUrl().toString()); @@ -489,7 +492,7 @@ public class WebViewClient { * @param args Authenticator specific arguments used to log in the user. */ public void onReceivedLoginRequest(WebView view, String realm, - String account, String args) { + @Nullable String account, String args) { } /** diff --git a/core/java/android/webkit/WebViewDatabase.java b/core/java/android/webkit/WebViewDatabase.java index de75d5d0feea..f6166c58a4c9 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.Nullable; import android.content.Context; /** @@ -135,6 +136,7 @@ public abstract class WebViewDatabase { * @see #hasHttpAuthUsernamePassword * @see #clearHttpAuthUsernamePassword */ + @Nullable public abstract String[] getHttpAuthUsernamePassword(String host, String realm); /** |