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

Commit 323303ff authored by Matt Sziklay's avatar Matt Sziklay
Browse files

Revert freeform-specific disconnect logic in core.

Since Shell now controls the freeform-specific logic for disconnect transitions, we no longer need any of the specific logic implemented in core. Not only are these changes unneeded, but they also break CTS, so this CL reverts them.

Bug: 391652399
Test: Manual, atest
Flag: com.android.window.flags.enable_display_disconnect_interaction
Change-Id: I14f0dfdd47a0af65bc64b8766329a8047cb1a409
parent 4d60bc1d
Loading
Loading
Loading
Loading
+2 −21
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ import android.os.UserHandle;
import android.util.Slog;
import android.view.SurfaceControl;
import android.view.WindowManager;
import android.window.DesktopExperienceFlags;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.protolog.ProtoLog;
@@ -1688,13 +1687,7 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
                continue;
            }
            final Task task = mChildren.get(i).asTask();
            if (task.inFreeformWindowingMode()
                    && DesktopExperienceFlags.ENABLE_DISPLAY_DISCONNECT_INTERACTION.isTrue()) {
                // TODO(b/391652399): Considerations for display areas that do not support
                //  freeform tasks.
                task.reparent(toDisplayArea, getReparentPosition(task));
                lastReparentedRootTask = task;
            } else if (destroyContentOnRemoval || !task.shouldReparentOnDisplayRemoval()) {
            if (destroyContentOnRemoval || !task.shouldReparentOnDisplayRemoval()) {
                // TODO: For root tasks created by organizer, consider reparenting children tasks
                //  if the use case arises in the future.
                task.remove(false /* withTransition */, "removeTaskDisplayArea");
@@ -1706,9 +1699,7 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
                                        null /* options */,
                                        null /* sourceTask */,
                                        0 /* launchFlags */);

                task.reparent(launchRoot == null ? toDisplayArea : launchRoot,
                        getReparentPosition(task));
                task.reparent(launchRoot == null ? toDisplayArea : launchRoot, POSITION_TOP);

                // If the task is going to be reparented to the non-fullscreen root TDA and the task
                // is set to FULLSCREEN explicitly, we keep the windowing mode as is. Otherwise, the
@@ -1739,16 +1730,6 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
        return lastReparentedRootTask;
    }

    private int getReparentPosition(Task task) {
        if (!DesktopExperienceFlags.ENABLE_DISPLAY_DISCONNECT_INTERACTION.isTrue()) {
            return POSITION_TOP;
        }
        final boolean taskOnTopFocusedDisplay = task.getDisplayId()
                == mRootWindowContainer.getTopFocusedDisplayContent().getDisplayId();
        return taskOnTopFocusedDisplay && task.isFocusedRootTaskOnDisplay()
                ? POSITION_TOP : POSITION_BOTTOM;
    }

    /**
     * Returns the {@link TaskDisplayArea} to which root tasks should be reparented.
     *