Merge pull request #97 from smieras/master

#84 PackageManager problems: Fixes issue 1 & 2
This commit is contained in:
Samuel Carlsson 2018-09-10 21:17:08 +02:00 committed by GitHub
commit d3bd5c5ba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -43,7 +43,7 @@ public class PackageManager {
if (!result.contains("Success")) throw new JadbException(getErrorMessage(operation, target, result));
}
public void remove(RemoteFile file) throws IOException, JadbException {
private void remove(RemoteFile file) throws IOException, JadbException {
InputStream s = device.executeShell("rm", "-f", Bash.quote(file.getPath()));
Stream.readAll(s, StandardCharsets.UTF_8);
}
@ -51,7 +51,7 @@ public class PackageManager {
private void install(File apkFile, List<String> extraArguments) throws IOException, JadbException {
RemoteFile remote = new RemoteFile("/sdcard/tmp/" + apkFile.getName());
device.push(apkFile, remote);
ArrayList<String> arguments = new ArrayList<>();
List<String> arguments = new ArrayList<>();
arguments.add("install");
arguments.addAll(extraArguments);
arguments.add(remote.getPath());
@ -91,14 +91,16 @@ public class PackageManager {
//<editor-fold desc="InstallOption">
public static class InstallOption {
private final StringBuilder stringBuilder = new StringBuilder();
InstallOption(String ... varargs) {
String suffix = "";
for(String str: varargs) {
stringBuilder.append(str).append(" ");
stringBuilder.append(suffix).append(str);
suffix = " ";
}
}
private final StringBuilder stringBuilder = new StringBuilder();
private String getStringRepresentation() {
return stringBuilder.toString();
}

View File

@ -90,5 +90,4 @@ public class PackageManagerTest {
//Assert
assertEquals(expected, actual);
}
}