diff options
| -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 be74a48a1c4f..35c6a995247b 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; @@ -372,7 +374,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. @@ -423,7 +425,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. @@ -536,4 +538,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"); + } } |