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

Commit f8de05fd authored by Kazuki Takise's avatar Kazuki Takise Committed by Automerger Merge Worker
Browse files

Merge "Make TaskStackListener work in freeform mode" into udc-dev am: 14a73941

parents 5870e388 14a73941
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -4764,13 +4764,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                mWindowManager.updateFocusedWindowLocked(UPDATE_FOCUS_NORMAL,
                        true /*updateInputWindows*/);
            }
            if (task != prevFocusTask) {
                if (prevFocusTask != null) {
                    mTaskChangeNotificationController.notifyTaskFocusChanged(
                            prevFocusTask.mTaskId, false);
                }
                mTaskChangeNotificationController.notifyTaskFocusChanged(task.mTaskId, true);
            }
        }
        if (task != prevTask) {
            mTaskSupervisor.mRecentTasks.add(task);
+6 −8
Original line number Diff line number Diff line
@@ -1290,12 +1290,12 @@ class Task extends TaskFragment {
        return null;
    }

    void updateTaskMovement(boolean toTop, int position) {
    void updateTaskMovement(boolean toTop, boolean toBottom, int position) {
        EventLogTags.writeWmTaskMoved(mTaskId, getRootTaskId(), getDisplayId(), toTop ? 1 : 0,
                position);
        final TaskDisplayArea taskDisplayArea = getDisplayArea();
        if (taskDisplayArea != null && isLeafTask()) {
            taskDisplayArea.onLeafTaskMoved(this, toTop);
            taskDisplayArea.onLeafTaskMoved(this, toTop, toBottom);
        }
        if (isPersistable) {
            mLastTimeMoved = System.currentTimeMillis();
@@ -2561,7 +2561,7 @@ class Task extends TaskFragment {

        final Task task = child.asTask();
        if (task != null) {
            task.updateTaskMovement(toTop, position);
            task.updateTaskMovement(toTop, position == POSITION_BOTTOM, position);
        }
    }

@@ -4323,6 +4323,8 @@ class Task extends TaskFragment {
        dispatchTaskInfoChangedIfNeeded(false /* force */);
        final Task parentTask = getParent().asTask();
        if (parentTask != null) parentTask.dispatchTaskInfoChangedIfNeeded(false /* force */);

        mAtmService.getTaskChangeNotificationController().notifyTaskFocusChanged(mTaskId, hasFocus);
    }

    void onPictureInPictureParamsChanged() {
@@ -4655,13 +4657,9 @@ class Task extends TaskFragment {
                final Task lastFocusedTask = displayArea.getFocusedRootTask();
                displayArea.positionChildAt(POSITION_BOTTOM, this, false /*includingParents*/);
                displayArea.updateLastFocusedRootTask(lastFocusedTask, reason);
                mAtmService.getTaskChangeNotificationController().notifyTaskMovedToBack(
                        getTaskInfo());
            }
            if (task != null && task != this) {
                positionChildAtBottom(task);
                mAtmService.getTaskChangeNotificationController().notifyTaskMovedToBack(
                        task.getTaskInfo());
            }
            return;
        }
@@ -5923,7 +5921,7 @@ class Task extends TaskFragment {
        if (canBeLaunchedOnDisplay(newParent.getDisplayId())) {
            reparent(newParent, onTop ? POSITION_TOP : POSITION_BOTTOM);
            if (isLeafTask()) {
                newParent.onLeafTaskMoved(this, onTop);
                newParent.onLeafTaskMoved(this, onTop, !onTop);
            }
        } else {
            Slog.w(TAG, "Task=" + this + " can't reparent to " + newParent);
+7 −2
Original line number Diff line number Diff line
@@ -403,7 +403,7 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
                    this /* child */, true /* includingParents */);
        }

        child.updateTaskMovement(moveToTop, targetPosition);
        child.updateTaskMovement(moveToTop, moveToBottom, targetPosition);

        // The insert position may be adjusted to non-top when there is always-on-top root task.
        // Since the original position is preferred to be top, the root task should have higher
@@ -433,7 +433,12 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
        }
    }

    void onLeafTaskMoved(Task t, boolean toTop) {
    void onLeafTaskMoved(Task t, boolean toTop, boolean toBottom) {
        if (toBottom) {
            mAtmService.getTaskChangeNotificationController().notifyTaskMovedToBack(
                    t.getTaskInfo());
        }

        if (!toTop) {
            if (t.mTaskId == mLastLeafTaskToFrontId) {
                mLastLeafTaskToFrontId = INVALID_TASK_ID;