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.
|
* 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
|
* 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) {
|
public void setSyncLookback(int value) {
|
||||||
mSyncLookback = value;
|
mSyncLookback = value;
|
||||||
|
|
|
@ -88,6 +88,7 @@ public class AccountSetupAccountType extends AccountSetupActivity implements OnC
|
||||||
hostAuth.mLogin = hostAuth.mLogin + "@" + hostAuth.mAddress;
|
hostAuth.mLogin = hostAuth.mLogin + "@" + hostAuth.mAddress;
|
||||||
hostAuth.mAddress = AccountSettingsUtils.inferServerName(hostAuth.mAddress,
|
hostAuth.mAddress = AccountSettingsUtils.inferServerName(hostAuth.mAddress,
|
||||||
HostAuth.SCHEME_POP3, null);
|
HostAuth.SCHEME_POP3, null);
|
||||||
|
AccountSetupBasics.setFlagsForProtocol(account, HostAuth.SCHEME_POP3);
|
||||||
SetupData.setCheckSettingsMode(SetupData.CHECK_INCOMING | SetupData.CHECK_OUTGOING);
|
SetupData.setCheckSettingsMode(SetupData.CHECK_INCOMING | SetupData.CHECK_OUTGOING);
|
||||||
AccountSetupIncoming.actionIncomingSettings(this, SetupData.getFlowMode(), account);
|
AccountSetupIncoming.actionIncomingSettings(this, SetupData.getFlowMode(), account);
|
||||||
finish();
|
finish();
|
||||||
|
@ -104,10 +105,7 @@ public class AccountSetupAccountType extends AccountSetupActivity implements OnC
|
||||||
hostAuth.mLogin = hostAuth.mLogin + "@" + hostAuth.mAddress;
|
hostAuth.mLogin = hostAuth.mLogin + "@" + hostAuth.mAddress;
|
||||||
hostAuth.mAddress = AccountSettingsUtils.inferServerName(hostAuth.mAddress,
|
hostAuth.mAddress = AccountSettingsUtils.inferServerName(hostAuth.mAddress,
|
||||||
HostAuth.SCHEME_IMAP, null);
|
HostAuth.SCHEME_IMAP, null);
|
||||||
// Delete policy must be set explicitly, because IMAP does not provide a UI selection
|
AccountSetupBasics.setFlagsForProtocol(account, HostAuth.SCHEME_IMAP);
|
||||||
// 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;
|
|
||||||
SetupData.setCheckSettingsMode(SetupData.CHECK_INCOMING | SetupData.CHECK_OUTGOING);
|
SetupData.setCheckSettingsMode(SetupData.CHECK_INCOMING | SetupData.CHECK_OUTGOING);
|
||||||
AccountSetupIncoming.actionIncomingSettings(this, SetupData.getFlowMode(), account);
|
AccountSetupIncoming.actionIncomingSettings(this, SetupData.getFlowMode(), account);
|
||||||
finish();
|
finish();
|
||||||
|
@ -125,10 +123,7 @@ public class AccountSetupAccountType extends AccountSetupActivity implements OnC
|
||||||
HostAuth sendAuth = account.getOrCreateHostAuthSend(this);
|
HostAuth sendAuth = account.getOrCreateHostAuthSend(this);
|
||||||
sendAuth.setConnection(HostAuth.SCHEME_EAS, sendAuth.mAddress, sendAuth.mPort,
|
sendAuth.setConnection(HostAuth.SCHEME_EAS, sendAuth.mAddress, sendAuth.mPort,
|
||||||
sendAuth.mFlags | HostAuth.FLAG_SSL);
|
sendAuth.mFlags | HostAuth.FLAG_SSL);
|
||||||
// TODO: Confirm correct delete policy for exchange
|
AccountSetupBasics.setFlagsForProtocol(account, HostAuth.SCHEME_EAS);
|
||||||
account.setDeletePolicy(Account.DELETE_POLICY_ON_DELETE);
|
|
||||||
account.setSyncInterval(Account.CHECK_INTERVAL_PUSH);
|
|
||||||
account.setSyncLookback(1);
|
|
||||||
SetupData.setCheckSettingsMode(SetupData.CHECK_AUTODISCOVER);
|
SetupData.setCheckSettingsMode(SetupData.CHECK_AUTODISCOVER);
|
||||||
AccountSetupExchange.actionIncomingSettings(this, SetupData.getFlowMode(), account);
|
AccountSetupExchange.actionIncomingSettings(this, SetupData.getFlowMode(), account);
|
||||||
finish();
|
finish();
|
||||||
|
|
|
@ -52,7 +52,9 @@ import com.android.emailcommon.Logging;
|
||||||
import com.android.emailcommon.provider.Account;
|
import com.android.emailcommon.provider.Account;
|
||||||
import com.android.emailcommon.provider.EmailContent;
|
import com.android.emailcommon.provider.EmailContent;
|
||||||
import com.android.emailcommon.provider.HostAuth;
|
import com.android.emailcommon.provider.HostAuth;
|
||||||
|
import com.android.emailcommon.service.SyncWindow;
|
||||||
import com.android.emailcommon.utility.Utility;
|
import com.android.emailcommon.utility.Utility;
|
||||||
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
@ -112,7 +114,7 @@ public class AccountSetupBasics extends AccountSetupActivity
|
||||||
private EditText mEmailView;
|
private EditText mEmailView;
|
||||||
private EditText mPasswordView;
|
private EditText mPasswordView;
|
||||||
private CheckBox mDefaultView;
|
private CheckBox mDefaultView;
|
||||||
private EmailAddressValidator mEmailValidator = new EmailAddressValidator();
|
private final EmailAddressValidator mEmailValidator = new EmailAddressValidator();
|
||||||
private Provider mProvider;
|
private Provider mProvider;
|
||||||
private Button mManualButton;
|
private Button mManualButton;
|
||||||
private Button mNextButton;
|
private Button mNextButton;
|
||||||
|
@ -397,7 +399,7 @@ public class AccountSetupBasics extends AccountSetupActivity
|
||||||
/**
|
/**
|
||||||
* Callable that returns the username (based on other accounts) or null.
|
* 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() {
|
public String call() {
|
||||||
Context context = AccountSetupBasics.this;
|
Context context = AccountSetupBasics.this;
|
||||||
String name = null;
|
String name = null;
|
||||||
|
@ -601,15 +603,26 @@ public class AccountSetupBasics extends AccountSetupActivity
|
||||||
SetupData.setDefault(isDefault); // TODO - why duplicated, if already set in account
|
SetupData.setDefault(isDefault); // TODO - why duplicated, if already set in account
|
||||||
|
|
||||||
String protocol = account.mHostAuthRecv.mProtocol;
|
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)) {
|
if (HostAuth.SCHEME_IMAP.equals(protocol)) {
|
||||||
// Delete policy must be set explicitly, because IMAP does not provide a UI selection
|
// 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.setDeletePolicy(Account.DELETE_POLICY_ON_DELETE);
|
||||||
|
account.mFlags |= Account.FLAGS_SUPPORTS_SEARCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HostAuth.SCHEME_EAS.equals(protocol)) {
|
if (HostAuth.SCHEME_EAS.equals(protocol)) {
|
||||||
|
account.setDeletePolicy(Account.DELETE_POLICY_ON_DELETE);
|
||||||
account.setSyncInterval(Account.CHECK_INTERVAL_PUSH);
|
account.setSyncInterval(Account.CHECK_INTERVAL_PUSH);
|
||||||
|
account.setSyncLookback(SyncWindow.SYNC_WINDOW_AUTO);
|
||||||
} else {
|
} else {
|
||||||
account.setSyncInterval(DEFAULT_ACCOUNT_CHECK_INTERVAL);
|
account.setSyncInterval(DEFAULT_ACCOUNT_CHECK_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue