Check lock-task mode if task_on_home is applied

d41841f469, always checks whether the home task is violated
with lock-task mode while moving the task to the front. That result in
the pinned toast was shown even applications don’t not request to have
task_on_home behavior.

This CL checks the home task violation with lock-task mode after the
task-on-home flag is applyed.

Bug: 261383209
Test: atest TaskTests#testReturnsToHomeRootTask
      atest ActivityVisibilityTests#testLaunchTaskOnHome
Change-Id: Iccc7e595b043a712c5959d28ba14f54825bcadd6
This commit is contained in:
Jeff Chang
2022-12-08 23:13:13 +08:00
parent e354477990
commit 9eef8ebc44

View File

@@ -1119,11 +1119,12 @@ class Task extends TaskFragment {
if (inMultiWindowMode() || !hasChild()) return false;
if (intent != null) {
final int returnHomeFlags = FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME;
if ((intent.getFlags() & returnHomeFlags) != returnHomeFlags) {
return false;
}
final Task task = getDisplayArea() != null ? getDisplayArea().getRootHomeTask() : null;
final boolean isLockTaskModeViolation = task != null
&& mAtmService.getLockTaskController().isLockTaskModeViolation(task);
return (intent.getFlags() & returnHomeFlags) == returnHomeFlags
&& !isLockTaskModeViolation;
return !(task != null
&& mAtmService.getLockTaskController().isLockTaskModeViolation(task));
}
final Task bottomTask = getBottomMostTask();
return bottomTask != this && bottomTask.returnsToHomeRootTask();