| Index: components/signin/core/browser/android/java/src/org/chromium/components/signin/ChildAccountInfoFetcher.java
|
| diff --git a/components/signin/core/browser/android/java/src/org/chromium/components/signin/ChildAccountInfoFetcher.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/ChildAccountInfoFetcher.java
|
| index d2fe99182669b9c30729fd0c79d0714ee6196af2..db155bcdebd46b07011c18360422dd2aed40bf03 100644
|
| --- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/ChildAccountInfoFetcher.java
|
| +++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/ChildAccountInfoFetcher.java
|
| @@ -5,19 +5,13 @@
|
| package org.chromium.components.signin;
|
|
|
| import android.accounts.Account;
|
| -import android.accounts.AccountManagerCallback;
|
| -import android.accounts.AccountManagerFuture;
|
| -import android.accounts.AuthenticatorException;
|
| -import android.accounts.OperationCanceledException;
|
| import android.content.Context;
|
|
|
| import org.chromium.base.ApplicationStatus;
|
| -import org.chromium.base.Log;
|
| import org.chromium.base.annotations.CalledByNative;
|
| +import org.chromium.sync.signin.AccountManagerDelegate.Callback;
|
| import org.chromium.sync.signin.AccountManagerHelper;
|
|
|
| -import java.io.IOException;
|
| -
|
| /**
|
| * ChildAccountInfoFetcher for the Android platform.
|
| * Checks whether an account is a child account from the AccountManager.
|
| @@ -35,30 +29,11 @@ public final class ChildAccountInfoFetcher {
|
| Context app = ApplicationStatus.getApplicationContext();
|
| assert app != null;
|
| AccountManagerHelper helper = AccountManagerHelper.get(app);
|
| - Account[] accounts = helper.getGoogleAccounts();
|
| - Account candidate_account = null;
|
| - for (Account account : accounts) {
|
| - if (account.name.equals(accountName)) {
|
| - candidate_account = account;
|
| - break;
|
| - }
|
| - }
|
| - if (candidate_account == null) {
|
| - nativeSetIsChildAccount(nativeAccountFetcherService, accountId, false);
|
| - return;
|
| - }
|
| - helper.checkChildAccount(candidate_account, new AccountManagerCallback<Boolean>() {
|
| + Account account = helper.createAccountFromName(accountName);
|
| + helper.checkChildAccount(account, new Callback<Boolean>() {
|
| @Override
|
| - public void run(AccountManagerFuture<Boolean> future) {
|
| - assert future.isDone();
|
| - try {
|
| - boolean isChildAccount = future.getResult();
|
| - nativeSetIsChildAccount(nativeAccountFetcherService, accountId, isChildAccount);
|
| - } catch (AuthenticatorException | IOException e) {
|
| - Log.e(TAG, "Error while fetching child account info: ", e);
|
| - } catch (OperationCanceledException e) {
|
| - Log.e(TAG, "Child account info fetch was cancelled. This should not happen.");
|
| - }
|
| + public void gotResult(Boolean isChildAccount) {
|
| + nativeSetIsChildAccount(nativeAccountFetcherService, accountId, isChildAccount);
|
| }
|
| });
|
| }
|
|
|