Now possible to launch apps by package name

This commit is contained in:
Samuel Carlsson 2016-04-29 10:02:55 +02:00
parent a1e55f06d8
commit 07f74cb20a
3 changed files with 9 additions and 1 deletions

View File

@ -77,7 +77,6 @@ public class JadbDevice {
if (output != null) {
transport.readResponseTo(new AdbFilterOutputStream(output));
}
//return AdbFilterInputStream(transport.getInputStream());
}
public List<RemoteFile> list(String remotePath) throws IOException, JadbException {

View File

@ -60,4 +60,8 @@ public class PackageManager {
String result = Stream.readAll(s, Charset.forName("UTF-8"));
verifyOperation("uninstall", name.toString(), result);
}
public void launch(Package name) throws IOException, JadbException {
InputStream s = device.executeShell("monkey", "-p", name.toString(), "-c", "android.intent.category.LAUNCHER", "1");
}
}

View File

@ -31,6 +31,11 @@ public class PackageMangerTests {
pm = new PackageManager(jadb.getAnyDevice());
}
@Test
public void testLaunchActivity() throws Exception {
pm.launch(new Package("com.android.settings"));
}
@Test
public void testListPackages() throws Exception {
List<Package> packages = pm.getPackages();