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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java

Issue 2626083004: Signin: Reuse existing "update gms" dialogs when possible. (Closed)
Patch Set: "Error code" -> "Last error code" Created 3 years, 11 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java
index 55e5a68376ce06d753fa4f97f6690e7474bb5498..19d3b1e82c63e4454b25e11069d48f8a7697d70e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java
@@ -138,6 +138,11 @@ public abstract class UserRecoverableErrorHandler {
private final boolean mCancelable;
/**
+ * Last error code from Google Play Services.
+ */
+ private int mErrorCode;
+
+ /**
* Create a new Modal Dialog handler for the specified activity and error code. The
* specified activity may be used to launch the dialog via
* {@link Activity#startActivityForResult(android.content.Intent, int)} and also to receive
@@ -159,8 +164,16 @@ public abstract class UserRecoverableErrorHandler {
*/
@Override
protected final void handle(final Context context, final int errorCode) {
- mDialog = GoogleApiAvailability.getInstance().getErrorDialog(
- mActivity, errorCode, NO_RESPONSE_REQUIRED);
+ // Assume old dialogs generated by the same error handler are obsolete when an error
+ // with a different error code is encountered.
+ if (mErrorCode != errorCode) {
+ cancelDialog();
+ }
+ if (mDialog == null) {
+ mDialog = GoogleApiAvailability.getInstance().getErrorDialog(
+ mActivity, errorCode, NO_RESPONSE_REQUIRED);
+ mErrorCode = errorCode;
+ }
// This can happen if |errorCode| is ConnectionResult.SERVICE_INVALID.
if (mDialog != null) {
mDialog.setCancelable(mCancelable);
@@ -175,6 +188,7 @@ public abstract class UserRecoverableErrorHandler {
public void cancelDialog() {
if (mDialog != null) {
mDialog.cancel();
+ mDialog = null;
}
}
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698