Fix providers.xml alternate diversion
b/17048013 Change-Id: If2bc857266a6ba1445bf1fabbaed179c1b13a14f
This commit is contained in:
parent
6d165bca6b
commit
486e971066
@ -562,6 +562,13 @@ public class HostAuth extends EmailContent implements Parcelable {
|
||||
setConnection(protocol, host, port, flags, clientCertAlias);
|
||||
}
|
||||
|
||||
public static String getProtocolFromString(String uriString) {
|
||||
final Uri uri = Uri.parse(uriString);
|
||||
final String scheme = uri.getScheme();
|
||||
final String[] schemeParts = scheme.split("\\+");
|
||||
return schemeParts[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[protocol " + mProtocol + "]";
|
||||
|
@ -857,18 +857,21 @@ public class AccountSetupFinal extends AccountSetupActivity
|
||||
try {
|
||||
mProvider.expandTemplates(email);
|
||||
|
||||
final Account account = mSetupData.getAccount();
|
||||
final HostAuth recvAuth = account.getOrCreateHostAuthRecv(this);
|
||||
recvAuth.setHostAuthFromString(mProvider.incomingUri);
|
||||
|
||||
final EmailServiceUtils.EmailServiceInfo info = mSetupData.getIncomingServiceInfo(this);
|
||||
final String primaryProtocol = HostAuth.getProtocolFromString(mProvider.incomingUri);
|
||||
EmailServiceUtils.EmailServiceInfo info =
|
||||
EmailServiceUtils.getServiceInfo(this, primaryProtocol);
|
||||
// If the protocol isn't one we can use, and we're not diverting to gmail, try the alt
|
||||
if (!info.isGmailStub && !EmailServiceUtils.isServiceAvailable(this, info.protocol)) {
|
||||
LogUtils.d(LogUtils.TAG, "Protocol %s not available, using alternate",
|
||||
info.protocol);
|
||||
mProvider.expandAlternateTemplates(email);
|
||||
recvAuth.setHostAuthFromString(mProvider.incomingUri);
|
||||
final String alternateProtocol = HostAuth.getProtocolFromString(
|
||||
mProvider.incomingUri);
|
||||
info = EmailServiceUtils.getServiceInfo(this, alternateProtocol);
|
||||
}
|
||||
final Account account = mSetupData.getAccount();
|
||||
final HostAuth recvAuth = account.getOrCreateHostAuthRecv(this);
|
||||
recvAuth.setHostAuthFromString(mProvider.incomingUri);
|
||||
|
||||
recvAuth.setUserName(mProvider.incomingUsername);
|
||||
recvAuth.mPort =
|
||||
|
Loading…
Reference in New Issue
Block a user