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

Commit 51a1821c authored by Gaurav Bhola's avatar Gaurav Bhola Committed by Automerger Merge Worker
Browse files

Merge "Handle task visibility change to show the surface" into udc-dev am: dcf6cb5e

parents 730f350d dcf6cb5e
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ public class FullscreenTaskListener implements ShellTaskOrganizer.TaskListener {
    public void onTaskInfoChanged(RunningTaskInfo taskInfo) {
        final State state = mTasks.get(taskInfo.taskId);
        final Point oldPositionInParent = state.mTaskInfo.positionInParent;
        boolean oldVisible = state.mTaskInfo.isVisible;

        if (mWindowDecorViewModelOptional.isPresent()) {
            mWindowDecorViewModelOptional.get().onTaskInfoChanged(taskInfo);
@@ -138,12 +139,18 @@ public class FullscreenTaskListener implements ShellTaskOrganizer.TaskListener {
        updateRecentsForVisibleFullscreenTask(taskInfo);

        final Point positionInParent = state.mTaskInfo.positionInParent;
        if (!oldPositionInParent.equals(state.mTaskInfo.positionInParent)) {
        boolean positionInParentChanged = !oldPositionInParent.equals(positionInParent);
        boolean becameVisible = !oldVisible && state.mTaskInfo.isVisible;

        if (becameVisible || positionInParentChanged) {
            mSyncQueue.runInSync(t -> {
                if (!state.mLeash.isValid()) {
                    // Task vanished before sync completion
                    return;
                }
                if (becameVisible) {
                    t.show(state.mLeash);
                }
                t.setPosition(state.mLeash, positionInParent.x, positionInParent.y);
            });
        }