Prevent multiple calls to onDone() in AccountSetupOptions
* When "Done" is pressed in AccountSetupOptions and the Account is EAS, the finish() isn't called until an async method's callback is invoked (system account creation) * This allowed the user to execute onDone() multiple times, each one of which would attempt to create an account * The net effect was the referenced bug, which can manifest in a number of ugly ways * The fix is to prevent multiple calls to onDone() Bug: 2501574 Change-Id: I61057bbb8c1f85da07e83ed6c56474bfe4e23f6c
This commit is contained in:
parent
82e51e0631
commit
b7fe21676e
@ -58,6 +58,7 @@ public class AccountSetupOptions extends Activity implements OnClickListener {
|
|||||||
private EmailContent.Account mAccount;
|
private EmailContent.Account mAccount;
|
||||||
private boolean mEasFlowMode;
|
private boolean mEasFlowMode;
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
|
private boolean mDonePressed = false;
|
||||||
|
|
||||||
/** Default sync window for new EAS accounts */
|
/** Default sync window for new EAS accounts */
|
||||||
private static final int SYNC_WINDOW_EAS_DEFAULT = com.android.email.Account.SYNC_WINDOW_3_DAYS;
|
private static final int SYNC_WINDOW_EAS_DEFAULT = com.android.email.Account.SYNC_WINDOW_3_DAYS;
|
||||||
@ -228,7 +229,13 @@ public class AccountSetupOptions extends Activity implements OnClickListener {
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.next:
|
case R.id.next:
|
||||||
onDone();
|
// Don't allow this more than once (Exchange accounts call an async method
|
||||||
|
// before finish()'ing the Activity, which allows this code to potentially be
|
||||||
|
// executed multiple times
|
||||||
|
if (!mDonePressed) {
|
||||||
|
onDone();
|
||||||
|
mDonePressed = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user