Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9eef8ebc authored by Jeff Chang's avatar Jeff Chang
Browse files

Check lock-task mode if task_on_home is applied

d41841f4, 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
parent e3544779
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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();