Replace literal "eas", "pop3", "imap" with constants
Change-Id: If3f4712acd39663e548f271ffaa2fb7b4f5656d4
This commit is contained in:
parent
13284c1376
commit
c9864af20f
@ -461,12 +461,12 @@ public final class Account extends EmailContent implements AccountColumns, Parce
|
||||
* Use caution when you use this on the main thread.
|
||||
*/
|
||||
public boolean isEasAccount(Context context) {
|
||||
return "eas".equals(getProtocol(context));
|
||||
return HostAuth.SCHEME_EAS.equals(getProtocol(context));
|
||||
}
|
||||
|
||||
public boolean supportsMoveMessages(Context context) {
|
||||
String protocol = getProtocol(context);
|
||||
return "eas".equals(protocol) || "imap".equals(protocol);
|
||||
return HostAuth.SCHEME_EAS.equals(protocol) || HostAuth.SCHEME_IMAP.equals(protocol);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,6 +30,7 @@ import com.android.email.VendorPolicyLoader;
|
||||
import com.android.email.provider.AccountBackupRestore;
|
||||
import com.android.emailcommon.Logging;
|
||||
import com.android.emailcommon.provider.Account;
|
||||
import com.android.emailcommon.provider.HostAuth;
|
||||
import com.android.emailcommon.provider.EmailContent.AccountColumns;
|
||||
import com.android.emailcommon.provider.QuickResponse;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
@ -294,8 +295,8 @@ public class AccountSettingsUtils {
|
||||
if (firstDotIndex != -1) {
|
||||
// look at first word and decide what to do
|
||||
String firstWord = server.substring(0, firstDotIndex).toLowerCase();
|
||||
boolean isImapOrPop = "imap".equals(firstWord)
|
||||
|| "pop3".equals(firstWord) || "pop".equals(firstWord);
|
||||
boolean isImapOrPop = HostAuth.SCHEME_IMAP.equals(firstWord)
|
||||
|| "pop".equals(firstWord) || HostAuth.SCHEME_POP3.equals(firstWord);
|
||||
boolean isMail = "mail".equals(firstWord);
|
||||
// Now decide what to do
|
||||
if (incoming != null) {
|
||||
|
@ -44,6 +44,7 @@ import com.android.email.service.MailService;
|
||||
import com.android.email2.ui.MailActivityEmail;
|
||||
import com.android.emailcommon.Logging;
|
||||
import com.android.emailcommon.provider.Account;
|
||||
import com.android.emailcommon.provider.HostAuth;
|
||||
import com.android.emailcommon.provider.Policy;
|
||||
import com.android.emailcommon.service.SyncWindow;
|
||||
import com.android.emailcommon.utility.Utility;
|
||||
@ -224,7 +225,7 @@ public class AccountSetupOptions extends AccountSetupActivity implements OnClick
|
||||
boolean calendar = false;
|
||||
boolean contacts = false;
|
||||
boolean email = mSyncEmailView.isChecked();
|
||||
if (account.mHostAuthRecv.mProtocol.equals("eas")) {
|
||||
if (account.mHostAuthRecv.mProtocol.equals(HostAuth.SCHEME_EAS)) {
|
||||
if (SetupData.getPolicy() != null) {
|
||||
account.mFlags |= Account.FLAGS_SECURITY_HOLD;
|
||||
account.mPolicy = SetupData.getPolicy();
|
||||
|
@ -55,7 +55,7 @@ public class AccountSetupType extends AccountSetupActivity implements OnClickLis
|
||||
|
||||
// If we're in account setup flow mode, for EAS, skip this screen and "click" EAS
|
||||
if (flowMode == SetupData.FLOW_MODE_ACCOUNT_MANAGER_EAS) {
|
||||
onSelect("eas");
|
||||
onSelect(HostAuth.SCHEME_EAS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@ import com.android.email.activity.UiUtilities;
|
||||
import com.android.email.service.EmailServiceUtils;
|
||||
import com.android.email2.ui.MailActivityEmail;
|
||||
import com.android.emailcommon.Logging;
|
||||
import com.android.emailcommon.provider.HostAuth;
|
||||
|
||||
public class DebugFragment extends Fragment implements OnCheckedChangeListener,
|
||||
View.OnClickListener {
|
||||
@ -72,7 +73,8 @@ public class DebugFragment extends Fragment implements OnCheckedChangeListener,
|
||||
// Note: To prevent recursion while presetting checkboxes, assign all listeners last
|
||||
mEnableDebugLoggingView.setOnCheckedChangeListener(this);
|
||||
|
||||
boolean exchangeAvailable = EmailServiceUtils.isServiceAvailable(context, "eas");
|
||||
boolean exchangeAvailable =
|
||||
EmailServiceUtils.isServiceAvailable(context, HostAuth.SCHEME_EAS);
|
||||
if (exchangeAvailable) {
|
||||
mEnableExchangeLoggingView.setChecked(MailActivityEmail.DEBUG_EXCHANGE_VERBOSE);
|
||||
mEnableExchangeFileLoggingView.setChecked(MailActivityEmail.DEBUG_EXCHANGE_FILE);
|
||||
|
@ -2529,7 +2529,7 @@ outer:
|
||||
Context context = getContext();
|
||||
Mailbox mailbox = Mailbox.restoreMailboxWithId(context, mailboxId);
|
||||
// Make sure we can't get NPE if mailbox has disappeared (the result will end up moot)
|
||||
String protocol = "eas";
|
||||
String protocol = HostAuth.SCHEME_EAS;
|
||||
if (mailbox != null) {
|
||||
protocol = Account.getProtocol(context, mailbox.mAccountKey);
|
||||
// "load more" is valid for IMAP/POP3
|
||||
|
@ -32,6 +32,7 @@ import com.android.email2.ui.MailActivityEmail;
|
||||
import com.android.emailcommon.Configuration;
|
||||
import com.android.emailcommon.Device;
|
||||
import com.android.emailcommon.provider.Account;
|
||||
import com.android.emailcommon.provider.HostAuth;
|
||||
import com.android.emailcommon.service.IAccountService;
|
||||
import com.android.emailcommon.utility.EmailAsyncTask;
|
||||
|
||||
@ -104,7 +105,7 @@ public class AccountService extends Service {
|
||||
@Override
|
||||
public void run() {
|
||||
// Make sure the service is properly running (re: lifecycle)
|
||||
EmailServiceUtils.startService(mContext, "eas");
|
||||
EmailServiceUtils.startService(mContext, HostAuth.SCHEME_EAS);
|
||||
// Send current logging flags
|
||||
MailActivityEmail.updateLoggingFlags(mContext);
|
||||
}});
|
||||
|
@ -131,7 +131,7 @@ public class EmailBroadcastProcessorService extends IntentService {
|
||||
performOneTimeInitialization();
|
||||
|
||||
// Starts the service for Exchange, if supported.
|
||||
EmailServiceUtils.startService(this, "eas");
|
||||
EmailServiceUtils.startService(this, HostAuth.SCHEME_EAS);
|
||||
}
|
||||
|
||||
private void performOneTimeInitialization() {
|
||||
@ -207,6 +207,6 @@ public class EmailBroadcastProcessorService extends IntentService {
|
||||
|
||||
// If the exchange service wasn't already running, starting it will cause exchange account
|
||||
// reconciliation to be performed. The service stops itself it there are no EAS accounts.
|
||||
EmailServiceUtils.startService(this, "eas");
|
||||
EmailServiceUtils.startService(this, HostAuth.SCHEME_EAS);
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,9 @@ public class MailService extends Service {
|
||||
while (c.moveToNext()) {
|
||||
long accountId = c.getLong(Account.CONTENT_ID_COLUMN);
|
||||
String protocol = Account.getProtocol(context, accountId);
|
||||
if ((protocol != null) && ("pop3".equals(protocol) || "imap".equals(protocol))) {
|
||||
if ((protocol != null) &&
|
||||
(HostAuth.SCHEME_POP3.equals(protocol) ||
|
||||
HostAuth.SCHEME_IMAP.equals(protocol))) {
|
||||
Account account = Account.restoreAccountWithId(context, accountId);
|
||||
if (account != null) {
|
||||
providerAccounts.add(account);
|
||||
@ -148,7 +150,7 @@ public class MailService extends Service {
|
||||
options.putBoolean(EasAuthenticatorService.OPTIONS_CONTACTS_SYNC_ENABLED, contacts);
|
||||
options.putBoolean(EasAuthenticatorService.OPTIONS_CALENDAR_SYNC_ENABLED, calendar);
|
||||
options.putBoolean(EasAuthenticatorService.OPTIONS_EMAIL_SYNC_ENABLED, email);
|
||||
String accountType = hostAuthRecv.mProtocol.equals("eas") ?
|
||||
String accountType = hostAuthRecv.mProtocol.equals(HostAuth.SCHEME_EAS) ?
|
||||
AccountManagerTypes.TYPE_EXCHANGE :
|
||||
AccountManagerTypes.TYPE_POP_IMAP;
|
||||
AccountManager.get(context).addAccount(accountType, null, null, options, null, callback,
|
||||
|
@ -34,6 +34,7 @@ import com.android.email.service.MailService;
|
||||
import com.android.emailcommon.Logging;
|
||||
import com.android.emailcommon.TempDirectory;
|
||||
import com.android.emailcommon.provider.Account;
|
||||
import com.android.emailcommon.provider.HostAuth;
|
||||
import com.android.emailcommon.service.EmailServiceProxy;
|
||||
import com.android.emailcommon.utility.EmailAsyncTask;
|
||||
import com.android.emailcommon.utility.Utility;
|
||||
@ -193,7 +194,8 @@ public class MailActivityEmail extends com.android.mail.ui.MailActivity {
|
||||
int enableStrictMode =
|
||||
prefs.getEnableStrictMode() ? EmailServiceProxy.DEBUG_ENABLE_STRICT_MODE : 0;
|
||||
int debugBits = debugLogging | verboseLogging | fileLogging | enableStrictMode;
|
||||
EmailServiceProxy service = EmailServiceUtils.getService(context, null, "eas");
|
||||
EmailServiceProxy service =
|
||||
EmailServiceUtils.getService(context, null, HostAuth.SCHEME_EAS);
|
||||
if (service != null) {
|
||||
try {
|
||||
service.setLogging(debugBits);
|
||||
|
Loading…
Reference in New Issue
Block a user