本文整理汇总了Java中android.accounts.Account.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Account.equals方法的具体用法?Java Account.equals怎么用?Java Account.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.accounts.Account
的用法示例。
在下文中一共展示了Account.equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: accountExists
import android.accounts.Account; //导入方法依赖的package包/类
private static boolean accountExists(Context context, Account account) {
Account[] accounts = AccountManagerHelper.get(context).getGoogleAccounts();
for (Account a : accounts) {
if (a.equals(account)) {
return true;
}
}
return false;
}
示例2: onPerformSync
import android.accounts.Account; //导入方法依赖的package包/类
@Override
public void onPerformSync(Account account, Bundle extras, String authority,
ContentProviderClient provider, SyncResult syncResult) {
if (extras.getBoolean(ContentResolver.SYNC_EXTRAS_INITIALIZE)) {
Account signedInAccount = ChromeSigninController.get(getContext()).getSignedInUser();
if (account.equals(signedInAccount)) {
ContentResolver.setIsSyncable(account, authority, 1);
} else {
ContentResolver.setIsSyncable(account, authority, 0);
}
return;
}
PendingInvalidation invalidation = new PendingInvalidation(extras);
DelayedInvalidationsController controller = DelayedInvalidationsController.getInstance();
if (!controller.shouldNotifyInvalidation(extras)) {
controller.addPendingInvalidation(getContext(), account.name, invalidation);
return;
}
// Browser startup is asynchronous, so we will need to wait for startup to finish.
Semaphore semaphore = new Semaphore(0);
// Configure the BrowserParts with all the data it needs.
BrowserParts parts =
getBrowserParts(mApplication, account.name, invalidation, syncResult, semaphore);
startBrowserProcess(parts, syncResult, semaphore);
try {
// This code is only synchronously calling a single native method
// to trigger and asynchronous sync cycle, so 5 minutes is generous.
if (!semaphore.tryAcquire(5, TimeUnit.MINUTES)) {
Log.w(TAG, "Sync request timed out!");
syncResult.stats.numIoExceptions++;
}
} catch (InterruptedException e) {
Log.w(TAG, "Got InterruptedException when trying to request an invalidation.", e);
// Using numIoExceptions so Android will treat this as a soft error.
syncResult.stats.numIoExceptions++;
}
}