Allow account setting screen without outbound hostauth.

We have a way to handle lack of outbound host auth, and it's
a legitimate state for Exchange accounts (since it's unused
anyway).

Bug: 8631134
Change-Id: I99863f627c4f364e61f7a4b99dea3e2606a55275
This commit is contained in:
Yu Ping Hu 2013-06-27 10:56:43 -07:00
parent 229c070b0b
commit 9c45527779

View File

@ -257,8 +257,7 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
// Because "delete policy" UI is on edit incoming settings, we have
// to refresh that as well.
Account refreshedAccount = Account.restoreAccountWithId(mContext, mAccount.mId);
if (refreshedAccount == null || mAccount.mHostAuthRecv == null
|| mAccount.mHostAuthSend == null) {
if (refreshedAccount == null || mAccount.mHostAuthRecv == null) {
mSaveOnExit = false;
mCallback.abandonEdit();
return;
@ -447,7 +446,7 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
HostAuth.restoreHostAuthWithId(mContext, account.mHostAuthKeyRecv);
account.mHostAuthSend =
HostAuth.restoreHostAuthWithId(mContext, account.mHostAuthKeySend);
if (account.mHostAuthRecv == null || account.mHostAuthSend == null) {
if (account.mHostAuthRecv == null) {
account = null;
}
}
@ -798,7 +797,7 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
// Hide the outgoing account setup link if it's not activated
Preference prefOutgoing = findPreference(PREFERENCE_OUTGOING);
if (info.usesSmtp) {
if (info.usesSmtp && mAccount.mHostAuthSend != null) {
prefOutgoing.setOnPreferenceClickListener(
new Preference.OnPreferenceClickListener() {
@Override
@ -809,6 +808,11 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
}
});
} else {
if (info.usesSmtp) {
// We really ought to have an outgoing host auth but we don't.
// There's nothing we can do at this point, so just log the error.
LogUtils.e(Logging.LOG_TAG, "Account %d has a bad outbound hostauth", mAccount.mId);
}
PreferenceCategory serverCategory = (PreferenceCategory) findPreference(
PREFERENCE_CATEGORY_SERVER);
serverCategory.removePreference(prefOutgoing);