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

Commit 33b9c7f1 authored by Jorge Gil's avatar Jorge Gil Committed by Android (Google) Code Review
Browse files

Merge "Let DesktopModeController reorder tasks on TO_FRONT transitions" into tm-qpr-dev

parents af6ed7e4 9792d963
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.os.UserHandle;
import android.provider.Settings;
import android.util.ArraySet;
import android.view.SurfaceControl;
import android.view.WindowManager;
import android.window.DisplayAreaInfo;
import android.window.TransitionInfo;
import android.window.TransitionRequestInfo;
@@ -329,15 +330,17 @@ public class DesktopModeController implements RemoteCallable<DesktopModeControll
    @Override
    public WindowContainerTransaction handleRequest(@NonNull IBinder transition,
            @NonNull TransitionRequestInfo request) {
        // Only do anything if we are in desktop mode and opening a task/app in freeform
        // Only do anything if we are in desktop mode and opening/moving-to-front a task/app in
        // freeform
        if (!DesktopModeStatus.isActive(mContext)) {
            ProtoLog.d(WM_SHELL_DESKTOP_MODE,
                    "skip shell transition request: desktop mode not active");
            return null;
        }
        if (request.getType() != TRANSIT_OPEN) {
        if (request.getType() != TRANSIT_OPEN && request.getType() != TRANSIT_TO_FRONT) {
            ProtoLog.d(WM_SHELL_DESKTOP_MODE,
                    "skip shell transition request: only supports TRANSIT_OPEN");
                    "skip shell transition request: unsupported type %s",
                    WindowManager.transitTypeToString(request.getType()));
            return null;
        }
        if (request.getTriggerTask() == null
+15 −3
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOW_CONFIG_BOUNDS;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_REORDER;
@@ -334,10 +335,10 @@ public class DesktopModeControllerTest extends ShellTestCase {
    }

    @Test
    public void testHandleTransitionRequest_notTransitOpen_returnsNull() {
    public void testHandleTransitionRequest_unsupportedTransit_returnsNull() {
        WindowContainerTransaction wct = mController.handleRequest(
                new Binder(),
                new TransitionRequestInfo(TRANSIT_TO_FRONT, null /* trigger */, null /* remote */));
                new TransitionRequestInfo(TRANSIT_CLOSE, null /* trigger */, null /* remote */));
        assertThat(wct).isNull();
    }

@@ -352,7 +353,7 @@ public class DesktopModeControllerTest extends ShellTestCase {
    }

    @Test
    public void testHandleTransitionRequest_returnsWct() {
    public void testHandleTransitionRequest_taskOpen_returnsWct() {
        RunningTaskInfo trigger = new RunningTaskInfo();
        trigger.token = new MockToken().mToken;
        trigger.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FREEFORM);
@@ -362,6 +363,17 @@ public class DesktopModeControllerTest extends ShellTestCase {
        assertThat(wct).isNotNull();
    }

    @Test
    public void testHandleTransitionRequest_taskToFront_returnsWct() {
        RunningTaskInfo trigger = new RunningTaskInfo();
        trigger.token = new MockToken().mToken;
        trigger.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FREEFORM);
        WindowContainerTransaction wct = mController.handleRequest(
                mock(IBinder.class),
                new TransitionRequestInfo(TRANSIT_TO_FRONT, trigger, null /* remote */));
        assertThat(wct).isNotNull();
    }

    private DesktopModeController createController() {
        return new DesktopModeController(mContext, mShellInit, mShellController,
                mShellTaskOrganizer, mRootTaskDisplayAreaOrganizer, mTransitions,