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

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

Issue 2643373002: Signin: Reuse existing "update gms" dialogs when possible. (Closed)
Patch Set: 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 ba1c4ceb6b8b188de3546066e0dba9693bd63fc0..136ce4521996775578ce90bc063274d2416cbe9c 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
@@ -130,6 +130,11 @@ public abstract class UserRecoverableErrorHandler {
private Dialog mDialog;
/**
+ * 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
@@ -149,10 +154,18 @@ 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) {
- // This can happen if |errorCode| is ConnectionResult.SERVICE_INVALID.
mDialog.show();
}
sErrorHandlerActionHistogramSample.record(ERROR_HANDLER_ACTION_MODAL_DIALOG);
@@ -161,6 +174,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