diff --git a/caliper-runner/src/main/java/com/google/caliper/runner/target/AdbDevice.java b/caliper-runner/src/main/java/com/google/caliper/runner/target/AdbDevice.java index 83f62ac6..4e30a072 100644 --- a/caliper-runner/src/main/java/com/google/caliper/runner/target/AdbDevice.java +++ b/caliper-runner/src/main/java/com/google/caliper/runner/target/AdbDevice.java @@ -127,6 +127,7 @@ protected void startUp() throws Exception { selectDevice(deviceSerialNumber); install(getWorkerApk()); + compile(CALIPER_PACKAGE_NAME); // This method waits for the server to be running. We need to get it here rather than injecting // the port since both the AdbDevice and the ServerSocketService need to be started up by the @@ -135,7 +136,7 @@ protected void startUp() throws Exception { setReversePortForwarding(); startActivity( - "com.google.caliper/.worker.CaliperProxyActivity", + CALIPER_PACKAGE_NAME + "/.worker.CaliperProxyActivity", ImmutableMap.of( "com.google.caliper.runner_port", "" + port, @@ -206,6 +207,13 @@ private void install(File apk) { shell.execute(adbCommand("install", "-r", apk.getAbsolutePath())).orThrow(); } + private void compile(String packageName) { + stdout.println("adb: compiling package " + packageName); + shell + .execute(adbCommand("shell", "cmd", "package", "compile", "-m", "speed", "-f", packageName)) + .orThrow(); + } + /** Uninstalls the package with the given name from the device. */ private void uninstall(String packageName) { stdout.println("adb: uninstalling package " + packageName);