summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authormaxbogue <maxbogue@chromium.org>2014-10-09 09:59:07 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-09 16:59:26 +0000
commit84cc8aefc84b7c7f79cb7ae0098a54c60bca8a25 (patch)
treeba5d898ca05fa2fc19f73e8357a9c7375341a7f6 /sync
parentd13529c9358c278bae892200ffb62bf55cc57e22 (diff)
downloadchromium_src-84cc8aefc84b7c7f79cb7ae0098a54c60bca8a25.zip
chromium_src-84cc8aefc84b7c7f79cb7ae0098a54c60bca8a25.tar.gz
chromium_src-84cc8aefc84b7c7f79cb7ae0098a54c60bca8a25.tar.bz2
Make all auth requests notification-driven.
Previously, when having authentication issues on Android (for example, if the user changed their password), Chrome would pop-up a dialog asking the user to sign in again. This was bad, because part of the auth flow has a link to a website where you can do account recovery, but that would just kick you back into the auth pop-up in an infinite loop. Also it was intrusive to the user and against Android best practices. Additionally, on dev builds of Chromium, it could result in an annoying stream of permission request pop-ups dominating the screen. Now, in both cases, the auth request is handled by generating a notification that the user must activate before losing control of the screen. BUG=302608 Review URL: https://codereview.chromium.org/627543002 Cr-Commit-Position: refs/heads/master@{#298911}
Diffstat (limited to 'sync')
-rw-r--r--sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java18
1 files changed, 5 insertions, 13 deletions
diff --git a/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java b/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java
index be76287..03df234 100644
--- a/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java
+++ b/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java
@@ -13,7 +13,6 @@ import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.app.Activity;
import android.content.Context;
-import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
@@ -51,6 +50,9 @@ public class AccountManagerHelper {
private Context mApplicationContext;
+ /**
+ * A simple callback for getAuthToken.
+ */
public interface GetAuthTokenCallback {
/**
* Invoked on the UI thread once a token has been provided by the AccountManager.
@@ -162,7 +164,7 @@ public class AccountManagerHelper {
@Deprecated
public String getAuthTokenFromBackground(Account account, String authTokenType) {
AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(account,
- authTokenType, false, null, null);
+ authTokenType, true, null, null);
AtomicBoolean errorEncountered = new AtomicBoolean(false);
return getAuthTokenInner(future, errorEncountered);
}
@@ -219,16 +221,6 @@ public class AccountManagerHelper {
try {
Bundle result = future.getResult();
if (result != null) {
- if (result.containsKey(AccountManager.KEY_INTENT)) {
- Log.d(TAG, "Starting intent to get auth credentials");
- // Need to start intent to get credentials
- Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
- int flags = intent.getFlags();
- flags |= Intent.FLAG_ACTIVITY_NEW_TASK;
- intent.setFlags(flags);
- mApplicationContext.startActivity(intent);
- return null;
- }
return result.getString(AccountManager.KEY_AUTHTOKEN);
} else {
Log.w(TAG, "Auth token - getAuthToken returned null");
@@ -254,7 +246,7 @@ public class AccountManagerHelper {
account, authTokenType, null, activity, null, null);
} else {
future = mAccountManager.getAuthToken(
- account, authTokenType, false, null, null);
+ account, authTokenType, true, null, null);
}
final AccountManagerFuture<Bundle> finalFuture = future;
errorEncountered.set(false);