diff options
author | Paul Jensen <pauljensen@google.com> | 2014-12-09 15:18:40 -0500 |
---|---|---|
committer | Paul Jensen <pauljensen@google.com> | 2014-12-10 14:33:34 +0000 |
commit | fc8022f8cfffded3d94baef3ba5e5ce936799b06 (patch) | |
tree | 0e3e717d3dd710605cc9298fa37e953cb6b4b7f7 /packages | |
parent | 8b33cf4d34a9ea75e1121ee2f1d829b21f3cb5d6 (diff) | |
download | frameworks_base-fc8022f8cfffded3d94baef3ba5e5ce936799b06.zip frameworks_base-fc8022f8cfffded3d94baef3ba5e5ce936799b06.tar.gz frameworks_base-fc8022f8cfffded3d94baef3ba5e5ce936799b06.tar.bz2 |
Show broken lock image when SSL errors are encountered in CaptivePortalLogin.
The WebView cancels the page load by default, so showing an indicative image
at least informs users that there is a security problem.
bug:18505835
bug:18570703
Change-Id: Ie6dd9294eec9ca25d27e95a1cd2c95e3065de469
Diffstat (limited to 'packages')
-rw-r--r-- | packages/CaptivePortalLogin/assets/locked_page.png | bin | 0 -> 7864 bytes | |||
-rw-r--r-- | packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java | 15 |
2 files changed, 15 insertions, 0 deletions
diff --git a/packages/CaptivePortalLogin/assets/locked_page.png b/packages/CaptivePortalLogin/assets/locked_page.png Binary files differnew file mode 100644 index 0000000..91e1291 --- /dev/null +++ b/packages/CaptivePortalLogin/assets/locked_page.png diff --git a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java index 1c7b033..b8acb45 100644 --- a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java +++ b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java @@ -30,6 +30,7 @@ import android.net.NetworkRequest; import android.net.Proxy; import android.net.ProxyInfo; import android.net.Uri; +import android.net.http.SslError; import android.os.Bundle; import android.provider.Settings; import android.provider.Settings.Global; @@ -39,6 +40,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; +import android.webkit.SslErrorHandler; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; @@ -270,6 +272,19 @@ public class CaptivePortalLoginActivity extends Activity { } testForCaptivePortal(); } + + // A web page consisting of a large broken lock icon to indicate SSL failure. + final static String SSL_ERROR_HTML = "<!DOCTYPE html><html><head><style>" + + "html { width:100%; height:100%; " + + " background:url(locked_page.png) center center no-repeat; }" + + "</style></head><body></body></html>"; + + @Override + public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { + Log.w(TAG, "SSL error; displaying broken lock icon."); + view.loadDataWithBaseURL("file:///android_asset/", SSL_ERROR_HTML, "text/HTML", + "UTF-8", null); + } } private class MyWebChromeClient extends WebChromeClient { |