aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-05-19 01:11:18 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-05-19 01:11:18 +0000
commit5a291a2def736321c15dab94c7c56625730505d3 (patch)
tree348d0290ce426456bb56041cbcb37b459588b922
parent6a5ec3846cf94a7de45df8dac0652c712f89c519 (diff)
parent5a8e56d80b9abe91e706cd272cfba9cccc35dd5f (diff)
downloadplatform-compat-android-security-12.0.0_r45.tar.gz
Change-Id: I0224b86762bb3388e57567c3eaf41d1e74cc6ae4
-rw-r--r--java/android/compat/testing/Classpaths.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/java/android/compat/testing/Classpaths.java b/java/android/compat/testing/Classpaths.java
index 406176e..3b4efd0 100644
--- a/java/android/compat/testing/Classpaths.java
+++ b/java/android/compat/testing/Classpaths.java
@@ -19,7 +19,7 @@ package android.compat.testing;
import static com.google.common.truth.Truth.assertThat;
import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.device.INativeDevice;
import com.android.tradefed.util.CommandResult;
import com.android.tradefed.util.CommandStatus;
import com.android.tradefed.util.FileUtil;
@@ -52,7 +52,7 @@ public final class Classpaths {
}
/** Returns on device filepaths to the jars that are part of a given classpath. */
- public static ImmutableList<String> getJarsOnClasspath(ITestDevice device,
+ public static ImmutableList<String> getJarsOnClasspath(INativeDevice device,
ClasspathType classpath) throws DeviceNotAvailableException {
CommandResult shellResult = device.executeShellV2Command("echo $" + classpath);
assertThat(shellResult.getStatus()).isEqualTo(CommandStatus.SUCCESS);
@@ -64,11 +64,14 @@ public final class Classpaths {
}
/** Returns classes defined a given jar file on the test device. */
- public static ImmutableSet<ClassDef> getClassDefsFromJar(ITestDevice device,
+ public static ImmutableSet<ClassDef> getClassDefsFromJar(INativeDevice device,
String remoteJarPath) throws DeviceNotAvailableException, IOException {
File jar = null;
try {
- jar = Objects.requireNonNull(device.pullFile(remoteJarPath));
+ jar = device.pullFile(remoteJarPath);
+ if (jar == null) {
+ throw new IllegalStateException("could not pull remote file " + remoteJarPath);
+ }
MultiDexContainer<? extends DexBackedDexFile> container =
DexFileFactory.loadDexContainer(jar, Opcodes.getDefault());
ImmutableSet.Builder<ClassDef> set = ImmutableSet.builder();