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

Commit d41841f4 authored by Jeff Chang's avatar Jeff Chang
Browse files

Consider the lock-task mode while using FLAG_ACTIVITY_TASK_ON_HOME

The flag will cause a newly launching task to be placed on top of the
current home activity task but it did ignore the lock-task mode
mechansim.

This CL checks the home task whether violated with lock-task mode when
startActivity with task-on-home flag.

Bug: 202980858
Test: atest TaskTests#testReturnsToHomeRootTask
      atest ActivityVisibilityTests#testLaunchTaskOnHome
Change-Id: I521b9e4fc32648263afb70de3342dbb5f3583330
parent 6ee7e8b6
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1123,7 +1123,11 @@ class Task extends TaskFragment {
        if (inMultiWindowMode() || !hasChild()) return false;
        if (intent != null) {
            final int returnHomeFlags = FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME;
            return intent != null && (intent.getFlags() & returnHomeFlags) == returnHomeFlags;
            final Task task = getDisplayArea() != null ? getDisplayArea().getRootHomeTask() : null;
            final boolean isLockTaskModeViolation = task != null
                    && mAtmService.getLockTaskController().isLockTaskModeViolation(task);
            return (intent.getFlags() & returnHomeFlags) == returnHomeFlags
                    && !isLockTaskModeViolation;
        }
        final Task bottomTask = getBottomMostTask();
        return bottomTask != this && bottomTask.returnsToHomeRootTask();