Merge "ASM - Allow sources to launch into own task with NEW_TASK" into udc-dev am: 60d3c059a1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21591527

Change-Id: Ice660a8b21412dbf236052d7cb8a3b0c0949986e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Hani Kazmi
2023-03-01 14:43:41 +00:00
committed by Automerger Merge Worker
2 changed files with 7 additions and 3 deletions

View File

@@ -43,7 +43,7 @@ class ActivitySecurityModelFeatureFlags {
static final String DOC_LINK = "go/android-asm";
/** Used to determine which version of the ASM logic was used in logs while we iterate */
static final int ASM_VERSION = 5;
static final int ASM_VERSION = 6;
private static final String NAMESPACE = NAMESPACE_WINDOW_MANAGER;
private static final String KEY_ASM_PREFIX = "ActivitySecurity__";

View File

@@ -1948,9 +1948,13 @@ class ActivityStarter {
boolean passesAsmChecks = true;
Task sourceTask = mSourceRecord.getTask();
// Don't allow launches into a new task if the current task is not foreground.
// Allow launching into a new task (or a task matching the launched activity's
// affinity) only if the current task is foreground or mutating its own task.
// The latter can happen eg. if caller uses NEW_TASK flag and the activity being
// launched matches affinity of source task.
if (taskToFront) {
passesAsmChecks = sourceTask != null && sourceTask.isVisible();
passesAsmChecks = sourceTask != null
&& (sourceTask.isVisible() || sourceTask == targetTask);
}
if (passesAsmChecks) {