From 3855d6e5877734412b84ed86b32262e754e6a366 Mon Sep 17 00:00:00 2001 From: Yi-Ling Chuang Date: Mon, 4 Oct 2021 16:25:58 +0800 Subject: [PATCH] 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 --- .../settings/dashboard/DashboardFeatureProviderImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java index 4581f6caba8..27b20cf4ef7 100644 --- a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java +++ b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java @@ -421,6 +421,11 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider { ProfileSelectDialog.updateUserHandlesIfNeeded(mContext, tile); 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()) { activity.startActivity(intent); } else if (tile.userHandle.size() == 1) {