am 492228bd
: Merge change 24815 into eclair
Merge commit '492228bdc4b90c632d7cf4d87a81fa42d3c3456f' into eclair-plus-aosp * commit '492228bdc4b90c632d7cf4d87a81fa42d3c3456f': Don't sync if the "Sync Contacts" checkbox isn't set
This commit is contained in:
commit
5024030e89
@ -1020,9 +1020,9 @@ public class EasSyncService extends AbstractSyncService {
|
|||||||
mAccount = Account.restoreAccountWithId(mContext, mAccount.mId);
|
mAccount = Account.restoreAccountWithId(mContext, mAccount.mId);
|
||||||
mProtocolVersion = mAccount.mProtocolVersion;
|
mProtocolVersion = mAccount.mProtocolVersion;
|
||||||
mProtocolVersionDouble = Double.parseDouble(mProtocolVersion);
|
mProtocolVersionDouble = Double.parseDouble(mProtocolVersion);
|
||||||
if (mMailbox.mType == Mailbox.TYPE_CONTACTS)
|
if (mMailbox.mType == Mailbox.TYPE_CONTACTS) {
|
||||||
target = new ContactsSyncAdapter(mMailbox, this);
|
target = new ContactsSyncAdapter(mMailbox, this);
|
||||||
else {
|
} else {
|
||||||
target = new EmailSyncAdapter(mMailbox, this);
|
target = new EmailSyncAdapter(mMailbox, this);
|
||||||
}
|
}
|
||||||
// We loop here because someone might have put a request in while we were syncing
|
// We loop here because someone might have put a request in while we were syncing
|
||||||
|
@ -347,6 +347,15 @@ public class SyncManager extends Service implements Runnable {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Account getById(long id) {
|
||||||
|
for (Account account: this) {
|
||||||
|
if (account.mId == id) {
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AccountObserver extends ContentObserver {
|
class AccountObserver extends ContentObserver {
|
||||||
@ -564,6 +573,10 @@ public class SyncManager extends Service implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Account getAccountById(long accountId) {
|
||||||
|
return mAccountObserver.mAccounts.getById(accountId);
|
||||||
|
}
|
||||||
|
|
||||||
public class SyncStatus {
|
public class SyncStatus {
|
||||||
static public final int NOT_RUNNING = 0;
|
static public final int NOT_RUNNING = 0;
|
||||||
static public final int DIED = 1;
|
static public final int DIED = 1;
|
||||||
@ -1339,10 +1352,25 @@ public class SyncManager extends Service implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
long freq = c.getInt(Mailbox.CONTENT_SYNC_INTERVAL_COLUMN);
|
long freq = c.getInt(Mailbox.CONTENT_SYNC_INTERVAL_COLUMN);
|
||||||
|
int type = c.getInt(Mailbox.CONTENT_TYPE_COLUMN);
|
||||||
|
if (type == Mailbox.TYPE_CONTACTS) {
|
||||||
|
// See if "sync automatically" is set
|
||||||
|
Account account =
|
||||||
|
getAccountById(c.getInt(Mailbox.CONTENT_ACCOUNT_KEY_COLUMN));
|
||||||
|
if (account != null) {
|
||||||
|
android.accounts.Account a =
|
||||||
|
new android.accounts.Account(account.mEmailAddress,
|
||||||
|
Eas.ACCOUNT_MANAGER_TYPE);
|
||||||
|
if (!ContentResolver.getSyncAutomatically(a,
|
||||||
|
ContactsContract.AUTHORITY)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (freq == Mailbox.CHECK_INTERVAL_PUSH) {
|
if (freq == Mailbox.CHECK_INTERVAL_PUSH) {
|
||||||
Mailbox m = EmailContent.getContent(c, Mailbox.class);
|
Mailbox m = EmailContent.getContent(c, Mailbox.class);
|
||||||
startService(m, SYNC_PUSH, null);
|
startService(m, SYNC_PUSH, null);
|
||||||
} else if (c.getInt(Mailbox.CONTENT_TYPE_COLUMN) == Mailbox.TYPE_OUTBOX) {
|
} else if (type == Mailbox.TYPE_OUTBOX) {
|
||||||
int cnt = EmailContent.count(this, Message.CONTENT_URI,
|
int cnt = EmailContent.count(this, Message.CONTENT_URI,
|
||||||
EasOutboxService.MAILBOX_KEY_AND_NOT_SEND_FAILED,
|
EasOutboxService.MAILBOX_KEY_AND_NOT_SEND_FAILED,
|
||||||
new String[] {Long.toString(mid)});
|
new String[] {Long.toString(mid)});
|
||||||
|
Loading…
Reference in New Issue
Block a user