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

Commit f1e7849f 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:...

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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21965793



Change-Id: I1f587af259b61fbc225c6571bda908f0840e33e1
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f2338979 51a1821c
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -129,6 +129,7 @@ public class FullscreenTaskListener implements ShellTaskOrganizer.TaskListener {
    public void onTaskInfoChanged(RunningTaskInfo taskInfo) {
    public void onTaskInfoChanged(RunningTaskInfo taskInfo) {
        final State state = mTasks.get(taskInfo.taskId);
        final State state = mTasks.get(taskInfo.taskId);
        final Point oldPositionInParent = state.mTaskInfo.positionInParent;
        final Point oldPositionInParent = state.mTaskInfo.positionInParent;
        boolean oldVisible = state.mTaskInfo.isVisible;


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


        final Point positionInParent = state.mTaskInfo.positionInParent;
        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 -> {
            mSyncQueue.runInSync(t -> {
                if (!state.mLeash.isValid()) {
                if (!state.mLeash.isValid()) {
                    // Task vanished before sync completion
                    // Task vanished before sync completion
                    return;
                    return;
                }
                }
                if (becameVisible) {
                    t.show(state.mLeash);
                }
                t.setPosition(state.mLeash, positionInParent.x, positionInParent.y);
                t.setPosition(state.mLeash, positionInParent.x, positionInParent.y);
            });
            });
        }
        }