From f0bbcd85eaba6624d4c52150e83930e816d873a4 Mon Sep 17 00:00:00 2001 From: Martin Hibdon Date: Fri, 24 Oct 2014 13:53:14 -0700 Subject: [PATCH] Add additional analytics regarding our SSLSockets b/18104622 There were some suggestions for additional info to log. Now we also log the protocol being used, along with the cipher suite, and whether or not we are accepting all certificates (i.e. whether or not we are verifying hostnames.) Change-Id: Iad1fa4d2867d4a27830d54cc7fafcd0d32e0b23b --- .../android/email/mail/transport/MailTransport.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/provider_src/com/android/email/mail/transport/MailTransport.java b/provider_src/com/android/email/mail/transport/MailTransport.java index 657c10072..26801f93f 100644 --- a/provider_src/com/android/email/mail/transport/MailTransport.java +++ b/provider_src/com/android/email/mail/transport/MailTransport.java @@ -122,10 +122,13 @@ public class MailTransport { if (canTrySslSecurity() && !canTrustAllCertificates()) { verifyHostname(mSocket, getHost()); } + Analytics.getInstance().sendEvent("socket_certificates", + "open", Boolean.toString(canTrustAllCertificates()), 0); if (mSocket instanceof SSLSocket) { final SSLSocket sslSocket = (SSLSocket) mSocket; if (sslSocket.getSession() != null) { - Analytics.getInstance().sendEvent("cipher_suite", "open", + Analytics.getInstance().sendEvent("cipher_suite", + sslSocket.getSession().getProtocol(), sslSocket.getSession().getCipherSuite(), 0); } } @@ -167,9 +170,12 @@ public class MailTransport { mIn = new BufferedInputStream(mSocket.getInputStream(), 1024); mOut = new BufferedOutputStream(mSocket.getOutputStream(), 512); + Analytics.getInstance().sendEvent("socket_certificates", + "reopenTls", Boolean.toString(canTrustAllCertificates()), 0); final SSLSocket sslSocket = (SSLSocket) mSocket; if (sslSocket.getSession() != null) { - Analytics.getInstance().sendEvent("cipher_suite", "reopenTls", + Analytics.getInstance().sendEvent("cipher_suite", + sslSocket.getSession().getProtocol(), sslSocket.getSession().getCipherSuite(), 0); } } catch (SSLException e) {