Force stop app if it has failures during trial launch

Activities could be remained at foreground when it has failures
in trial launch, which affects testing results of other apps.

Bug: 149326995
Test: atest google/perf/app-startup/hermetic-apps/cold-dropcache-test
Change-Id: Id364461ff5a97384590d1dc7cfb59cc8cf4e88a6
This commit is contained in:
Louis Chang
2020-02-13 12:21:38 +08:00
parent 8869427bbb
commit e5d3d7eb4e

View File

@@ -296,6 +296,8 @@ public class AppLaunch extends InstrumentationTestCase {
AppLaunchResult launchResults = null;
if (hasFailureOnFirstLaunch(launch)) {
// skip if the app has failures while launched first
Log.w(TAG, "Has failures on first launch: " + launch.getApp());
forceStopApp(launch.getApp());
continue;
}
AtraceLogger atraceLogger = null;