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

Commit 89c4516f authored by Louis Chang's avatar Louis Chang Committed by Eric Biggers
Browse files

Attempt fixing test flakiness

The activity should be set to RESUMED state after relaunched, or
the activity is remained in CREATED state. Somehow, the activity
could relayout window and update the app configuration after
destroyed, while the next test is started running.

Bug: 298331121
Test: atest ActivityThreadTest

Change-Id: I413ec5ed5e3939582816dd80a4fdfd5ec0b18e99
Merged-In: I413ec5ed5e3939582816dd80a4fdfd5ec0b18e99
(cherry picked from commit 18cc3800)
parent 223294a8
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -232,15 +232,9 @@ public class ActivityThreadTest {

            // Execute a local relaunch item with current scaled config (e.g. simulate recreate),
            // the config should not be scaled again.
            final Configuration currentConfig = activity.getResources().getConfiguration();
            final ClientTransaction localTransaction =
                    newTransaction(activityThread, activity.getActivityToken());
            localTransaction.addCallback(ActivityRelaunchItem.obtain(
                    null /* pendingResults */, null /* pendingIntents */, 0 /* configChanges */,
                    new MergedConfiguration(currentConfig, currentConfig),
                    true /* preserveWindow */));
            InstrumentationRegistry.getInstrumentation().runOnMainSync(
                    () -> activityThread.executeTransaction(localTransaction));
                    () -> activityThread.executeTransaction(
                            newRelaunchResumeTransaction(activity)));

            assertScreenScale(scale, activity, originalActivityConfig, originalActivityMetrics);
        } finally {