Index: components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java |
diff --git a/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java |
index f26590e8eea357f0d529d67ffc9a6589a7edbd60..ebbc3ddaaaa8e726fa7f027b8b75d7925ed40c3e 100644 |
--- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java |
+++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java |
@@ -171,28 +171,26 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate { |
return; |
} |
- mAccountManager.updateCredentials( |
- account, "android", null, activity, new AccountManagerCallback<Bundle>() { |
- @Override |
- public void run(AccountManagerFuture<Bundle> future) { |
- assert future.isDone(); |
- Bundle bundle = null; |
- try { |
- bundle = future.getResult(); |
- } catch (AuthenticatorException | IOException e) { |
- Log.e(TAG, "Error while update credentials: ", e); |
- } catch (OperationCanceledException e) { |
- Log.w(TAG, "Updating credentials was cancelled."); |
- } |
- if (bundle != null |
- && bundle.getString(AccountManager.KEY_ACCOUNT_NAME) != null |
- && bundle.getString(AccountManager.KEY_ACCOUNT_TYPE) != null) { |
- callback.onResult(true); |
- } else { |
- callback.onResult(false); |
- } |
- } |
- }, null /* handler */); |
+ AccountManagerCallback<Bundle> realCallback = new AccountManagerCallback<Bundle>() { |
+ @Override |
+ public void run(AccountManagerFuture<Bundle> future) { |
+ Bundle bundle = null; |
+ try { |
+ bundle = future.getResult(); |
+ } catch (AuthenticatorException | IOException e) { |
+ Log.e(TAG, "Error while update credentials: ", e); |
+ } catch (OperationCanceledException e) { |
+ Log.w(TAG, "Updating credentials was cancelled."); |
+ } |
+ boolean success = bundle != null |
+ && bundle.getString(AccountManager.KEY_ACCOUNT_NAME) != null |
+ && bundle.getString(AccountManager.KEY_ACCOUNT_TYPE) != null; |
+ if (callback != null) { |
+ callback.onResult(success); |
+ } |
+ } |
+ }; |
+ mAccountManager.updateCredentials(account, "android", null, activity, realCallback, null); |
} |
protected boolean hasGetAccountsPermission() { |