Introduce an SSL handshake timeout value of 30 seconds.

Motorola 0009-IKXREL1KK-5011 patch. Hanging on an SSL handshake is
a real situation that needs to be handled. 30 seconds is more than
enough of a timeout to abort on a potential hang. The coincidental
thing is that there was a fix that was made a while back to email 1
that addressed the same issue in similar code. You can reference it
here: b/7583420.

Change-Id: I0533e57f8c5d45d241adb7f37d54ebe1f0ad9368
diff --git a/emailcommon/src/com/android/emailcommon/utility/SSLUtils.java b/emailcommon/src/com/android/emailcommon/utility/SSLUtils.java
index 66afe14..a620a28 100644
--- a/emailcommon/src/com/android/emailcommon/utility/SSLUtils.java
+++ b/emailcommon/src/com/android/emailcommon/utility/SSLUtils.java
@@ -54,6 +54,9 @@
     private static final boolean LOG_ENABLED = false;
     private static final String TAG = "Email.Ssl";
 
+    // A 30 second SSL handshake should be more than enough.
+    private static final int SSL_HANDSHAKE_TIMEOUT = 30000;
+
     /**
      * A trust manager specific to a particular HostAuth.  The first time a server certificate is
      * encountered for the HostAuth, its certificate is saved; subsequent checks determine whether
@@ -144,7 +147,7 @@
             HostAuth hostAuth, boolean insecure) {
         if (insecure) {
             SSLCertificateSocketFactory insecureFactory = (SSLCertificateSocketFactory)
-                    SSLCertificateSocketFactory.getInsecure(0, null);
+                    SSLCertificateSocketFactory.getInsecure(SSL_HANDSHAKE_TIMEOUT, null);
             insecureFactory.setTrustManagers(
                     new TrustManager[] {
                             new SameCertificateCheckingTrustManager(context, hostAuth)});
@@ -152,7 +155,7 @@
         } else {
             if (sSecureFactory == null) {
                 sSecureFactory = (SSLCertificateSocketFactory)
-                        SSLCertificateSocketFactory.getDefault(0, null);
+                        SSLCertificateSocketFactory.getDefault(SSL_HANDSHAKE_TIMEOUT, null);
             }
             return sSecureFactory;
         }