summaryrefslogtreecommitdiffstats
path: root/provider_src
diff options
context:
space:
mode:
authorMartin Hibdon <mhibdon@google.com>2014-09-25 20:24:55 -0700
committerMartin Hibdon <mhibdon@google.com>2014-10-02 10:54:52 -0700
commit601700a61e453c612e0dabe4e93002766b3751b7 (patch)
tree510cf21dfed7ad6559a14fe99f343bbfed6947ee /provider_src
parent083a01382678e4843c3f9b07b2586477a3303484 (diff)
downloadandroid_packages_apps_Email-601700a61e453c612e0dabe4e93002766b3751b7.tar.gz
android_packages_apps_Email-601700a61e453c612e0dabe4e93002766b3751b7.tar.bz2
android_packages_apps_Email-601700a61e453c612e0dabe4e93002766b3751b7.zip
Get SSLSocketFactory from GmsCore
b/15721931 This follows an example pattern from GoogleHttpClient. It tries to get the SSLCertificateSocketFactory from GmsCore using reflection. If that fails, (because GmsCore is not installed on the device) then it will fall back to the platform implementation. MailApplication sets a static object in SSLUtils that allows it to get an externally created SSLCertifcateSocketFactory. If this method is set, then it will use it, otherwise it will fall back to the platform factory. This way there is no reference to GmsCore in the AOSP email. Change-Id: I0890fe4c3d79283fb98a4dc5a62a32efd320e52a
Diffstat (limited to 'provider_src')
-rw-r--r--provider_src/com/android/email/mail/transport/MailTransport.java5
1 files changed, 3 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 213fbfc99..74d0ab59e 100644
--- a/provider_src/com/android/email/mail/transport/MailTransport.java
+++ b/provider_src/com/android/email/mail/transport/MailTransport.java
@@ -112,7 +112,7 @@ public class MailTransport {
SocketAddress socketAddress = new InetSocketAddress(getHost(), getPort());
if (canTrySslSecurity()) {
mSocket = SSLUtils.getSSLSocketFactory(
- mContext, mHostAuth, canTrustAllCertificates()).createSocket();
+ mContext, mHostAuth, null, canTrustAllCertificates()).createSocket();
} else {
mSocket = new Socket();
}
@@ -152,7 +152,8 @@ public class MailTransport {
*/
public void reopenTls() throws MessagingException {
try {
- mSocket = SSLUtils.getSSLSocketFactory(mContext, mHostAuth, canTrustAllCertificates())
+ mSocket = SSLUtils.getSSLSocketFactory(mContext, mHostAuth, null,
+ canTrustAllCertificates())
.createSocket(mSocket, getHost(), getPort(), true);
mSocket.setSoTimeout(SOCKET_READ_TIMEOUT);
mIn = new BufferedInputStream(mSocket.getInputStream(), 1024);