private String listInstalledPackages() throws Exception {
    CommandLine command = new CommandLine(AndroidSdk.adb().getAbsolutePath());
    command.addArgument("-s", false);
    command.addArgument(serial, false);
    command.addArgument("shell", false);
    command.addArgument("pm", false);
    command.addArgument("list", false);
    command.addArgument("packages", false);
    return ShellCommand.exec(command);
  }
Works only if - android_home and java_home are set and - if one emulator is already running - and
selendroid project is build (apks are existent)

@author ddary
selendroid-standalone/src/test/java/io/selendroid/standalone/android/impl/DefaultHardwareDeviceTests.java