mirror of
https://github.com/revanced/jadb.git
synced 2025-02-14 02:56:48 +01:00
Merge pull request #97 from smieras/master
#84 PackageManager problems: Fixes issue 1 & 2
This commit is contained in:
commit
d3bd5c5ba6
@ -43,7 +43,7 @@ public class PackageManager {
|
|||||||
if (!result.contains("Success")) throw new JadbException(getErrorMessage(operation, target, result));
|
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()));
|
InputStream s = device.executeShell("rm", "-f", Bash.quote(file.getPath()));
|
||||||
Stream.readAll(s, StandardCharsets.UTF_8);
|
Stream.readAll(s, StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ public class PackageManager {
|
|||||||
private void install(File apkFile, List<String> extraArguments) throws IOException, JadbException {
|
private void install(File apkFile, List<String> extraArguments) throws IOException, JadbException {
|
||||||
RemoteFile remote = new RemoteFile("/sdcard/tmp/" + apkFile.getName());
|
RemoteFile remote = new RemoteFile("/sdcard/tmp/" + apkFile.getName());
|
||||||
device.push(apkFile, remote);
|
device.push(apkFile, remote);
|
||||||
ArrayList<String> arguments = new ArrayList<>();
|
List<String> arguments = new ArrayList<>();
|
||||||
arguments.add("install");
|
arguments.add("install");
|
||||||
arguments.addAll(extraArguments);
|
arguments.addAll(extraArguments);
|
||||||
arguments.add(remote.getPath());
|
arguments.add(remote.getPath());
|
||||||
@ -91,14 +91,16 @@ public class PackageManager {
|
|||||||
|
|
||||||
//<editor-fold desc="InstallOption">
|
//<editor-fold desc="InstallOption">
|
||||||
public static class InstallOption {
|
public static class InstallOption {
|
||||||
|
private final StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
InstallOption(String ... varargs) {
|
InstallOption(String ... varargs) {
|
||||||
|
String suffix = "";
|
||||||
for(String str: varargs) {
|
for(String str: varargs) {
|
||||||
stringBuilder.append(str).append(" ");
|
stringBuilder.append(suffix).append(str);
|
||||||
|
suffix = " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
|
|
||||||
private String getStringRepresentation() {
|
private String getStringRepresentation() {
|
||||||
return stringBuilder.toString();
|
return stringBuilder.toString();
|
||||||
}
|
}
|
||||||
|
@ -90,5 +90,4 @@ public class PackageManagerTest {
|
|||||||
//Assert
|
//Assert
|
||||||
assertEquals(expected, actual);
|
assertEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user