com.google.android.apps.common.testing.testrunner.ActivityLifecycleMonitor

Here are the examples of the java api class com.google.android.apps.common.testing.testrunner.ActivityLifecycleMonitor taken from open source projects.

1. RootMatchers#getResumedActivityTokens()

Project: double-espresso
Source File: RootMatchers.java
View license
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;
}