fragment/src/androidTest/java/androidx/fragment/app/FragmentTransactionTest.java
@Test
    public void newIntentUnlocks() throws Throwable {
        Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
        Intent intent1 = new Intent(mActivity, NewIntentActivity.class)
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        NewIntentActivity newIntentActivity =
                (NewIntentActivity) instrumentation.startActivitySync(intent1);
        FragmentTestUtil.waitForExecution(mActivityRule);

        Intent intent2 = new Intent(mActivity, FragmentTestActivity.class);
        intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        Activity coveringActivity = instrumentation.startActivitySync(intent2);
        FragmentTestUtil.waitForExecution(mActivityRule);

        Intent intent3 = new Intent(mActivity, NewIntentActivity.class)
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mActivity.startActivity(intent3);
        assertTrue(newIntentActivity.newIntent.await(1, TimeUnit.SECONDS));
        FragmentTestUtil.waitForExecution(mActivityRule);

        for (Fragment fragment : newIntentActivity.getSupportFragmentManager().getFragments()) {
            // There really should only be one fragment in newIntentActivity.
            assertEquals(1, fragment.getChildFragmentManager().getFragments().size());
        }
    }
/**
     * onNewIntent() should note that the state is not saved so that child fragment
     * managers can execute transactions.
     */
onNewIntent() should note that the state is not saved so that child fragment
managers can execute transactions.
onNewIntent () should note that the state is not saved so that child fragment managers can execute transactions .
@Test
    public void newIntentUnlocks() throws Throwable {
        Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
        Intent intent1 = new Intent(mActivity, NewIntentActivity.class)
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        NewIntentActivity newIntentActivity =
                (NewIntentActivity) instrumentation.startActivitySync(intent1);
        FragmentTestUtil.waitForExecution(mActivityRule);
        Intent intent2 = new Intent(mActivity, FragmentTestActivity.class);
        intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        Activity coveringActivity = instrumentation.startActivitySync(intent2);
        FragmentTestUtil.waitForExecution(mActivityRule);
        Intent intent3 = new Intent(mActivity, NewIntentActivity.class)
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mActivity.startActivity(intent3);
        assertTrue(newIntentActivity.newIntent.await(1, TimeUnit.SECONDS));
        FragmentTestUtil.waitForExecution(mActivityRule);
        for (Fragment fragment : newIntentActivity.getSupportFragmentManager().getFragments()) {
            assertEquals(1, fragment.getChildFragmentManager().getFragments().size());
        }
    }
@ Test public void newIntentUnlocks ( ) throws Throwable { Instrumentation instrumentation = InstrumentationRegistry . getInstrumentation ( ) ; Intent intent1 = new Intent ( mActivity , NewIntentActivity . class ) . setFlags ( Intent . FLAG_ACTIVITY_NEW_TASK ) ; NewIntentActivity newIntentActivity = ( NewIntentActivity ) instrumentation . startActivitySync ( intent1 ) ; FragmentTestUtil . waitForExecution ( mActivityRule ) ; Intent intent2 = new Intent ( mActivity , FragmentTestActivity . class ) ; intent2 . setFlags ( Intent . FLAG_ACTIVITY_NEW_TASK ) ; Activity coveringActivity = instrumentation . startActivitySync ( intent2 ) ; FragmentTestUtil . waitForExecution ( mActivityRule ) ; Intent intent3 = new Intent ( mActivity , NewIntentActivity . class ) . setFlags ( Intent . FLAG_ACTIVITY_NEW_TASK ) ; mActivity . startActivity ( intent3 ) ; assertTrue ( newIntentActivity . newIntent . await ( 1 , TimeUnit . SECONDS ) ) ; FragmentTestUtil . waitForExecution ( mActivityRule ) ; for ( Fragment fragment : newIntentActivity . getSupportFragmentManager ( ) . getFragments ( ) ) { assertEquals ( 1 , fragment . getChildFragmentManager ( ) . getFragments ( ) . size ( ) ) ; } }
onNewIntent() should note that the state is not saved so that child fragment
 managers can execute transactions.
onNewIntent () should note that the state is not saved so that child fragment managers can execute transactions .
// There really should only be one fragment in newIntentActivity.