summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Louis Chang <louischang@google.com> 2023-09-05 02:16:52 +0000
committer Eric Biggers <ebiggers@google.com> 2023-09-11 19:01:40 +0000
commit89c4516f18b492253a6e8bbd355c5e001b49b451 (patch)
treed809a978a79702ddbd4348a7f4e16abe62e6aeb2
parent223294a83fa42ecbd1f151afb0ffd0f6fc8947b6 (diff)
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 18cc3800ddb5e4dee6c425703960b0cf3f763369)
-rw-r--r--core/tests/coretests/src/android/app/activity/ActivityThreadTest.java10
1 files changed, 2 insertions, 8 deletions
diff --git a/core/tests/coretests/src/android/app/activity/ActivityThreadTest.java b/core/tests/coretests/src/android/app/activity/ActivityThreadTest.java
index 5ca7080f2fa8..5373856017e6 100644
--- a/core/tests/coretests/src/android/app/activity/ActivityThreadTest.java
+++ b/core/tests/coretests/src/android/app/activity/ActivityThreadTest.java
@@ -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 {