Let DesktopModeController reorder tasks on TO_FRONT transitions
When a fullscreen task is moved to the front of the freeform TDA from recents, any previously visible freeform apps should remain active in front of home and behind the task that is moving to front. Since they were sent behind everything when recents opened, they need to be moved to the front again by the controller. Let #handleRequest accept TRANSIT_TO_FRONT transitions as a signal to move desktop apps to the front, just like it does for TRANSIT_OPEN. Bug: 259453661 Test: atest DesktopModeControllerTest Test: manual - 1. Turn desktop mode off, close all apps from recents 2. Launch Gmail 3. Launch Photos 4. Turn desktop mode on from quick settings 5. Observe Photos is freeform and visible, Gmail is invisible behind home 6. Swipe up to recents, tap on Gmail tile 7. Observe Gmail and Photos are both visible in freeform over home Change-Id: I826b926dbc572b48a38d4c49dd4153586ee11469
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user