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

Commit 185ba4e5 authored by Jorge Gil's avatar Jorge Gil
Browse files

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
parent d6471289
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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()) {
+16 −1
Original line number Diff line number Diff line
@@ -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(