Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java

Issue 2740873004: Allow AccountManagerHelper.updateCredentials callback param to be null (Closed)
Patch Set: Addressed comments 2 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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() {

Powered by Google App Engine
This is Rietveld 408576698