use of com.google.android.apps.common.testing.testrunner.ActivityLifecycleMonitor in project double-espresso by JakeWharton.
the class RootMatchers method getResumedActivityTokens.
private static List<IBinder> getResumedActivityTokens() {
ActivityLifecycleMonitor activityLifecycleMonitor = ActivityLifecycleMonitorRegistry.getInstance();
Collection<Activity> resumedActivities = activityLifecycleMonitor.getActivitiesInStage(Stage.RESUMED);
if (resumedActivities.isEmpty()) {
throw new NoActivityResumedException("At least one activity should be in RESUMED stage.");
}
List<IBinder> tokens = Lists.newArrayList();
for (Activity activity : resumedActivities) {
tokens.add(activity.getWindow().getDecorView().getApplicationWindowToken());
}
return tokens;
}
Aggregations