Fix some missed account setup flags.
There were two places where account flags were being set on setup: one was in manual setup when the user selected the account type (pop/imap/eas), and another was when it was automatically determined from XML. The two paths were inconsistent and one was setting bits like SUPPORTS_SEARCH but the other wasn't. This fixes being able to search in IMAP Bug: 5011932 Change-Id: I50eada7485aaef4e2a85d25fa7eb9ac7ab03093a
This commit is contained in:
parent
cac58e590c
commit
025d29fd4b
|
@ -337,7 +337,7 @@ public final class Account extends EmailContent implements AccountColumns, Parce
|
|||
/**
|
||||
* Set the sync lookback window. Be sure to call save() to commit to database.
|
||||
* TODO define sentinel values for "all", "1 month", etc. See Account.java
|
||||
* @param value One of the {@code Account.SYNC_WINDOW_*} constants
|
||||
* @param value One of the {@link com.android.emailcommon.service.SyncWindow} constants
|
||||
*/
|
||||
public void setSyncLookback(int value) {
|
||||
mSyncLookback = value;
|
||||
|
|
|
@ -88,6 +88,7 @@ public class AccountSetupAccountType extends AccountSetupActivity implements OnC
|
|||
hostAuth.mLogin = hostAuth.mLogin + "@" + hostAuth.mAddress;
|
||||
hostAuth.mAddress = AccountSettingsUtils.inferServerName(hostAuth.mAddress,
|
||||
HostAuth.SCHEME_POP3, null);
|
||||
AccountSetupBasics.setFlagsForProtocol(account, HostAuth.SCHEME_POP3);
|
||||
SetupData.setCheckSettingsMode(SetupData.CHECK_INCOMING | SetupData.CHECK_OUTGOING);
|
||||
AccountSetupIncoming.actionIncomingSettings(this, SetupData.getFlowMode(), account);
|
||||
finish();
|
||||
|
@ -104,10 +105,7 @@ public class AccountSetupAccountType extends AccountSetupActivity implements OnC
|
|||
hostAuth.mLogin = hostAuth.mLogin + "@" + hostAuth.mAddress;
|
||||
hostAuth.mAddress = AccountSettingsUtils.inferServerName(hostAuth.mAddress,
|
||||
HostAuth.SCHEME_IMAP, null);
|
||||
// Delete policy must be set explicitly, because IMAP does not provide a UI selection
|
||||
// for it. This logic needs to be followed in the auto setup flow as well.
|
||||
account.setDeletePolicy(Account.DELETE_POLICY_ON_DELETE);
|
||||
account.mFlags |= Account.FLAGS_SUPPORTS_SEARCH;
|
||||
AccountSetupBasics.setFlagsForProtocol(account, HostAuth.SCHEME_IMAP);
|
||||
SetupData.setCheckSettingsMode(SetupData.CHECK_INCOMING | SetupData.CHECK_OUTGOING);
|
||||
AccountSetupIncoming.actionIncomingSettings(this, SetupData.getFlowMode(), account);
|
||||
finish();
|
||||
|
@ -125,10 +123,7 @@ public class AccountSetupAccountType extends AccountSetupActivity implements OnC
|
|||
HostAuth sendAuth = account.getOrCreateHostAuthSend(this);
|
||||
sendAuth.setConnection(HostAuth.SCHEME_EAS, sendAuth.mAddress, sendAuth.mPort,
|
||||
sendAuth.mFlags | HostAuth.FLAG_SSL);
|
||||
// TODO: Confirm correct delete policy for exchange
|
||||
account.setDeletePolicy(Account.DELETE_POLICY_ON_DELETE);
|
||||
account.setSyncInterval(Account.CHECK_INTERVAL_PUSH);
|
||||
account.setSyncLookback(1);
|
||||
AccountSetupBasics.setFlagsForProtocol(account, HostAuth.SCHEME_EAS);
|
||||
SetupData.setCheckSettingsMode(SetupData.CHECK_AUTODISCOVER);
|
||||
AccountSetupExchange.actionIncomingSettings(this, SetupData.getFlowMode(), account);
|
||||
finish();
|
||||
|
|
|
@ -52,7 +52,9 @@ import com.android.emailcommon.Logging;
|
|||
import com.android.emailcommon.provider.Account;
|
||||
import com.android.emailcommon.provider.EmailContent;
|
||||
import com.android.emailcommon.provider.HostAuth;
|
||||
import com.android.emailcommon.service.SyncWindow;
|
||||
import com.android.emailcommon.utility.Utility;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.concurrent.Callable;
|
||||
|
@ -112,7 +114,7 @@ public class AccountSetupBasics extends AccountSetupActivity
|
|||
private EditText mEmailView;
|
||||
private EditText mPasswordView;
|
||||
private CheckBox mDefaultView;
|
||||
private EmailAddressValidator mEmailValidator = new EmailAddressValidator();
|
||||
private final EmailAddressValidator mEmailValidator = new EmailAddressValidator();
|
||||
private Provider mProvider;
|
||||
private Button mManualButton;
|
||||
private Button mNextButton;
|
||||
|
@ -397,7 +399,7 @@ public class AccountSetupBasics extends AccountSetupActivity
|
|||
/**
|
||||
* Callable that returns the username (based on other accounts) or null.
|
||||
*/
|
||||
private Callable<String> mOwnerLookupCallable = new Callable<String>() {
|
||||
private final Callable<String> mOwnerLookupCallable = new Callable<String>() {
|
||||
public String call() {
|
||||
Context context = AccountSetupBasics.this;
|
||||
String name = null;
|
||||
|
@ -601,15 +603,26 @@ public class AccountSetupBasics extends AccountSetupActivity
|
|||
SetupData.setDefault(isDefault); // TODO - why duplicated, if already set in account
|
||||
|
||||
String protocol = account.mHostAuthRecv.mProtocol;
|
||||
// Set sync and delete policies for specific inbound account types
|
||||
setFlagsForProtocol(account, protocol);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the account sync, delete, and other misc flags not captured in {@code HostAuth}
|
||||
* information for the specified account based on the protocol type.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
static void setFlagsForProtocol(Account account, String protocol) {
|
||||
if (HostAuth.SCHEME_IMAP.equals(protocol)) {
|
||||
// Delete policy must be set explicitly, because IMAP does not provide a UI selection
|
||||
// for it. This logic needs to be followed in the auto setup flow as well.
|
||||
// for it.
|
||||
account.setDeletePolicy(Account.DELETE_POLICY_ON_DELETE);
|
||||
account.mFlags |= Account.FLAGS_SUPPORTS_SEARCH;
|
||||
}
|
||||
|
||||
if (HostAuth.SCHEME_EAS.equals(protocol)) {
|
||||
account.setDeletePolicy(Account.DELETE_POLICY_ON_DELETE);
|
||||
account.setSyncInterval(Account.CHECK_INTERVAL_PUSH);
|
||||
account.setSyncLookback(SyncWindow.SYNC_WINDOW_AUTO);
|
||||
} else {
|
||||
account.setSyncInterval(DEFAULT_ACCOUNT_CHECK_INTERVAL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue