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