Discard result of Dupe Account check if paused

Fixes a potential race condition with a slow DB lookup and a
fast user (or monkey).

Bug: 3384992
Change-Id: I0602820e1d9f49eb01b09c9d78db3d0fc47ccfb1
This commit is contained in:
Andy Stadler 2011-01-25 23:18:45 -08:00
parent da75871620
commit a97faa25ac

View File

@ -117,6 +117,7 @@ public class AccountSetupBasics extends AccountSetupActivity
private Button mManualButton;
private Button mNextButton;
private boolean mNextButtonInhibit;
private boolean mPaused;
// Used when this Activity is called as part of account authentification flow,
// which requires to do extra work before and after the account creation.
@ -296,6 +297,18 @@ public class AccountSetupBasics extends AccountSetupActivity
Utility.runAsync(mOwnerLookupTask);
}
@Override
public void onPause() {
super.onPause();
mPaused = true;
}
@Override
public void onResume() {
super.onResume();
mPaused = false;
}
@Override
public void finish() {
if (mAccountAuthenticatorResponse != null) {
@ -477,6 +490,8 @@ public class AccountSetupBasics extends AccountSetupActivity
@Override
protected void onPostExecute(Account duplicateAccount) {
mNextButtonInhibit = false;
// Exit immediately if the user left before we finished
if (mPaused) return;
// Show duplicate account warning, or proceed
if (duplicateAccount != null) {
DuplicateAccountDialogFragment dialogFragment =