diff options
author | Costin Manolache <costin@google.com> | 2009-09-02 18:03:05 -0700 |
---|---|---|
committer | Costin Manolache <costin@google.com> | 2009-09-08 14:05:43 -0700 |
commit | b752098e8d12d6e7925d97458078dbb896ca8a05 (patch) | |
tree | 533da6e8662831ef9c7f63fede341db59952b573 /core/java/android/content/SyncStorageEngine.java | |
parent | 33b69050b2074c1768c45895418f0454e52e279a (diff) | |
download | frameworks_base-b752098e8d12d6e7925d97458078dbb896ca8a05.zip frameworks_base-b752098e8d12d6e7925d97458078dbb896ca8a05.tar.gz frameworks_base-b752098e8d12d6e7925d97458078dbb896ca8a05.tar.bz2 |
Sync status was ignoring account - the new UI has specific sync status for each account, so we need to use it.
Diffstat (limited to 'core/java/android/content/SyncStorageEngine.java')
-rw-r--r-- | core/java/android/content/SyncStorageEngine.java | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/core/java/android/content/SyncStorageEngine.java b/core/java/android/content/SyncStorageEngine.java index df3d241..f251984 100644 --- a/core/java/android/content/SyncStorageEngine.java +++ b/core/java/android/content/SyncStorageEngine.java @@ -866,27 +866,28 @@ public class SyncStorageEngine extends Handler { } /** - * Returns the status that matches the authority. If there are multiples accounts for - * the authority, the one with the latest "lastSuccessTime" status is returned. + * Returns the status that matches the authority and account. + * + * @param account the account we want to check * @param authority the authority whose row should be selected * @return the SyncStatusInfo for the authority, or null if none exists */ - public SyncStatusInfo getStatusByAuthority(String authority) { + public SyncStatusInfo getStatusByAccountAndAuthority(Account account, String authority) { + if (account == null || authority == null) { + throw new IllegalArgumentException(); + } synchronized (mAuthorities) { - SyncStatusInfo best = null; final int N = mSyncStatus.size(); for (int i=0; i<N; i++) { SyncStatusInfo cur = mSyncStatus.valueAt(i); AuthorityInfo ainfo = mAuthorities.get(cur.authorityId); - if (ainfo != null && ainfo.authority.equals(authority)) { - if (best == null) { - best = cur; - } else if (best.lastSuccessTime > cur.lastSuccessTime) { - best = cur; - } + + if (ainfo != null && ainfo.authority.equals(authority) && + account.equals(ainfo.account)) { + return cur; } } - return best; + return null; } } |