Launch activities in another task if the metadata is set.

Add FLAG_ACTIVITY_NEW_TASK to the intent if META_DATA_LAUNCH_NEW_TASK is
set to true to make it launch a separate task.

Bug: 197702494
Bug: 197700978
Bug: 197702789
Test: Set this metadata to true and make sure this page is launched in another task.
Change-Id: I3b4e5745e940a3db5db6be51e17a9c505915e3c0
This commit is contained in:
Yi-Ling Chuang
2021-10-04 16:25:58 +08:00
parent 02b3384ae1
commit 3855d6e587

View File

@@ -421,6 +421,11 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
ProfileSelectDialog.updateUserHandlesIfNeeded(mContext, tile); ProfileSelectDialog.updateUserHandlesIfNeeded(mContext, tile);
mMetricsFeatureProvider.logStartedIntent(intent, sourceMetricCategory); mMetricsFeatureProvider.logStartedIntent(intent, sourceMetricCategory);
//TODO(b/201970810): Add test cases.
if (tile.isNewTask(mContext)) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
if (tile.userHandle == null || tile.isPrimaryProfileOnly()) { if (tile.userHandle == null || tile.isPrimaryProfileOnly()) {
activity.startActivity(intent); activity.startActivity(intent);
} else if (tile.userHandle.size() == 1) { } else if (tile.userHandle.size() == 1) {