Package: emulator-manager
-Version: 1.0.65
+Version: 1.0.66
OS: linux
Build-host-os: linux
Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
Description: Tizen Emulator Manager
Package: emulator-manager
-Version: 1.0.65
+Version: 1.0.66
OS: windows
Build-host-os: windows
Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
}
else if (c.getLongName() == Actions.OP_MAXTOUCH) {
int i = Integer.valueOf(c.getCurrentValue());
- if (i != 1 && i != 2) {
+ if (i != 1 && i != 2 && i != 3) {
throw new ConsoleException("This value(" + c.getCurrentValue() + ") "
- + "is not avaliable. Avaliable mulit-touch point is 1 or 2.");
+ + "is not avaliable. Avaliable mulit-touch point is 1 - 3.");
}
prop.maxTouchCount = i;
}
msgResponse = dialog.open();
return msgResponse;
}
+
+ public void dispose() {
+ shell.dispose();
+ }
}
private void createTouchArea(Table table) {
widget.TouchSpinner = new Spinner(table, SWT.BORDER);
- widget.TouchSpinner.setValues(oldValue.maxTouchCount, 1, 2, 0, 1, 1);
+ widget.TouchSpinner.setValues(oldValue.maxTouchCount, 1, 3, 0, 1, 1);
createTouchListener();
}
package org.tizen.emulator.manager.vms;
-import java.io.BufferedReader;
import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
-import java.util.logging.Level;
-import org.tizen.emulator.manager.logging.EMLogger;
import org.tizen.emulator.manager.tool.About;
import org.tizen.emulator.manager.tool.FileIO;
import org.tizen.emulator.manager.vms.VMsProperty.Architecture;
createInitialVMImageInternal(newVM.baseImagePath, targetPath);
}
- private boolean isError = false;
- private String errorMsg = null;
private void checkCustomBaseImage(final String path) throws VMsCreatorException {
String exe_path = FileIO.getInstance().getBinPath() + File.separator + "qemu-img";
cmd.add("info");
cmd.add(path);
+ String errorMsg = new QemuImgProc(cmd).RunningForCheckImg();
+ if (errorMsg != null) {
+ throw new VMsCreatorException(errorMsg);
+ }
+ /*
ProcessBuilder pb = new ProcessBuilder(cmd);
try {
Process process = pb.start();
} catch (IOException e) {
throw new VMsCreatorException("Failed check base image..." + e.getMessage());
}
+ */
}
public void createInitialVMImageInternal(String baseImagePath, String targetImagePath) throws VMsCreatorException {
cmd.add("-f");
cmd.add("qcow2");
cmd.add(targetImagePath);
-
- ProcessBuilder pb = new ProcessBuilder(cmd);
- try {
- Process process = pb.start();
- if (process != null) {
- final BufferedReader in = new BufferedReader(new InputStreamReader(process.getErrorStream()));
- new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- String str = null;
- do {
- str = in.readLine();
- if (str!= null) {
- EMLogger.getLogger().log(Level.WARNING,
- "Error while running 'qemu-img'\n" + str);
- }
- } while (str != null);
- } catch (IOException e) {
- EMLogger.getLogger().log(Level.WARNING,
- "Error while running 'qemu-img'(stderr)\n" + e.getMessage());
- }
- }
- }).start();
-
- // wait for ending process
- try {
- if (process.waitFor() != 0){
- throw new VMsCreatorException("Failed to create the VM because of failed qemu-img processing.(Exit vlaue: " +
- + process.exitValue() +")\n"
- + "You can get more information in log file ("
- + FileIO.getInstance().getTizenVmsArchPath() + File.separator + "emulator-manager)");
- }
- } catch (InterruptedException e) {
- throw new VMsCreatorException("Failed to create the VM while running qemu-img.\n" + e.getMessage());
- }
- }
- } catch (IOException e) {
- throw new VMsCreatorException("Failed to create the VM!\n" + e.getMessage());
+ if (!new QemuImgProc(cmd).Running()) {
+ throw new VMsCreatorException("Failed to create the VM because of failed qemu-img processing.\n"
+ + "You can get more information in log file ("
+ + FileIO.getInstance().getTizenVmsArchPath() + File.separator + "emulator-manager)");
}
}
--- /dev/null
+package org.tizen.emulator.manager.vms;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.List;
+import java.util.logging.Level;
+
+import org.tizen.emulator.manager.logging.EMLogger;
+import org.tizen.emulator.manager.tool.FileIO;
+
+public class QemuImgProc {
+ private List<String> cmd = null;
+ private boolean isError = false;
+ private String errorMsg = null;
+
+ public QemuImgProc(List<String> cmd) {
+ this.cmd = cmd;
+ }
+
+ public String RunningForCheckImg() {
+ assert cmd == null;
+
+ isError = false;
+ ProcessBuilder pb = new ProcessBuilder(cmd);
+ try {
+ Process process = pb.start();
+ if (process != null) {
+ final BufferedReader error = new BufferedReader(new InputStreamReader(process.getErrorStream()));
+ final BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ new Thread(new Runnable() {
+ public void run() {
+ try {
+ String str = null;
+ do {
+ str = error.readLine();
+ if (str!= null) {
+ isError = true;
+ EMLogger.getLogger().log(Level.WARNING,
+ "Failed check base image...(from qemu-img)\n" + str);
+ }
+ } while (str != null);
+ } catch (IOException e) {
+ isError = true;
+ EMLogger.getLogger().log(Level.WARNING,
+ "Failed check base image...(stderr of qemu-img)\n" + e.getMessage());
+ }
+ }
+ }).start();
+
+ new Thread(new Runnable() {
+ public void run() {
+ try {
+ String str = null;
+ do {
+ str = input.readLine();
+ if (str != null) {
+ if (str.contains("format")) {
+ if (!str.contains("qcow2")) {
+ isError = true;
+ errorMsg = "Format of base image is not avaliable.\nBase image path :" + cmd.get(2);
+ break;
+ }
+ } else if (str != null && str.contains("backing file")) {
+ isError = true;
+ errorMsg = "Base image is child image of other base image.\n" +
+ "This image is not using as base image.\n";
+ break;
+ }
+ }
+ } while (str != null);
+ } catch (IOException e) {
+ isError = true;
+ EMLogger.getLogger().log(Level.WARNING,
+ "Failed check base image...(stdout of qemu-img)\n" + e.getMessage());
+ }
+ }
+ }).start();
+
+ // wait for ending process
+ try {
+ if (process.waitFor() != 0){
+ isError = true;
+ EMLogger.getLogger().log(Level.WARNING,
+ "Error while running 'qemu-img'. Exit value : " + process.exitValue());
+ errorMsg = "Error while running 'qemu-img'. Exit value : " + process.exitValue() +
+ "\nYou can get more information in log file ("
+ + FileIO.getInstance().getTizenVmsArchPath() + File.separator + "emulator-manager)";
+ }
+ } catch (InterruptedException e) {
+ isError = true;
+ EMLogger.getLogger().log(Level.WARNING,
+ "Error while running 'qemu-img'.\n" + e.getMessage());
+ }
+
+ if (isError) {
+ if (errorMsg == null) {
+ errorMsg = "Failed check base image...\nPlease, select base image again.";
+ }
+ }
+ }
+ } catch (IOException e) {
+ return "Failed check base image..." + e.getMessage();
+ }
+ return errorMsg;
+ }
+ public boolean Running() {
+ assert cmd == null;
+
+ isError = false;
+ ProcessBuilder pb = new ProcessBuilder(cmd);
+ try {
+ Process process = pb.start();
+ if (process != null) {
+ final BufferedReader error = new BufferedReader(new InputStreamReader(process.getErrorStream()));
+ new Thread(new Runnable() {
+ public void run() {
+ try {
+ String str = null;
+ do {
+ str = error.readLine();
+ if (str!= null) {
+ isError = true;
+ EMLogger.getLogger().log(Level.WARNING,
+ "Error while running 'qemu-img'\n" + str);
+ }
+ } while (str != null);
+ } catch (IOException e) {
+ isError = true;
+ EMLogger.getLogger().log(Level.WARNING,
+ "Error while running 'qemu-img'(stderr)\n" + e.getMessage());
+ }
+ }
+ }).start();
+
+ // wait for ending process
+ try {
+ if (process.waitFor() != 0){
+ isError = true;
+ EMLogger.getLogger().log(Level.WARNING,
+ "Error while running 'qemu-img'. Exit value : " + process.exitValue());
+ }
+ } catch (InterruptedException e) {
+ isError = true;
+ EMLogger.getLogger().log(Level.WARNING,
+ "Error while running 'qemu-img'.\n" + e.getMessage());
+ }
+
+ if (isError) {
+ return false;
+ }
+ }
+ } catch (IOException e) {
+ EMLogger.getLogger().log(Level.WARNING, "Failed check base image..." + e.getMessage());
+ return false;
+ }
+ return true;
+ }
+}
}
public boolean checkDupulicateName(String t, String arc) {
+ boolean isWindows = false;
+ if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) {
+ isWindows = true;
+ t = t.toLowerCase();
+ }
VMsProperty[] properties = (VMsProperty[])EmulatorVMs.getInstance().getProperties();
for (VMsProperty p : properties) {
if (p.getArch().toString() != arc) {
continue;
}
- if (p.getName().equals(t)) {
- return true;
+ if (isWindows ) {
+ if (p.getName().toLowerCase().equals(t)) {
+ return true;
+ }
+ } else {
+ if (p.getName().equals(t)) {
+ return true;
+ }
}
}
return false;
if (touchType != null) {
maxTouchCount = touchType.getMaxTouchPoint();
} else {
- maxTouchCount = 1;
+ maxTouchCount = 3;
}
addOptions = property.getConfiguration().getUsability().getAdvancedOptions();
value.isHWVirtualization = true;
value.isGLAcceleration = true;
- value.maxTouchCount = 2;
+ value.maxTouchCount = 3;
value.addOptions = null;
return value;
import java.io.BufferedReader;
import java.io.File;
-import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.tizen.emulator.manager.ui.MessageDialog;
-
public class VMsWorker {
VMsProperty property;
Launcher launcher;
}
public void createNewBaseImage(VMsProperty property, String dest) throws VMsWorkerException {
- String childImage = property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue();
- File src1 = new File(childImage);
- if(!src1.exists()) {
+ File childImage = new File(property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue());
+ File baseImage = new File(property.getConfiguration().getBaseInformation().getDiskImage().getBaseDiskImage().getValue());
+ if(!childImage.exists()) {
+ throw new VMsWorkerException("Failed to create base image!\nFile does not exist :" + childImage);
+ }
+
+ if(!baseImage.exists()) {
throw new VMsWorkerException("Failed to create base image!\nFile does not exist :" + childImage);
}
+ //long childSize = childImage.length();
+ //long baseSize = baseImage.length();
+ //final long maxSize = childSize + baseSize;
+
String exe_path = FileIO.getInstance().getBinPath() + File.separator + "qemu-img";
+
List<String> cmd = new ArrayList<String>();
cmd.add(exe_path);
cmd.add("convert");
cmd.add("-O");
cmd.add("qcow2");
- cmd.add(childImage);
+ cmd.add(childImage.getAbsolutePath());
cmd.add(dest);
- EMLogger.getLogger().log(Level.INFO, String.format("%s", cmd));
- ProcessBuilder pb = new ProcessBuilder(cmd);
+ final QemuImgProc proc = new QemuImgProc(cmd);
+
+ /*
+ final File destFile = new File(dest);
+ final CreateBaseImageDialog dialog
+ = new CreateBaseImageDialog(EmulatorManager.getInstance().getMainDialog().getShell());
+ dialog.Open(destFile, maxSize);
+ */
+
+
+ workerThread worker = new workerThread(proc);
+ worker.start();
+ synchronized(worker) {
try {
- pb.start();
- } catch (IOException e) {
- throw new VMsWorkerException("Failed to create new base image!\n" + e.getMessage());
- }
+ worker.wait(2000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } finally {
+ if (worker.isError()) {
+ throw new VMsWorkerException("Failed to create new base image becauese of failed qemu-img processing!\n"
+ + "You can get more information in log file ("
+ + FileIO.getInstance().getTizenVmsArchPath() + File.separator + "emulator-manager)");
+ }
+ }
+ }
+
+ /*
+ if (! proc.Running()) {
+ //dialog.Close();
+ throw new VMsWorkerException("Failed to create new base image becauese of failed qemu-img processing!\n"
+ + "You can get more information in log file ("
+ + FileIO.getInstance().getTizenVmsArchPath() + File.separator + "emulator-manager)");
+ }
+ //dialog.Close();
+ */
+ }
+
+ class workerThread extends Thread {
+ QemuImgProc proc;
+ boolean isError;
+ public workerThread(QemuImgProc proc) {
+ this.proc = proc;
+ isError = false;
+ }
+
+ public void run() {
+ if (! proc.Running()) {
+ isError = true;
+ }
+ synchronized(this) {
+ notifyAll();
+ }
+ }
+
+ public boolean isError() {
+ return isError;
+ }
}
-
+
public void deleteVM() throws VMsWorkerException {
File vmDirectory = property.propertyFile.getParentFile();
return false;
}
}
-}
\ No newline at end of file
+}
+
+/*
+class CreateBaseImageDialog {
+ private Shell dialog = null;
+ static private ProgressBar bar = null;
+
+ public CreateBaseImageDialog(Shell shell) {
+ Point p = shell.getLocation();
+ p = new Point(p.x + 300, p.y + 300);
+ dialog = new Shell(shell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+ dialog.setText("Info");
+ dialog.setSize(300, 100);
+ dialog.setLayout(new GridLayout(1, true));
+ dialog.setLocation(p);
+ //dialog.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ Label info = new Label(dialog, SWT.WRAP);
+ info.setText("Wait....while creating base image.\n"
+ + "This task can take about 30 ~ 60 seconds");
+ info.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
+
+ bar = new ProgressBar(dialog, SWT.SMOOTH);
+ bar.setBounds(10, 10, 200, 32);
+ bar.setMaximum(100);
+
+ dialog.addListener(SWT.Close, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ // Empty
+ }
+
+ });
+ dialog.addMouseListener(new MouseListener(){
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ });
+ }
+
+ public void setSelection(int i) {
+ bar.setSelection(i);
+ }
+ public void Open(final File destFile, final long maxSize) {
+ dialog.open();
+
+ new Thread(new Runnable() {
+ public void run() {
+ int i = 0;
+ while(i != 100 && !dialog.isDisposed()) {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ break;
+ }
+ i = (int)((destFile.length() / maxSize) * 100.0);
+ setSelection(i);
+ }
+ }
+ }).start();
+
+ }
+
+ public void Close() {
+ dialog.close();
+ }
+
+ public boolean isDisposed() {
+ return dialog.isDisposed();
+ }
+}
+*/
\ No newline at end of file