am 554ad344
: Merge "Respect email sync setting" into honeycomb
* commit '554ad3447570751a2b311624a7ddfbae86253f97': Respect email sync setting
This commit is contained in:
commit
b10f7c0ad8
@ -31,6 +31,7 @@ import com.android.email.provider.EmailContent.Mailbox;
|
||||
import com.android.email.provider.EmailContent.MailboxColumns;
|
||||
import com.android.email.provider.EmailContent.Message;
|
||||
import com.android.email.provider.EmailContent.SyncColumns;
|
||||
import com.android.email.provider.EmailProvider;
|
||||
import com.android.email.service.EmailServiceStatus;
|
||||
import com.android.email.service.IEmailService;
|
||||
import com.android.email.service.IEmailServiceCallback;
|
||||
@ -1524,6 +1525,7 @@ public class ExchangeService extends Service implements Runnable {
|
||||
if (cv.containsKey(MailboxColumns.SYNC_INTERVAL)) {
|
||||
mResolver.update(ContentUris.withAppendedId(Mailbox.CONTENT_URI, mailboxId),
|
||||
cv,null, null);
|
||||
stopPing(providerAccount.mId);
|
||||
kick("sync settings change");
|
||||
}
|
||||
}
|
||||
@ -1537,6 +1539,7 @@ public class ExchangeService extends Service implements Runnable {
|
||||
for (Account account : mAccountList) {
|
||||
updatePIMSyncSettings(account, Mailbox.TYPE_CONTACTS, ContactsContract.AUTHORITY);
|
||||
updatePIMSyncSettings(account, Mailbox.TYPE_CALENDAR, Calendar.AUTHORITY);
|
||||
updatePIMSyncSettings(account, Mailbox.TYPE_INBOX, EmailProvider.EMAIL_AUTHORITY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2066,6 +2069,15 @@ public class ExchangeService extends Service implements Runnable {
|
||||
continue;
|
||||
}
|
||||
|
||||
Account account =
|
||||
getAccountById(c.getInt(Mailbox.CONTENT_ACCOUNT_KEY_COLUMN));
|
||||
if (account == null) continue;
|
||||
|
||||
// TODO: Don't rebuild this account manager account each time through
|
||||
android.accounts.Account accountManagerAccount =
|
||||
new android.accounts.Account(account.mEmailAddress,
|
||||
Email.EXCHANGE_ACCOUNT_MANAGER_TYPE);
|
||||
|
||||
if (type == Mailbox.TYPE_CONTACTS || type == Mailbox.TYPE_CALENDAR) {
|
||||
// We don't sync these automatically if master auto sync is off
|
||||
if (!masterAutoSync) {
|
||||
@ -2073,9 +2085,6 @@ public class ExchangeService extends Service implements Runnable {
|
||||
}
|
||||
// Get the right authority for the mailbox
|
||||
String authority;
|
||||
Account account =
|
||||
getAccountById(c.getInt(Mailbox.CONTENT_ACCOUNT_KEY_COLUMN));
|
||||
if (account != null) {
|
||||
if (type == Mailbox.TYPE_CONTACTS) {
|
||||
authority = ContactsContract.AUTHORITY;
|
||||
} else {
|
||||
@ -2086,19 +2095,22 @@ public class ExchangeService extends Service implements Runnable {
|
||||
registerCalendarObserver(account);
|
||||
}
|
||||
}
|
||||
android.accounts.Account a =
|
||||
new android.accounts.Account(account.mEmailAddress,
|
||||
Email.EXCHANGE_ACCOUNT_MANAGER_TYPE);
|
||||
// See if "sync automatically" is set; if not, punt
|
||||
if (!ContentResolver.getSyncAutomatically(a, authority)) {
|
||||
if (!ContentResolver.getSyncAutomatically(accountManagerAccount,
|
||||
authority)) {
|
||||
continue;
|
||||
// See if the calendar is enabled; if not, punt
|
||||
} else if ((type == Mailbox.TYPE_CALENDAR) &&
|
||||
!isCalendarEnabled(account.mId)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else if (type == Mailbox.TYPE_TRASH) {
|
||||
// Never automatically sync trash
|
||||
continue;
|
||||
} else if (type < Mailbox.TYPE_NOT_EMAIL &&
|
||||
!ContentResolver.getSyncAutomatically(accountManagerAccount,
|
||||
EmailProvider.EMAIL_AUTHORITY)) {
|
||||
// Don't sync mail if user hasn't chosen to sync it automatically
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user