diff options
author | Marcus Hagerott <mhagerott@google.com> | 2016-12-12 12:00:21 -0800 |
---|---|---|
committer | Marcus Hagerott <mhagerott@google.com> | 2016-12-15 14:10:03 -0800 |
commit | 396aab726710c557188ace4e961064a65900524a (patch) | |
tree | 1165b7dbf941a68a8b79f0d7c4064d7de83bf3d1 /src/com/android/contacts/util | |
parent | c2093f312f71e730e1cc4daaa305782fda394215 (diff) | |
download | Contacts-396aab726710c557188ace4e961064a65900524a.tar.gz |
Replace AccountTypeManager usages in PeopleActivity
Changed usages of getAccounts to other methods that are safe to call
synchronously from UI thread (getAccounts may require DB query and
parsing).
Test manually verify that sync loading spinner disappears after
doing pull-to-refresh
Bug 33627801
Change-Id: I1ec162e0fd5214d36e96d1746ee26150caecab25
Diffstat (limited to 'src/com/android/contacts/util')
-rw-r--r-- | src/com/android/contacts/util/SyncUtil.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/com/android/contacts/util/SyncUtil.java b/src/com/android/contacts/util/SyncUtil.java index 0d6c4943a..ce10937f5 100644 --- a/src/com/android/contacts/util/SyncUtil.java +++ b/src/com/android/contacts/util/SyncUtil.java @@ -22,8 +22,11 @@ import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.provider.ContactsContract; +import com.android.contacts.model.account.AccountWithDataSet; import com.android.contacts.model.account.GoogleAccountType; +import java.util.List; + /** * Utilities related to sync. */ @@ -46,6 +49,19 @@ public final class SyncUtil { } /** + * Returns true {@link ContentResolver#isSyncPending(Account, String)} or + * {@link ContentResolver#isSyncActive(Account, String)} is true for any account in accounts + */ + public static final boolean isAnySyncing(List<AccountWithDataSet> accounts) { + for (AccountWithDataSet accountWithDataSet : accounts) { + if (isSyncStatusPendingOrActive(accountWithDataSet.getAccountOrNull())) { + return true; + } + } + return false; + } + + /** * Returns true if the given Google account is not syncable. */ public static final boolean isUnsyncableGoogleAccount(Account account) { |