diff options
author | Martin Hibdon <mhibdon@google.com> | 2014-03-20 19:57:05 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-03-20 19:57:05 +0000 |
commit | 3021a60bc72b8b2fd3c281adef6d81f324d2b3b9 (patch) | |
tree | db930a9f40b432df7979ce7c8e0aec46e6b8e062 | |
parent | 71f503d98e9e4c8308cd1099a684d1659c0c8037 (diff) | |
parent | 6a51abdf6e15e6cc28948ef163d3673adc6f6e7f (diff) | |
download | android_packages_apps_Email-3021a60bc72b8b2fd3c281adef6d81f324d2b3b9.tar.gz android_packages_apps_Email-3021a60bc72b8b2fd3c281adef6d81f324d2b3b9.tar.bz2 android_packages_apps_Email-3021a60bc72b8b2fd3c281adef6d81f324d2b3b9.zip |
Merge "Only make Calendar and Contacts syncable on Exchange" into ub-mail-master
-rw-r--r-- | src/com/android/email/service/AuthenticatorService.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/com/android/email/service/AuthenticatorService.java b/src/com/android/email/service/AuthenticatorService.java index 36f3222a0..7add271e9 100644 --- a/src/com/android/email/service/AuthenticatorService.java +++ b/src/com/android/email/service/AuthenticatorService.java @@ -17,6 +17,7 @@ package com.android.email.service; import com.android.email.activity.setup.AccountSetupFinal; +import com.android.email.service.EmailServiceUtils.EmailServiceInfo; import com.android.emailcommon.provider.EmailContent; import android.accounts.AbstractAccountAuthenticator; @@ -56,7 +57,12 @@ public class AuthenticatorService extends Service { String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { - // There are two cases here: + final String protocol = EmailServiceUtils.getProtocolFromAccountType( + AuthenticatorService.this, accountType); + final EmailServiceInfo info = EmailServiceUtils.getServiceInfo( + AuthenticatorService.this, protocol); + + // There are two cases here: // 1) We are called with a username/password; this comes from the traditional email // app UI; we simply create the account and return the proper bundle if (options != null && options.containsKey(OPTIONS_PASSWORD) @@ -67,16 +73,16 @@ public class AuthenticatorService extends Service { account, options.getString(OPTIONS_PASSWORD), null); // Set up contacts syncing, if appropriate - if (options.containsKey(OPTIONS_CONTACTS_SYNC_ENABLED)) { - boolean syncContacts = options.getBoolean(OPTIONS_CONTACTS_SYNC_ENABLED); + if (info.syncContacts) { + boolean syncContacts = options.getBoolean(OPTIONS_CONTACTS_SYNC_ENABLED, false); ContentResolver.setIsSyncable(account, ContactsContract.AUTHORITY, 1); ContentResolver.setSyncAutomatically(account, ContactsContract.AUTHORITY, syncContacts); } // Set up calendar syncing, if appropriate - if (options.containsKey(OPTIONS_CALENDAR_SYNC_ENABLED)) { - boolean syncCalendar = options.getBoolean(OPTIONS_CALENDAR_SYNC_ENABLED); + if (info.syncCalendar) { + boolean syncCalendar = options.getBoolean(OPTIONS_CALENDAR_SYNC_ENABLED, false); ContentResolver.setIsSyncable(account, CalendarContract.AUTHORITY, 1); ContentResolver.setSyncAutomatically(account, CalendarContract.AUTHORITY, syncCalendar); |