Fix multiple instances for Google SignIn activity appearing in task stack

- Account page starts an activity with the flag FLAG_ACTIVITY_NEW_TASK
  to add an account and then causes multiple activity instances.
- Add the flag FLAG_ACTIVITY_CLEAR_TASK in conjunction with
  FLAG_ACTIVITY_NEW_TASK to clear existing task before the activity is
  started.

Fixes: 109923099
Test: robotest, manual
Change-Id: I8234ab33d8aa949e5ff78320962920cb0f8b2953
This commit is contained in:
Jason Chiu
2019-05-16 17:44:13 +08:00
parent d6ad2a3340
commit 3e4d002679

View File

@@ -100,8 +100,9 @@ public class AddAccountSettings extends Activity {
addAccountOptions.putBoolean(EXTRA_HAS_MULTIPLE_USERS,
Utils.hasMultipleUsers(AddAccountSettings.this));
addAccountOptions.putParcelable(EXTRA_USER, mUserHandle);
intent.putExtras(addAccountOptions);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtras(addAccountOptions)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivityForResultAsUser(intent, ADD_ACCOUNT_REQUEST, mUserHandle);
} else {
setResult(RESULT_OK);