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

Commit 26dc113e authored by Chris Li's avatar Chris Li
Browse files

Reparent child surface layers when TDA migrate to new surface control

When the DA is vanished, it will be migrated to a new surface control,
however, before this change, TDA is not reparenting it child surface
layers.

Fix: 182349684
Test: adb shell am crash com.android.systemui
Change-Id: I32d8a0d784dc5af36c956b312d68efb33775950e
parent cace0ba9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -451,7 +451,7 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {

    void sendDisplayAreaVanished(IDisplayAreaOrganizer organizer) {
        if (organizer == null) return;
        migrateToNewSurfaceControl();
        migrateToNewSurfaceControl(getSyncTransaction());
        mOrganizerController.onDisplayAreaVanished(organizer, this);
    }

+3 −3
Original line number Diff line number Diff line
@@ -2382,11 +2382,11 @@ class Task extends WindowContainer<WindowContainer> {
    }

    @Override
    void migrateToNewSurfaceControl() {
        super.migrateToNewSurfaceControl();
    void migrateToNewSurfaceControl(SurfaceControl.Transaction t) {
        super.migrateToNewSurfaceControl(t);
        mLastSurfaceSize.x = 0;
        mLastSurfaceSize.y = 0;
        updateSurfaceSize(getPendingTransaction());
        updateSurfaceSize(t);
    }

    void updateSurfaceSize(SurfaceControl.Transaction transaction) {
+16 −0
Original line number Diff line number Diff line
@@ -963,6 +963,22 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
        }
    }

    @Override
    void migrateToNewSurfaceControl(SurfaceControl.Transaction t) {
        super.migrateToNewSurfaceControl(t);
        if (mAppAnimationLayer == null) {
            return;
        }

        // As TaskDisplayArea is getting a new surface, reparent and reorder the child surfaces.
        t.reparent(mAppAnimationLayer, mSurfaceControl);
        t.reparent(mBoostedAppAnimationLayer, mSurfaceControl);
        t.reparent(mHomeAppAnimationLayer, mSurfaceControl);
        t.reparent(mSplitScreenDividerAnchor, mSurfaceControl);
        reassignLayer(t);
        scheduleAnimation();
    }

    void onRootTaskRemoved(Task rootTask) {
        if (ActivityTaskManagerDebugConfig.DEBUG_ROOT_TASK) {
            Slog.v(TAG_ROOT_TASK, "onRootTaskRemoved: detaching " + rootTask + " from displayId="
+1 −1
Original line number Diff line number Diff line
@@ -310,7 +310,7 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
            boolean taskAppearedSent = t.mTaskAppearedSent;
            if (taskAppearedSent) {
                if (t.getSurfaceControl() != null) {
                    t.migrateToNewSurfaceControl();
                    t.migrateToNewSurfaceControl(t.getSyncTransaction());
                }
                t.mTaskAppearedSent = false;
            }
+1 −2
Original line number Diff line number Diff line
@@ -460,8 +460,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
     * This is used to revoke control of the SurfaceControl from a client process that was
     * previously organizing this WindowContainer.
     */
    void migrateToNewSurfaceControl() {
        SurfaceControl.Transaction t = getPendingTransaction();
    void migrateToNewSurfaceControl(SurfaceControl.Transaction t) {
        t.remove(mSurfaceControl);
        // Clear the last position so the new SurfaceControl will get correct position
        mLastSurfacePosition.set(0, 0);