List<String> cmd = new ArrayList<String>();
int width = property.getConfiguration().getDevice().getDisplay().getResolution().getWidth();
int height = property.getConfiguration().getDevice().getDisplay().getResolution().getHeight();
+ String fileshare = property.getConfiguration().getUsability().getFileSharing().getPath();
+ String sdcard = property.getConfiguration().getDevice().getStorage().getSDCard().getDiskImage();
+ int isLinux = System.getProperty("os.name").toLowerCase().indexOf("linux");
+ int isWindows = System.getProperty("os.name").toLowerCase().indexOf("linux");
+ String osVersion = System.getProperty("os.version");
+ boolean isFileshare = !fileshare.equals("none");
+ boolean isSDcard = !sdcard.equals("none");
cmd.add(fio.getBinPath() + File.separator + binary);
cmd.add("--skin-args");
cmd.add("width=" + width);
cmd.add( "-boot");
cmd.add("c");
cmd.add("-append");
- cmd.add("console=ttyS0 video=uvesafb:ywrap,"
+ if(isLinux > -1 && isFileshare) { // linux and use fileshare [kernel option]
+ cmd.add("console=ttyS0 video=uvesafb:ywrap,"
+ width
+ "x"
+ height
+ " sdb_port=" + portNo
+ " dpi=" + property.getConfiguration().getDevice().getDisplay().getDensity().getValue()
+ " root=/dev/vda rw"
- + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none 5");
+ + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none 5 virtio-9p");
+ }
+ else {
+ cmd.add("console=ttyS0 video=uvesafb:ywrap,"
+ + width
+ + "x"
+ + height
+ + "-32@60"
+ + " sdb_port=" + portNo
+ + " dpi=" + property.getConfiguration().getDevice().getDisplay().getDensity().getValue()
+ + " root=/dev/vda rw"
+ + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none 5");
+ }
+
+ if(isLinux > -1 && isFileshare) { //linux and use fileshare [non-kernel option]
+ cmd.add("-virtfs");
+ cmd.add("local,path=" + property.getConfiguration().getUsability().getFileSharing().getPath() +",security_model=none,mount_tag=fileshare");
+ }
+
+ if(isSDcard) {
+ cmd.add("-drive");
+ cmd.add("file=" + sdcard + ",if=virtio");
+ }
+ if(isWindows > -1 && osVersion.equals("5.1") && isFileshare) { //windows XP and use fileshare
+ //delete if fileshare with the same name existed
+ List<String> cmd2 = new ArrayList<String>();
+ cmd2.add("net");
+ cmd2.add("share");
+ cmd2.add("emulator-" + portNo);
+ cmd2.add("/delete");
+ ProcessBuilder pb2 = new ProcessBuilder(cmd2);
+ pb2.start();
+
+ //start net share
+ List<String> cmd3 = new ArrayList<String>();
+ cmd3.add("net");
+ cmd3.add("share");
+ cmd3.add("emulator-" + portNo + "=" + fileshare);
+ ProcessBuilder pb3 = new ProcessBuilder(cmd3);
+ pb3.start();
+ } else if(isWindows > -1 && osVersion.equals("6.1") && isFileshare) { //windows 7 and use fileshare
+ List<String> cmd2 = new ArrayList<String>();
+ cmd2.add("net");
+ cmd2.add("share");
+ cmd2.add("emulator-" + portNo);
+ cmd2.add("/delete");
+ ProcessBuilder pb2 = new ProcessBuilder(cmd2);
+ pb2.start();
+
+ //start net share
+ List<String> cmd3 = new ArrayList<String>();
+ cmd3.add("net");
+ cmd3.add("share");
+ cmd3.add("emulator-" + portNo + "=" + fileshare);
+ cmd3.add("/grant:"+ System.getProperty("user.name") + ",full");
+ ProcessBuilder pb3 = new ProcessBuilder(cmd3);
+ pb3.start();
+ }
cmd.add("-serial");
cmd.add("file:emulator.klog");
cmd.add("-m");