Skip to content

Fix(espresso): Fix #2349 #2359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions espresso/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ The following artifacts were released:

**Bug Fixes**

Fix #2349, where multi-process + different rotation on 2 activities, would instantly timeout when waiting for the UI to rotate.

**New Features**

**Breaking Changes**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static java.util.Collections.unmodifiableList;

import android.app.Application;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
Expand All @@ -26,6 +27,7 @@
import androidx.test.espresso.UiController;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/** Helper methods to synchronize configuration changes with onView actions. */
final class ConfigurationSynchronizationUtils {
Expand All @@ -49,6 +51,12 @@ public static void waitForConfigurationChangesOnActivity(
if (Build.VERSION.SDK_INT >= 24 && currentActivity.isInMultiWindowMode()) {
return;
}
// If the application is running activities in different processes, activities that aren't
// on the main process may have a different orientation
if (Build.VERSION.SDK_INT >= 28 && !Objects.equals(
currentActivity.getApplicationInfo().processName, Application.getProcessName())) {
return;
}

int applicationOrientation = appContext.getResources().getConfiguration().orientation;
if (applicationOrientation != currentActivity.getResources().getConfiguration().orientation) {
Expand Down