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

Commit dff9dcdd authored by wilsonshih's avatar wilsonshih
Browse files

Adjust unit tests following behavior change from b9df0ebc.

Since commit b9df0ebc, ActivityRecord no longer adjusts the task order
when finishing an activity. Instead, the order will change when
resuming the next activity, if necessary.

Flag: com.android.window.flags.polish_close_wallpaper_includes_open_change
Bug: 421436197
Test: atest ActivityRecordTests WindowContainerTransactionTests
Change-Id: Ie65478308d743f86bf1fd78fb5c80189801960ef
parent 239caf34
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ import android.os.RemoteException;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.annotations.Presubmit;
import android.platform.test.annotations.RequiresFlagsDisabled;
import android.provider.DeviceConfig;
import android.util.MutableBoolean;
import android.view.DisplayInfo;
@@ -1137,6 +1138,7 @@ public class ActivityRecordTests extends WindowTestsBase {
     * Verify that when finishing the top focused activity on top display, the root task order
     * will be changed by adjusting focus.
     */
    @RequiresFlagsDisabled(Flags.FLAG_POLISH_CLOSE_WALLPAPER_INCLUDES_OPEN_CHANGE)
    @Test
    public void testFinishActivityIfPossible_adjustStackOrder() {
        final ActivityRecord activity = createActivityWithTask();
@@ -1165,6 +1167,7 @@ public class ActivityRecordTests extends WindowTestsBase {
     * Verify that when finishing the top focused activity while root task was created by organizer,
     * the stack order will be changed by adjusting focus.
     */
    @RequiresFlagsDisabled(Flags.FLAG_POLISH_CLOSE_WALLPAPER_INCLUDES_OPEN_CHANGE)
    @Test
    public void testFinishActivityIfPossible_adjustStackOrderOrganizedRoot() {
        // Make mStack be a the root task that created by task organizer
@@ -1194,6 +1197,7 @@ public class ActivityRecordTests extends WindowTestsBase {
     * activity on default display, the preferred top stack on default display should be changed by
     * adjusting focus.
     */
    @RequiresFlagsDisabled(Flags.FLAG_POLISH_CLOSE_WALLPAPER_INCLUDES_OPEN_CHANGE)
    @Test
    public void testFinishActivityIfPossible_PreferredTopStackChanged() {
        final ActivityRecord activity = createActivityWithTask();
+10 −0
Original line number Diff line number Diff line
@@ -89,6 +89,11 @@ public class WindowContainerTransactionTests extends WindowTestsBase {
        assertTrue(task.hasChild());
        assertTrue(activity.finishing);

        if (Flags.polishCloseWallpaperIncludesOpenChange()) {
            // Simulate idle to destroy mFinishingActivities
            mSupervisor.processStoppingAndFinishingActivities(null /* launchedActivity */,
                    false /* processPausingActivities */, "test");
        }
        activity.destroyed("testRemoveContainer");
        // Assert that the container was removed after the activity is destroyed.
        assertNull(task.getParent());
@@ -116,6 +121,11 @@ public class WindowContainerTransactionTests extends WindowTestsBase {
        assertTrue(task.hasChild());
        assertTrue(activity.finishing);

        if (Flags.polishCloseWallpaperIncludesOpenChange()) {
            // Simulate idle to destroy mFinishingActivities.
            mSupervisor.processStoppingAndFinishingActivities(null /* launchedActivity */,
                    false /* processPausingActivities */, "test");
        }
        activity.destroyed("testRemoveRootTask");
        // Assert that the container was removed after the activity is destroyed.
        assertNull(task.getParent());