Loading tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java +23 −4 Original line number Original line Diff line number Diff line Loading @@ -510,15 +510,18 @@ public class AppLaunch extends InstrumentationTestCase { * based on status of the compilation command. * based on status of the compilation command. */ */ private boolean compileAppForIorap(String appPkgName) throws IOException { private boolean compileAppForIorap(String appPkgName) throws IOException { String logcatTimestamp = getTimeNowForLogcat(); getInstrumentation().getUiAutomation(). getInstrumentation().getUiAutomation(). executeShellCommand(IORAP_COMPILE_CMD); executeShellCommand(IORAP_COMPILE_CMD); for (int i = 0; i < IORAP_COMPILE_CMD_TIMEOUT; ++i) { int i = 0; for (i = 0; i < IORAP_COMPILE_CMD_TIMEOUT; ++i) { IorapCompilationStatus status = waitForIorapCompiled(appPkgName); IorapCompilationStatus status = waitForIorapCompiled(appPkgName); if (status == IorapCompilationStatus.COMPLETE) { if (status == IorapCompilationStatus.COMPLETE) { Log.v(TAG, "compileAppForIorap: success"); Log.v(TAG, "compileAppForIorap: success"); logDumpsysIorapd(appPkgName); logDumpsysIorapd(appPkgName); return true; break; } else if (status == IorapCompilationStatus.INSUFFICIENT_TRACES) { } else if (status == IorapCompilationStatus.INSUFFICIENT_TRACES) { Log.e(TAG, "compileAppForIorap: failed due to insufficient traces"); Log.e(TAG, "compileAppForIorap: failed due to insufficient traces"); logDumpsysIorapd(appPkgName); logDumpsysIorapd(appPkgName); Loading @@ -527,11 +530,27 @@ public class AppLaunch extends InstrumentationTestCase { sleep(1000); sleep(1000); } } if (i == IORAP_COMPILE_CMD_TIMEOUT) { Log.e(TAG, "compileAppForIorap: failed due to timeout"); Log.e(TAG, "compileAppForIorap: failed due to timeout"); logDumpsysIorapd(appPkgName); logDumpsysIorapd(appPkgName); return false; return false; } } // Wait for the job to finish completely. // Other packages could be compiled in cyclic runs. int currentAttempt = 0; do { String logcatLines = getLogcatSinceTime(logcatTimestamp); if (logcatLines.contains("IorapForwardingService: Finished background job")) { return true; } sleep(1000); } while (currentAttempt++ < IORAP_COMPILE_CMD_TIMEOUT); Log.e(TAG, "compileAppForIorap: failed due to jobscheduler timeout."); return false; } /** Save the contents of $(adb shell dumpsys iorapd) to the launch_logs directory. */ /** Save the contents of $(adb shell dumpsys iorapd) to the launch_logs directory. */ private void logDumpsysIorapd(String packageName) throws IOException { private void logDumpsysIorapd(String packageName) throws IOException { InstrumentationTestRunner instrumentation = InstrumentationTestRunner instrumentation = Loading Loading
tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java +23 −4 Original line number Original line Diff line number Diff line Loading @@ -510,15 +510,18 @@ public class AppLaunch extends InstrumentationTestCase { * based on status of the compilation command. * based on status of the compilation command. */ */ private boolean compileAppForIorap(String appPkgName) throws IOException { private boolean compileAppForIorap(String appPkgName) throws IOException { String logcatTimestamp = getTimeNowForLogcat(); getInstrumentation().getUiAutomation(). getInstrumentation().getUiAutomation(). executeShellCommand(IORAP_COMPILE_CMD); executeShellCommand(IORAP_COMPILE_CMD); for (int i = 0; i < IORAP_COMPILE_CMD_TIMEOUT; ++i) { int i = 0; for (i = 0; i < IORAP_COMPILE_CMD_TIMEOUT; ++i) { IorapCompilationStatus status = waitForIorapCompiled(appPkgName); IorapCompilationStatus status = waitForIorapCompiled(appPkgName); if (status == IorapCompilationStatus.COMPLETE) { if (status == IorapCompilationStatus.COMPLETE) { Log.v(TAG, "compileAppForIorap: success"); Log.v(TAG, "compileAppForIorap: success"); logDumpsysIorapd(appPkgName); logDumpsysIorapd(appPkgName); return true; break; } else if (status == IorapCompilationStatus.INSUFFICIENT_TRACES) { } else if (status == IorapCompilationStatus.INSUFFICIENT_TRACES) { Log.e(TAG, "compileAppForIorap: failed due to insufficient traces"); Log.e(TAG, "compileAppForIorap: failed due to insufficient traces"); logDumpsysIorapd(appPkgName); logDumpsysIorapd(appPkgName); Loading @@ -527,11 +530,27 @@ public class AppLaunch extends InstrumentationTestCase { sleep(1000); sleep(1000); } } if (i == IORAP_COMPILE_CMD_TIMEOUT) { Log.e(TAG, "compileAppForIorap: failed due to timeout"); Log.e(TAG, "compileAppForIorap: failed due to timeout"); logDumpsysIorapd(appPkgName); logDumpsysIorapd(appPkgName); return false; return false; } } // Wait for the job to finish completely. // Other packages could be compiled in cyclic runs. int currentAttempt = 0; do { String logcatLines = getLogcatSinceTime(logcatTimestamp); if (logcatLines.contains("IorapForwardingService: Finished background job")) { return true; } sleep(1000); } while (currentAttempt++ < IORAP_COMPILE_CMD_TIMEOUT); Log.e(TAG, "compileAppForIorap: failed due to jobscheduler timeout."); return false; } /** Save the contents of $(adb shell dumpsys iorapd) to the launch_logs directory. */ /** Save the contents of $(adb shell dumpsys iorapd) to the launch_logs directory. */ private void logDumpsysIorapd(String packageName) throws IOException { private void logDumpsysIorapd(String packageName) throws IOException { InstrumentationTestRunner instrumentation = InstrumentationTestRunner instrumentation = Loading