Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeController.java +6 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopModeControllerTest.java +15 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); } Loading @@ -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); Loading @@ -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, Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeController.java +6 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopModeControllerTest.java +15 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); } Loading @@ -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); Loading @@ -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, Loading