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

Commit 75b941e6 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Return START_TASK_TO_FRONT for bring fullscreen task" into tm-dev

parents 401df15e d23fb21a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2730,10 +2730,11 @@ class ActivityStarter {
                                false /* includingParents */);
                        intentTask = intentTask.getParent().asTaskFragment().getTask();
                    }
                    // If the task is in multi-windowing mode, the activity may already be on
                    // If the activity is visible in multi-windowing mode, it may already be on
                    // the top (visible to user but not the global top), then the result code
                    // should be START_DELIVERED_TO_TOP instead of START_TASK_TO_FRONT.
                    final boolean wasTopOfVisibleRootTask = intentActivity.mVisibleRequested
                            && intentActivity.inMultiWindowMode()
                            && intentActivity == mTargetRootTask.topRunningActivity();
                    // We only want to move to the front, if we aren't going to launch on a
                    // different root task. If we launch on a different root task, we will put the
+17 −0
Original line number Diff line number Diff line
@@ -500,6 +500,23 @@ public class ActivityStarterTests extends WindowTestsBase {
        return Pair.create(splitPrimaryActivity, splitSecondActivity);
    }

    @Test
    public void testMoveVisibleTaskToFront() {
        final ActivityRecord activity = new TaskBuilder(mSupervisor)
                .setCreateActivity(true).build().getTopMostActivity();
        final ActivityRecord translucentActivity = new TaskBuilder(mSupervisor)
                .setCreateActivity(true).build().getTopMostActivity();
        assertTrue(activity.mVisibleRequested);

        final ActivityStarter starter = prepareStarter(FLAG_ACTIVITY_NEW_TASK,
                false /* mockGetRootTask */);
        starter.getIntent().setComponent(activity.mActivityComponent);
        final int result = starter.setReason("testMoveVisibleTaskToFront").execute();

        assertEquals(START_TASK_TO_FRONT, result);
        assertEquals(1, activity.compareTo(translucentActivity));
    }

    /**
     * Tests activity is cleaned up properly in a task mode violation.
     */