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

Commit 14a73941 authored by Kazuki Takise's avatar Kazuki Takise Committed by Android (Google) Code Review
Browse files

Merge "Make TaskStackListener work in freeform mode" into udc-dev

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


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


        final Task task = child.asTask();
        final Task task = child.asTask();
        if (task != null) {
        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 */);
        dispatchTaskInfoChangedIfNeeded(false /* force */);
        final Task parentTask = getParent().asTask();
        final Task parentTask = getParent().asTask();
        if (parentTask != null) parentTask.dispatchTaskInfoChangedIfNeeded(false /* force */);
        if (parentTask != null) parentTask.dispatchTaskInfoChangedIfNeeded(false /* force */);

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


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