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

Commit 47774bec authored by wilsonshih's avatar wilsonshih
Browse files

Add unit test for simulate startActivityWithScreenshot

when set AS#setFreezeScreen(true), the transition should collect
display content for creating snapshot surface.

Bug: 324377337
Test: atest ActivityStarterTests#testActivityStartWithScreenshot
Change-Id: I6188ecc346427b0bb189648cb276551371b9761e
parent a9b3adea
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -1634,6 +1634,28 @@ public class ActivityStarterTests extends WindowTestsBase {
        assertThat(transition.isInTransientHide(top.getTask())).isTrue();
    }

    /**
     * Tests ATMS#startActivityWithScreenshot should collect display content for creating snapshot.
     */
    @Test
    public void testActivityStartWithScreenshot() {
        final ActivityStarter starter = prepareStarter(0 /* flags */);
        starter.setFreezeScreen(true);

        registerTestTransitionPlayer();

        final Intent intent = new Intent();
        intent.setComponent(ActivityBuilder.getDefaultComponent());
        starter.setReason("testActivityStartWithScreenshot")
                .setIntent(intent)
                .execute();

        final TransitionController controller = mRootWindowContainer.mTransitionController;
        final Transition transition = controller.getCollectingTransition();
        final Transition.ChangeInfo targetChangeInfo = transition.mChanges.get(mDisplayContent);
        assertThat(targetChangeInfo).isNotNull();
    }

    @Test
    public void testActivityStart_expectAddedToRecentTask() {
        RecentTasks recentTasks = mock(RecentTasks.class);