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

Commit ef51f596 authored by Louis Chang's avatar Louis Chang
Browse files

Relaunch the activity with current configuration to avoid flakiness

The activity was relaunched with empty configuration, which
unfortunately reset the SCREENLAYOUT_COMPAT_NEEDED bit of
the app’s configuration. Therefore, the later test failed
while comparing the configuration between the app and the activity.

Bug: 295234586
Test: attest ActivityThreadTest
Change-Id: Id667768cf345136038ab1d626141a014d2f1e616
parent 52fb7e39
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -67,7 +67,6 @@ import android.view.View;
import android.window.WindowContextInfo;
import android.window.WindowTokenClientController;

import androidx.test.filters.FlakyTest;
import androidx.test.filters.MediumTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.rule.ActivityTestRule;
@@ -630,7 +629,6 @@ public class ActivityThreadTest {
        });
    }

    @FlakyTest(bugId = 295234586)
    @Test
    public void testHandleConfigurationChanged_DoesntOverrideActivityConfig() {
        final TestActivity activity = mActivityTestRule.launchActivity(new Intent());
@@ -836,8 +834,10 @@ public class ActivityThreadTest {
    }

    private static ClientTransaction newRelaunchResumeTransaction(Activity activity) {
        final Configuration currentConfig = activity.getResources().getConfiguration();
        final ClientTransactionItem callbackItem = ActivityRelaunchItem.obtain(null,
                null, 0, new MergedConfiguration(), false /* preserveWindow */);
                null, 0, new MergedConfiguration(currentConfig, currentConfig),
                false /* preserveWindow */);
        final ResumeActivityItem resumeStateRequest =
                ResumeActivityItem.obtain(true /* isForward */,
                        false /* shouldSendCompatFakeFocus*/);