Snap for 4417144 from b83aafdedf02b3ea0b5109457f674cbce3b670ba to oc-m2-release
Change-Id: I5f84eaf28c41ad241c899e3f61b7cb87f6d552c9
diff --git a/src/com/android/tradefed/targetprep/TestAppInstallSetup.java b/src/com/android/tradefed/targetprep/TestAppInstallSetup.java
index ce94055..448fc7e 100644
--- a/src/com/android/tradefed/targetprep/TestAppInstallSetup.java
+++ b/src/com/android/tradefed/targetprep/TestAppInstallSetup.java
@@ -231,6 +231,13 @@
mAltDirs.add(altDir);
}
+ /**
+ * Set an alternate directory behaviors.
+ */
+ public void setAltDirBehavior(AltDirBehavior altDirBehavior) {
+ mAltDirBehavior = altDirBehavior;
+ }
+
/** Attempt to install a package on the device. */
private String installPackage(ITestDevice device, File testAppFile)
throws DeviceNotAvailableException {
diff --git a/src/com/android/tradefed/util/AaptParser.java b/src/com/android/tradefed/util/AaptParser.java
index a69dd7e..58a8b39 100644
--- a/src/com/android/tradefed/util/AaptParser.java
+++ b/src/com/android/tradefed/util/AaptParser.java
@@ -103,21 +103,31 @@
* @return the {@link AaptParser} or <code>null</code> if failed to extract the information
*/
public static AaptParser parse(File apkFile) {
- CommandResult result = RunUtil.getDefault().runTimedCmd(AAPT_TIMEOUT_MS,
- "aapt", "dump", "badging", apkFile.getAbsolutePath());
+ CommandResult result =
+ RunUtil.getDefault()
+ .runTimedCmdRetry(
+ AAPT_TIMEOUT_MS,
+ 0L,
+ 2,
+ "aapt",
+ "dump",
+ "badging",
+ apkFile.getAbsolutePath());
String stderr = result.getStderr();
- if (stderr != null && stderr.length() > 0) {
+ if (stderr != null && !stderr.isEmpty()) {
CLog.e("aapt dump badging stderr: %s", stderr);
}
- if (result.getStatus() == CommandStatus.SUCCESS) {
+ if (CommandStatus.SUCCESS.equals(result.getStatus())) {
AaptParser p = new AaptParser();
if (p.parse(result.getStdout()))
return p;
return null;
}
- CLog.e("Failed to run aapt on %s", apkFile.getAbsoluteFile());
+ CLog.e(
+ "Failed to run aapt on %s. stdout: %s",
+ apkFile.getAbsoluteFile(), result.getStdout());
return null;
}