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

Commit b9aa61dd authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Don't assocaite starting window to task for overlay TF" into main

parents 710e5224 2af23635
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2901,6 +2901,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                || mStartingData.mAssociatedTask != null) {
            return;
        }
        if (task.isVisible() && !task.inTransition()) {
            // Don't associated with task if the task is visible especially when the activity is
            // embedded. We just need to show splash screen on the activity in case the first frame
            // is not ready.
            return;
        }
        associateStartingDataWithTask();
        attachStartingSurfaceToAssociatedTask();
    }
+24 −1
Original line number Diff line number Diff line
@@ -2955,7 +2955,8 @@ public class ActivityRecordTests extends WindowTestsBase {

    @Test
    public void testStartingWindowInTaskFragment() {
        final ActivityRecord activity1 = new ActivityBuilder(mAtm).setCreateTask(true).build();
        final ActivityRecord activity1 = new ActivityBuilder(mAtm).setCreateTask(true)
                .setVisible(false).build();
        final WindowState startingWindow = createWindowState(
                new WindowManager.LayoutParams(TYPE_APPLICATION_STARTING), activity1);
        activity1.addWindow(startingWindow);
@@ -3010,6 +3011,28 @@ public class ActivityRecordTests extends WindowTestsBase {
        assertNull(task.mSharedStartingData);
    }

    @Test
    public void testStartingWindowInTaskFragmentWithVisibleTask() {
        final ActivityRecord activity1 = new ActivityBuilder(mAtm).setCreateTask(true).build();
        final Task task = activity1.getTask();
        final Rect taskBounds = task.getBounds();
        final Rect tfBounds = new Rect(taskBounds.left, taskBounds.top,
                taskBounds.left + taskBounds.width() / 2, taskBounds.bottom);
        final TaskFragment taskFragment = new TaskFragmentBuilder(mAtm).setParentTask(task)
                .setBounds(tfBounds).build();

        final ActivityRecord activity2 = new ActivityBuilder(mAtm).build();
        final WindowState startingWindow = createWindowState(
                new WindowManager.LayoutParams(TYPE_APPLICATION_STARTING), activity1);
        taskFragment.addChild(activity2);
        activity2.addWindow(startingWindow);
        activity2.mStartingData = mock(StartingData.class);
        activity2.attachStartingWindow(startingWindow);

        assertNull(activity2.mStartingData.mAssociatedTask);
        assertNull(task.mSharedStartingData);
    }

    @Test
    public void testTransitionAnimationBounds() {
        removeGlobalMinSizeRestriction();