Calculate desktop mode launch bounds for tasks launched into split

When a task is launched directly into multi-window, its activity type
is ACTIVITY_TYPE_UNDEFINED, which prevented
DesktopModeLaunchParamsModifier from setting its desktop bounds that
are used when the task is changed to freeform.
This change updates the early return in #calculate to allow tasks with
an undefined activity type to calculate the launch bounds.

Bug: 280830921
Test: launch app A, then B into split, exit split by dismissing B from
the divider, drag A into desktop, open B from the taskbar - verify the
freeform launch bounds are correct.
Test: atest DesktopModeLaunchParamsModifierTests

Change-Id: I5bdd7687a7db21f78239a30b50d4b29e4ab5e22f
This commit is contained in:
Jorge Gil
2023-05-26 00:23:39 +00:00
parent d647128979
commit 185ba4e598
2 changed files with 18 additions and 3 deletions

View File

@@ -80,8 +80,8 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier {
appendLog("not in bounds phase, skipping");
return RESULT_SKIP;
}
if (!task.isActivityTypeStandard()) {
appendLog("not standard activity type, skipping");
if (!task.isActivityTypeStandardOrUndefined()) {
appendLog("not standard or undefined activity type, skipping");
return RESULT_SKIP;
}
if (!currentParams.mBounds.isEmpty()) {

View File

@@ -18,6 +18,7 @@ package com.android.server.wm;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.util.DisplayMetrics.DENSITY_DEFAULT;
@@ -80,12 +81,26 @@ public class DesktopModeLaunchParamsModifierTests extends WindowTestsBase {
}
@Test
public void testReturnsSkipIfTaskNotUsingActivityTypeStandard() {
public void testReturnsSkipIfTaskNotUsingActivityTypeStandardOrUndefined() {
final Task task = new TaskBuilder(mSupervisor).setActivityType(
ACTIVITY_TYPE_ASSISTANT).build();
assertEquals(RESULT_SKIP, new CalculateRequestBuilder().setTask(task).calculate());
}
@Test
public void testReturnsDoneIfTaskUsingActivityTypeStandard() {
final Task task = new TaskBuilder(mSupervisor).setActivityType(
ACTIVITY_TYPE_STANDARD).build();
assertEquals(RESULT_DONE, new CalculateRequestBuilder().setTask(task).calculate());
}
@Test
public void testReturnsDoneIfTaskUsingActivityTypeUndefined() {
final Task task = new TaskBuilder(mSupervisor).setActivityType(
ACTIVITY_TYPE_UNDEFINED).build();
assertEquals(RESULT_DONE, new CalculateRequestBuilder().setTask(task).calculate());
}
@Test
public void testReturnsSkipIfCurrentParamsHasBounds() {
final Task task = new TaskBuilder(mSupervisor).setActivityType(