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);
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[protocol " + mProtocol + "]";
|
return "[protocol " + mProtocol + "]";
|
||||||
|
@ -857,18 +857,21 @@ public class AccountSetupFinal extends AccountSetupActivity
|
|||||||
try {
|
try {
|
||||||
mProvider.expandTemplates(email);
|
mProvider.expandTemplates(email);
|
||||||
|
|
||||||
final Account account = mSetupData.getAccount();
|
final String primaryProtocol = HostAuth.getProtocolFromString(mProvider.incomingUri);
|
||||||
final HostAuth recvAuth = account.getOrCreateHostAuthRecv(this);
|
EmailServiceUtils.EmailServiceInfo info =
|
||||||
recvAuth.setHostAuthFromString(mProvider.incomingUri);
|
EmailServiceUtils.getServiceInfo(this, primaryProtocol);
|
||||||
|
|
||||||
final EmailServiceUtils.EmailServiceInfo info = mSetupData.getIncomingServiceInfo(this);
|
|
||||||
// If the protocol isn't one we can use, and we're not diverting to gmail, try the alt
|
// 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)) {
|
if (!info.isGmailStub && !EmailServiceUtils.isServiceAvailable(this, info.protocol)) {
|
||||||
LogUtils.d(LogUtils.TAG, "Protocol %s not available, using alternate",
|
LogUtils.d(LogUtils.TAG, "Protocol %s not available, using alternate",
|
||||||
info.protocol);
|
info.protocol);
|
||||||
mProvider.expandAlternateTemplates(email);
|
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.setUserName(mProvider.incomingUsername);
|
||||||
recvAuth.mPort =
|
recvAuth.mPort =
|
||||||
|
Loading…
Reference in New Issue
Block a user