* commit '16bfbbba69e781bc6f52d332e1fabad979133d0a': Update the new error reporting API in android.webkit
This commit is contained in:
@@ -38811,8 +38811,7 @@ package android.webkit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract class WebResourceError {
|
public abstract class WebResourceError {
|
||||||
ctor public WebResourceError();
|
method public abstract java.lang.CharSequence getDescription();
|
||||||
method public abstract java.lang.String getDescription();
|
|
||||||
method public abstract int getErrorCode();
|
method public abstract int getErrorCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38842,12 +38841,6 @@ package android.webkit {
|
|||||||
|
|
||||||
public abstract class WebResourceResponseBase {
|
public abstract class WebResourceResponseBase {
|
||||||
ctor public WebResourceResponseBase();
|
ctor public WebResourceResponseBase();
|
||||||
method public abstract java.io.InputStream getData();
|
|
||||||
method public abstract java.lang.String getEncoding();
|
|
||||||
method public abstract java.lang.String getMimeType();
|
|
||||||
method public abstract java.lang.String getReasonPhrase();
|
|
||||||
method public abstract java.util.Map<java.lang.String, java.lang.String> getResponseHeaders();
|
|
||||||
method public abstract int getStatusCode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class WebSettings {
|
public abstract class WebSettings {
|
||||||
@@ -39179,6 +39172,7 @@ package android.webkit {
|
|||||||
method public void onReceivedError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceError);
|
method public void onReceivedError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceError);
|
||||||
method public void onReceivedHttpAuthRequest(android.webkit.WebView, android.webkit.HttpAuthHandler, java.lang.String, java.lang.String);
|
method public void onReceivedHttpAuthRequest(android.webkit.WebView, android.webkit.HttpAuthHandler, java.lang.String, java.lang.String);
|
||||||
method public void onReceivedHttpError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceResponseBase);
|
method public void onReceivedHttpError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceResponseBase);
|
||||||
|
method public void onReceivedHttpError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceResponse);
|
||||||
method public void onReceivedLoginRequest(android.webkit.WebView, java.lang.String, java.lang.String, java.lang.String);
|
method public void onReceivedLoginRequest(android.webkit.WebView, java.lang.String, java.lang.String, java.lang.String);
|
||||||
method public void onReceivedSslError(android.webkit.WebView, android.webkit.SslErrorHandler, android.net.http.SslError);
|
method public void onReceivedSslError(android.webkit.WebView, android.webkit.SslErrorHandler, android.net.http.SslError);
|
||||||
method public void onScaleChanged(android.webkit.WebView, float, float);
|
method public void onScaleChanged(android.webkit.WebView, float, float);
|
||||||
|
|||||||
@@ -41133,7 +41133,7 @@ package android.webkit {
|
|||||||
|
|
||||||
public abstract class WebResourceError {
|
public abstract class WebResourceError {
|
||||||
ctor public WebResourceError();
|
ctor public WebResourceError();
|
||||||
method public abstract java.lang.String getDescription();
|
method public abstract java.lang.CharSequence getDescription();
|
||||||
method public abstract int getErrorCode();
|
method public abstract int getErrorCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41148,6 +41148,7 @@ package android.webkit {
|
|||||||
public class WebResourceResponse extends android.webkit.WebResourceResponseBase {
|
public class WebResourceResponse extends android.webkit.WebResourceResponseBase {
|
||||||
ctor public WebResourceResponse(java.lang.String, java.lang.String, java.io.InputStream);
|
ctor public WebResourceResponse(java.lang.String, java.lang.String, java.io.InputStream);
|
||||||
ctor public WebResourceResponse(java.lang.String, java.lang.String, int, java.lang.String, java.util.Map<java.lang.String, java.lang.String>, java.io.InputStream);
|
ctor public WebResourceResponse(java.lang.String, java.lang.String, int, java.lang.String, java.util.Map<java.lang.String, java.lang.String>, java.io.InputStream);
|
||||||
|
ctor public WebResourceResponse(boolean, java.lang.String, java.lang.String, int, java.lang.String, java.util.Map<java.lang.String, java.lang.String>, java.io.InputStream);
|
||||||
method public java.io.InputStream getData();
|
method public java.io.InputStream getData();
|
||||||
method public java.lang.String getEncoding();
|
method public java.lang.String getEncoding();
|
||||||
method public java.lang.String getMimeType();
|
method public java.lang.String getMimeType();
|
||||||
@@ -41163,12 +41164,6 @@ package android.webkit {
|
|||||||
|
|
||||||
public abstract class WebResourceResponseBase {
|
public abstract class WebResourceResponseBase {
|
||||||
ctor public WebResourceResponseBase();
|
ctor public WebResourceResponseBase();
|
||||||
method public abstract java.io.InputStream getData();
|
|
||||||
method public abstract java.lang.String getEncoding();
|
|
||||||
method public abstract java.lang.String getMimeType();
|
|
||||||
method public abstract java.lang.String getReasonPhrase();
|
|
||||||
method public abstract java.util.Map<java.lang.String, java.lang.String> getResponseHeaders();
|
|
||||||
method public abstract int getStatusCode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class WebSettings {
|
public abstract class WebSettings {
|
||||||
@@ -41545,6 +41540,7 @@ package android.webkit {
|
|||||||
method public void onReceivedError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceError);
|
method public void onReceivedError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceError);
|
||||||
method public void onReceivedHttpAuthRequest(android.webkit.WebView, android.webkit.HttpAuthHandler, java.lang.String, java.lang.String);
|
method public void onReceivedHttpAuthRequest(android.webkit.WebView, android.webkit.HttpAuthHandler, java.lang.String, java.lang.String);
|
||||||
method public void onReceivedHttpError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceResponseBase);
|
method public void onReceivedHttpError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceResponseBase);
|
||||||
|
method public void onReceivedHttpError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceResponse);
|
||||||
method public void onReceivedLoginRequest(android.webkit.WebView, java.lang.String, java.lang.String, java.lang.String);
|
method public void onReceivedLoginRequest(android.webkit.WebView, java.lang.String, java.lang.String, java.lang.String);
|
||||||
method public void onReceivedSslError(android.webkit.WebView, android.webkit.SslErrorHandler, android.net.http.SslError);
|
method public void onReceivedSslError(android.webkit.WebView, android.webkit.SslErrorHandler, android.net.http.SslError);
|
||||||
method public void onScaleChanged(android.webkit.WebView, float, float);
|
method public void onScaleChanged(android.webkit.WebView, float, float);
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package android.webkit;
|
package android.webkit;
|
||||||
|
|
||||||
|
import android.annotation.SystemApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encapsulates information about errors occured during loading of web resources. See
|
* Encapsulates information about errors occured during loading of web resources. See
|
||||||
* {@link WebViewClient#onReceivedError(WebView, WebResourceRequest, WebResourceError) WebViewClient.onReceivedError(WebView, WebResourceRequest, WebResourceError)}
|
* {@link WebViewClient#onReceivedError(WebView, WebResourceRequest, WebResourceError) WebViewClient.onReceivedError(WebView, WebResourceRequest, WebResourceError)}
|
||||||
@@ -35,5 +37,12 @@ public abstract class WebResourceError {
|
|||||||
*
|
*
|
||||||
* @return The description of the error
|
* @return The description of the error
|
||||||
*/
|
*/
|
||||||
public abstract String getDescription();
|
public abstract CharSequence getDescription();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class can not be subclassed by applications.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
public WebResourceError() {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,12 +20,15 @@ import java.io.InputStream;
|
|||||||
import java.io.StringBufferInputStream;
|
import java.io.StringBufferInputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import android.annotation.SystemApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encapsulates a resource response. Applications can return an instance of this
|
* Encapsulates a resource response. Applications can return an instance of this
|
||||||
* class from {@link WebViewClient#shouldInterceptRequest} to provide a custom
|
* class from {@link WebViewClient#shouldInterceptRequest} to provide a custom
|
||||||
* response when the WebView requests a particular resource.
|
* response when the WebView requests a particular resource.
|
||||||
*/
|
*/
|
||||||
public class WebResourceResponse extends WebResourceResponseBase {
|
public class WebResourceResponse extends WebResourceResponseBase {
|
||||||
|
private boolean mImmutable;
|
||||||
private String mMimeType;
|
private String mMimeType;
|
||||||
private String mEncoding;
|
private String mEncoding;
|
||||||
private int mStatusCode;
|
private int mStatusCode;
|
||||||
@@ -80,13 +83,15 @@ public class WebResourceResponse extends WebResourceResponseBase {
|
|||||||
* @param mimeType The resource response's MIME type
|
* @param mimeType The resource response's MIME type
|
||||||
*/
|
*/
|
||||||
public void setMimeType(String mimeType) {
|
public void setMimeType(String mimeType) {
|
||||||
|
checkImmutable();
|
||||||
mMimeType = mimeType;
|
mMimeType = mimeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* Gets the resource response's MIME type.
|
||||||
|
*
|
||||||
|
* @return The resource response's MIME type
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public String getMimeType() {
|
public String getMimeType() {
|
||||||
return mMimeType;
|
return mMimeType;
|
||||||
}
|
}
|
||||||
@@ -98,13 +103,15 @@ public class WebResourceResponse extends WebResourceResponseBase {
|
|||||||
* @param encoding The resource response's encoding
|
* @param encoding The resource response's encoding
|
||||||
*/
|
*/
|
||||||
public void setEncoding(String encoding) {
|
public void setEncoding(String encoding) {
|
||||||
|
checkImmutable();
|
||||||
mEncoding = encoding;
|
mEncoding = encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* Gets the resource response's encoding.
|
||||||
|
*
|
||||||
|
* @return The resource response's encoding
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public String getEncoding() {
|
public String getEncoding() {
|
||||||
return mEncoding;
|
return mEncoding;
|
||||||
}
|
}
|
||||||
@@ -118,6 +125,7 @@ public class WebResourceResponse extends WebResourceResponseBase {
|
|||||||
* and not empty.
|
* and not empty.
|
||||||
*/
|
*/
|
||||||
public void setStatusCodeAndReasonPhrase(int statusCode, String reasonPhrase) {
|
public void setStatusCodeAndReasonPhrase(int statusCode, String reasonPhrase) {
|
||||||
|
checkImmutable();
|
||||||
if (statusCode < 100)
|
if (statusCode < 100)
|
||||||
throw new IllegalArgumentException("statusCode can't be less than 100.");
|
throw new IllegalArgumentException("statusCode can't be less than 100.");
|
||||||
if (statusCode > 599)
|
if (statusCode > 599)
|
||||||
@@ -140,17 +148,19 @@ public class WebResourceResponse extends WebResourceResponseBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* Gets the resource response's status code.
|
||||||
|
*
|
||||||
|
* @return The resource response's status code.
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public int getStatusCode() {
|
public int getStatusCode() {
|
||||||
return mStatusCode;
|
return mStatusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* Gets the description of the resource response's status code.
|
||||||
|
*
|
||||||
|
* @return The description of the resource response's status code.
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public String getReasonPhrase() {
|
public String getReasonPhrase() {
|
||||||
return mReasonPhrase;
|
return mReasonPhrase;
|
||||||
}
|
}
|
||||||
@@ -161,13 +171,15 @@ public class WebResourceResponse extends WebResourceResponseBase {
|
|||||||
* @param headers Mapping of header name -> header value.
|
* @param headers Mapping of header name -> header value.
|
||||||
*/
|
*/
|
||||||
public void setResponseHeaders(Map<String, String> headers) {
|
public void setResponseHeaders(Map<String, String> headers) {
|
||||||
|
checkImmutable();
|
||||||
mResponseHeaders = headers;
|
mResponseHeaders = headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* Gets the headers for the resource response.
|
||||||
|
*
|
||||||
|
* @return The headers for the resource response.
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public Map<String, String> getResponseHeaders() {
|
public Map<String, String> getResponseHeaders() {
|
||||||
return mResponseHeaders;
|
return mResponseHeaders;
|
||||||
}
|
}
|
||||||
@@ -180,6 +192,7 @@ public class WebResourceResponse extends WebResourceResponseBase {
|
|||||||
* StringBufferInputStream.
|
* StringBufferInputStream.
|
||||||
*/
|
*/
|
||||||
public void setData(InputStream data) {
|
public void setData(InputStream data) {
|
||||||
|
checkImmutable();
|
||||||
// If data is (or is a subclass of) StringBufferInputStream
|
// If data is (or is a subclass of) StringBufferInputStream
|
||||||
if (data != null && StringBufferInputStream.class.isAssignableFrom(data.getClass())) {
|
if (data != null && StringBufferInputStream.class.isAssignableFrom(data.getClass())) {
|
||||||
throw new IllegalArgumentException("StringBufferInputStream is deprecated and must " +
|
throw new IllegalArgumentException("StringBufferInputStream is deprecated and must " +
|
||||||
@@ -189,10 +202,32 @@ public class WebResourceResponse extends WebResourceResponseBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* Gets the input stream that provides the resource response's data.
|
||||||
|
*
|
||||||
|
* @return The input stream that provides the resource response's data
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public InputStream getData() {
|
public InputStream getData() {
|
||||||
return mInputStream;
|
return mInputStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The internal version of the constructor that doesn't perform arguments checks.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
public WebResourceResponse(boolean immutable, String mimeType, String encoding, int statusCode,
|
||||||
|
String reasonPhrase, Map<String, String> responseHeaders, InputStream data) {
|
||||||
|
mImmutable = immutable;
|
||||||
|
mMimeType = mimeType;
|
||||||
|
mEncoding = encoding;
|
||||||
|
mStatusCode = statusCode;
|
||||||
|
mReasonPhrase = reasonPhrase;
|
||||||
|
mResponseHeaders = responseHeaders;
|
||||||
|
mInputStream = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkImmutable() {
|
||||||
|
if (mImmutable)
|
||||||
|
throw new IllegalStateException("This WebResourceResponse instance is immutable");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,53 +16,9 @@
|
|||||||
|
|
||||||
package android.webkit;
|
package android.webkit;
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encapsulates a resource response received from the server.
|
* This class will be deleted after updated WebView.apk will be submitted
|
||||||
* This is an abstract class used by WebView callbacks.
|
* into the Android tree.
|
||||||
*/
|
*/
|
||||||
public abstract class WebResourceResponseBase {
|
public abstract class WebResourceResponseBase {
|
||||||
/**
|
|
||||||
* Gets the resource response's MIME type.
|
|
||||||
*
|
|
||||||
* @return The resource response's MIME type
|
|
||||||
*/
|
|
||||||
public abstract String getMimeType();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the resource response's encoding.
|
|
||||||
*
|
|
||||||
* @return The resource response's encoding
|
|
||||||
*/
|
|
||||||
public abstract String getEncoding();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the resource response's status code.
|
|
||||||
*
|
|
||||||
* @return The resource response's status code.
|
|
||||||
*/
|
|
||||||
public abstract int getStatusCode();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the description of the resource response's status code.
|
|
||||||
*
|
|
||||||
* @return The description of the resource response's status code.
|
|
||||||
*/
|
|
||||||
public abstract String getReasonPhrase();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the headers for the resource response.
|
|
||||||
*
|
|
||||||
* @return The headers for the resource response.
|
|
||||||
*/
|
|
||||||
public abstract Map<String, String> getResponseHeaders();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the input stream that provides the resource response's data.
|
|
||||||
*
|
|
||||||
* @return The input stream that provides the resource response's data
|
|
||||||
*/
|
|
||||||
public abstract InputStream getData();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,10 +233,19 @@ public class WebViewClient {
|
|||||||
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
|
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
|
||||||
if (request.isForMainFrame()) {
|
if (request.isForMainFrame()) {
|
||||||
onReceivedError(view,
|
onReceivedError(view,
|
||||||
error.getErrorCode(), error.getDescription(), request.getUrl().toString());
|
error.getErrorCode(), error.getDescription().toString(),
|
||||||
|
request.getUrl().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be deleted after updated WebView.apk will be submitted
|
||||||
|
* into the Android tree.
|
||||||
|
*/
|
||||||
|
public void onReceivedHttpError(
|
||||||
|
WebView view, WebResourceRequest request, WebResourceResponseBase errorResponse) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify the host application that an HTTP error has been received from the server while
|
* Notify the host application that an HTTP error has been received from the server while
|
||||||
* loading a resource. HTTP errors have status codes >= 400. This callback will be called
|
* loading a resource. HTTP errors have status codes >= 400. This callback will be called
|
||||||
@@ -248,7 +257,7 @@ public class WebViewClient {
|
|||||||
* @param errorResponse Information about the error occured.
|
* @param errorResponse Information about the error occured.
|
||||||
*/
|
*/
|
||||||
public void onReceivedHttpError(
|
public void onReceivedHttpError(
|
||||||
WebView view, WebResourceRequest request, WebResourceResponseBase errorResponse) {
|
WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user