Merge "ASM - Allow sources to launch into own task with NEW_TASK" into udc-dev

This commit is contained in:
Hani Kazmi
2023-03-01 14:37:17 +00:00
committed by Android (Google) Code Review
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) {