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

Commit f15b6c4e authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Make a copy of surface control for bubble leash

The surface control from transition should only be used while
animating. If the component wants to keep the surface, it is
safer to make a copy and release by itself.

Also remove manual reparent to null, because the surface is the
real surface of task, core already performs the surface removal
when removing the task.

Bug: 411280316
Flag: EXEMPT bugfix
Test: Launch a bubble task.
      No crash on rotate screen and remove bubble.
Change-Id: I109735be704f4ecf61f88f43a96b4be9dfc27de0
parent 7a79cec7
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -212,7 +212,10 @@ public class TaskViewTaskController implements ShellTaskOrganizer.TaskListener {
    private void resetTaskInfo() {
        mTaskInfo = null;
        mTaskToken = null;
        if (mTaskLeash != null) {
            mTaskLeash.release();
            mTaskLeash = null;
        }
        mPendingInfo = null;
        mTaskNotFound = false;
    }
@@ -261,7 +264,7 @@ public class TaskViewTaskController implements ShellTaskOrganizer.TaskListener {
        }
        mTaskInfo = taskInfo;
        mTaskToken = taskInfo.token;
        mTaskLeash = leash;
        mTaskLeash = new SurfaceControl(leash, "TaskController.onTaskAppeared");

        if (mSurfaceCreated) {
            // Surface is ready, so just reparent the task to this surface control
@@ -295,14 +298,12 @@ public class TaskViewTaskController implements ShellTaskOrganizer.TaskListener {
        // we know about -- so leave clean-up here even if shell transitions are enabled.
        if (mTaskToken == null || !mTaskToken.equals(taskInfo.token)) return;

        final SurfaceControl taskLeash = mTaskLeash;
        if (BubbleAnythingFlagHelper.enableCreateAnyBubble()) {
            handleAndNotifyTaskRemoval(taskInfo);
        } else {
            handleAndNotifyTaskRemoval(mTaskInfo);
        }

        mTransaction.reparent(taskLeash, null).apply();
        resetTaskInfo();
    }

@@ -580,7 +581,7 @@ public class TaskViewTaskController implements ShellTaskOrganizer.TaskListener {
        mPendingInfo = null;
        mTaskInfo = taskInfo;
        mTaskToken = mTaskInfo.token;
        mTaskLeash = leash;
        mTaskLeash = new SurfaceControl(leash, "TaskController.prepareOpen");
        if (!mSurfaceCreated) {
            return null;
        }