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

This commit is contained in:
Riddle Hsu
2022-03-17 08:54:37 +00:00
committed by Android (Google) Code Review
2 changed files with 19 additions and 1 deletions

View File

@@ -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

View File

@@ -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.
*/