diff options
| author | 2017-07-24 11:43:12 +0000 | |
|---|---|---|
| committer | 2017-07-24 11:43:12 +0000 | |
| commit | d394285fdc575d915f49e6ed615291d7c52fb942 (patch) | |
| tree | ff05f59283f4ee407bd0d44527cc56c0aaf6bda4 | |
| parent | 3cf0b6926f5f7166719532c05faa0b1b3bac435e (diff) | |
| parent | d5174ac63d074e4b50a12dd79c5f706904bd3615 (diff) | |
Merge "CaptivePortalLoginActivity: improve logging" am: c0a4f5357e
am: d5174ac63d
Change-Id: Ia8a9105404399901ca633a8f883ffa5be8f9548b
| -rw-r--r-- | packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java index be87ed2ed887..e13aba7e5fe6 100644 --- a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java +++ b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java @@ -37,6 +37,7 @@ import android.provider.Settings; import android.util.ArrayMap; import android.util.Log; import android.util.TypedValue; +import android.util.SparseArray; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -44,6 +45,7 @@ import android.webkit.SslErrorHandler; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; +import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ProgressBar; import android.widget.TextView; @@ -375,7 +377,7 @@ public class CaptivePortalLoginActivity extends Activity { return; } final URL url = makeURL(urlString); - Log.d(TAG, "onPageSarted: " + sanitizeURL(url)); + Log.d(TAG, "onPageStarted: " + sanitizeURL(url)); mHostname = host(url); // For internally generated pages, leave URL bar listing prior URL as this is the URL // the page refers to. @@ -426,7 +428,7 @@ public class CaptivePortalLoginActivity extends Activity { final URL url = makeURL(error.getUrl()); final String host = host(url); Log.d(TAG, String.format("SSL error: %s, url: %s, certificate: %s", - error.getPrimaryError(), sanitizeURL(url), error.getCertificate())); + sslErrorName(error), sanitizeURL(url), error.getCertificate())); if (url == null || !Objects.equals(host, mHostname)) { // Ignore ssl errors for resources coming from a different hostname than the page // that we are currently loading, and only cancel the request. @@ -539,4 +541,18 @@ public class CaptivePortalLoginActivity extends Activity { private void logMetricsEvent(int event) { MetricsLogger.action(this, event, getPackageName()); } + + private static final SparseArray<String> SSL_ERRORS = new SparseArray<>(); + static { + SSL_ERRORS.put(SslError.SSL_NOTYETVALID, "SSL_NOTYETVALID"); + SSL_ERRORS.put(SslError.SSL_EXPIRED, "SSL_EXPIRED"); + SSL_ERRORS.put(SslError.SSL_IDMISMATCH, "SSL_IDMISMATCH"); + SSL_ERRORS.put(SslError.SSL_UNTRUSTED, "SSL_UNTRUSTED"); + SSL_ERRORS.put(SslError.SSL_DATE_INVALID, "SSL_DATE_INVALID"); + SSL_ERRORS.put(SslError.SSL_INVALID, "SSL_INVALID"); + } + + private static String sslErrorName(SslError error) { + return SSL_ERRORS.get(error.getPrimaryError(), "UNKNOWN"); + } } |