From: jihye kim Date: Mon, 26 Mar 2012 14:16:09 +0000 (+0900) Subject: [Title] add 'skin front key type' and add 'hw virtualization' X-Git-Tag: 2.2.1_release^2~152^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ce18f344c66c4826f19a5490f399ed32efbf41c7;p=sdk%2Femulator%2Femulator-manager.git [Title] add 'skin front key type' and add 'hw virtualization' [Type] Enhancement [Module] emulator manager [Priority] major [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- diff --git a/src/org/tizen/emulator/manager/ui/detail/VMPropertyView.java b/src/org/tizen/emulator/manager/ui/detail/VMPropertyView.java index 4275d80..b094891 100644 --- a/src/org/tizen/emulator/manager/ui/detail/VMPropertyView.java +++ b/src/org/tizen/emulator/manager/ui/detail/VMPropertyView.java @@ -24,7 +24,6 @@ import org.eclipse.swt.widgets.Text; import org.tizen.emulator.manager.ui.ResourceRegistry; import org.tizen.emulator.manager.ui.ResourceRegistry.ImageName; import org.tizen.emulator.manager.vms.Creator; -import org.tizen.emulator.manager.vms.EmulatorVMs; import org.tizen.emulator.manager.vms.VMCreateHelper; import org.tizen.emulator.manager.vms.VMPropertyValue; import org.tizen.emulator.manager.vms.VMsProperty; @@ -32,9 +31,9 @@ import org.tizen.emulator.manager.vms.VMsWorkerException; enum CItem{ ImageName("Name"), ImageNameInfo(""), BaseImage("BaseImage"), - Resolution("Display Resolution"), Density("Display Density"), SkinPath("Skin Path"), + Resolution("Display Resolution"), Density("Display Density"), SkinType("Front Key Type"), SDType("SDCard"), SDPath("SDCard Path"), RAMSize("RAM Size"), - ShareType("File Sharing"), SharePath("File Sharing Path"); + ShareType("File Sharing"), SharePath("File Sharing Path"), HWVirtual("HW Virtualization"); private String value; CItem(String s) { @@ -47,9 +46,9 @@ enum CItem{ enum DItem{ ImageName("Name"), BaseImage("BaseImage"), - Resolution("Display Resolution"), Density("Display Density"), SkinPath("Skin Path"), + Resolution("Display Resolution"), Density("Display Density"), SkinType("Front Key Type"), SDType("SDCard"), SDPath("SDCard Path"), RAMSize("RAM Size"), - ShareType("File Sharing"), SharePath("File Sharing Path"), Dummy(""); + ShareType("File Sharing"), SharePath("File Sharing Path"), HWVirtual("HW Virtualization"), Dummy(""); private String value; DItem(String s) { @@ -138,7 +137,9 @@ public class VMPropertyView { widget.itemList.get(DItem.Resolution.ordinal()).setText(1, oldValue.resolution); widget.itemList.get(DItem.Density.ordinal()).setText(1, String.valueOf(oldValue.dpi)); - widget.itemList.get(DItem.SkinPath.ordinal()).setText(1, oldValue.skinPathName); + // TODO : please !! + widget.itemList.get(DItem.SkinType.ordinal()).setText(1, oldValue.keyType == 1 + ? "1Key type" : "3Keys type"); widget.itemList.get(DItem.SDType.ordinal()).setText(1, oldValue.isSDCardSupport ? SupportType.getInstance().get(0) : SupportType.getInstance().get(1)); @@ -149,6 +150,9 @@ public class VMPropertyView { widget.itemList.get(DItem.ShareType.ordinal()).setText(1,oldValue.isFileShareSupport ? SupportType.getInstance().get(0) : SupportType.getInstance().get(1)); widget.itemList.get(DItem.SharePath.ordinal()).setText(1, oldValue.fileSharePathName); + + widget.itemList.get(DItem.HWVirtual.ordinal()).setText(1, oldValue.isHWVirtualization && helper.isSupportVirtualization() + ? SupportType.getInstance().get(0) : SupportType.getInstance().get(1)); } public void createDetailView(boolean isDefaultImage) { @@ -163,7 +167,8 @@ public class VMPropertyView { widget.itemList.get(CItem.Resolution.ordinal()).setText(1, oldValue.resolution); widget.itemList.get(CItem.Density.ordinal()).setText(1, String.valueOf(oldValue.dpi)); - widget.itemList.get(CItem.SkinPath.ordinal()).setText(1, oldValue.skinPathName); + // TODO : please !!! + widget.itemList.get(CItem.SkinType.ordinal()).setText(1, "1Key type"); widget.itemList.get(CItem.SDType.ordinal()).setText(1,SupportType.getInstance().get(0)); widget.itemList.get(CItem.SDPath.ordinal()).setText(1, oldValue.SDCardPathName); @@ -172,6 +177,9 @@ public class VMPropertyView { widget.itemList.get(CItem.ShareType.ordinal()).setText(1, SupportType.getInstance().get(0)); widget.itemList.get(CItem.SharePath.ordinal()).setText(1, oldValue.fileSharePathName); + + widget.itemList.get(CItem.HWVirtual.ordinal()).setText(1, oldValue.isHWVirtualization && helper.isSupportVirtualization() + ? SupportType.getInstance().get(0) : SupportType.getInstance().get(1)); } public void modifyView(Button confirm) { @@ -184,6 +192,7 @@ public class VMPropertyView { createSDCardArea(table); createRAMSizeArea(table); createFileShareArea(table); + createHWVirtualArea(table); settingModifyTableEditor(); } @@ -198,7 +207,8 @@ public class VMPropertyView { createSDCardArea(table); createRAMSizeArea(table); createFileShareArea(table); - + createHWVirtualArea(table); + settingCreateTableEditor(); } @@ -221,7 +231,7 @@ public class VMPropertyView { editor = new TableEditor(table); editor.grabHorizontal = true; - editor.setEditor(widget.skinPathCombo, widget.itemList.get(DItem.SkinPath.ordinal()), 1); + editor.setEditor(widget.skinTypeCombo, widget.itemList.get(DItem.SkinType.ordinal()), 1); editor = new TableEditor(table); editor.grabHorizontal = true; @@ -242,6 +252,10 @@ public class VMPropertyView { editor = new TableEditor(table); editor.grabHorizontal = true; editor.setEditor(widget.selectShareFolderButton, widget.itemList.get(DItem.SharePath.ordinal()), 1); + + editor = new TableEditor(table); + editor.grabHorizontal = true; + editor.setEditor(widget.HWVirtualCombo, widget.itemList.get(DItem.HWVirtual.ordinal()), 1); } private void settingCreateTableEditor() { @@ -267,7 +281,7 @@ public class VMPropertyView { editor = new TableEditor(table); editor.grabHorizontal = true; - editor.setEditor(widget.skinPathCombo, widget.itemList.get(CItem.SkinPath.ordinal()), 1); + editor.setEditor(widget.skinTypeCombo, widget.itemList.get(CItem.SkinType.ordinal()), 1); editor = new TableEditor(table); editor.grabHorizontal = true; @@ -288,6 +302,10 @@ public class VMPropertyView { editor = new TableEditor(table); editor.grabHorizontal = true; editor.setEditor(widget.selectShareFolderButton, widget.itemList.get(CItem.SharePath.ordinal()), 1); + + editor = new TableEditor(table); + editor.grabHorizontal = true; + editor.setEditor(widget.HWVirtualCombo, widget.itemList.get(CItem.HWVirtual.ordinal()), 1); } public static final int MAX_NAME_LEN = 20; @@ -405,13 +423,11 @@ public class VMPropertyView { widget.DIPspinner = new Spinner(table, SWT.BORDER); widget.DIPspinner.setValues(oldValue.dpi, 100, 480, 0, 1, 1); - widget.skinPathCombo = helper.makeCombo(table); - helper.addComboItem(widget.skinPathCombo, SkinPath.getInstance().getList()); - widget.skinPathCombo.add(oldValue.skinPathName, 0); - widget.skinPathCombo.add("-----------------------------------------------------", 1); - widget.skinPathCombo.add("--Select existing SkinFolder", SkinPath.getInstance().size() + 2); - widget.skinPathCombo.select(0); - widget.skinPathCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + widget.skinTypeCombo = helper.makeCombo(table); + widget.skinTypeCombo.add("1Key type"); + widget.skinTypeCombo.add("3Keys type"); + widget.skinTypeCombo.select(oldValue.keyType == 1 ? 0 : 1); + widget.skinTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); createDisplayListener(); } @@ -428,18 +444,6 @@ public class VMPropertyView { } } - if (SkinPath.getInstance().size() == 0) { - newValue.skinPath = "emul_" + newValue.resolution; - newValue.skinPathName = "emul_" + newValue.resolution; - } else { - int i = SkinPath.getInstance().findIndex(newValue.resolution); - newValue.skinPath = SkinPath.getInstance().get(i); - newValue.skinPathName = SkinPath.getInstance().get(i); - } - widget.skinPathCombo.remove(0); - widget.skinPathCombo.add(newValue.skinPath, 0); - widget.skinPathCombo.select(0); - if (!isCreateMode) { checkModifyState(); } @@ -460,30 +464,20 @@ public class VMPropertyView { } }); - widget.skinPathCombo.addSelectionListener(new SelectionListener() { + // TODO : modify please !!!! + widget.skinTypeCombo.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { - int i = widget.skinPathCombo.getSelectionIndex(); - if (i == SkinPath.getInstance().size() + 2) { // Select Exist Skin Folder - if (widget.skinPathDD == null) { - widget.skinPathDD = new DirectoryDialog(table.getShell(), SWT.OPEN); - widget.skinPathDD.setText("Select a Direcory"); - } - String path = widget.skinPathDD.open(); - if(path != null) { - newValue.skinPath = path; - newValue.skinPathName = path.substring(path.lastIndexOf(SEFARATOR) + 1, path.length()); - } - - } else if (i != 0 && i != 1) { - newValue.skinPath = widget.skinPathCombo.getItem(i); - newValue.skinPathName = widget.skinPathCombo.getItem(i); + int i = widget.skinTypeCombo.getSelectionIndex(); + if (i == 0) {// 1key type + newValue.keyType = 1; + } else if (i == 1) { // 3key type + MessageBox msg = new MessageBox(table.getShell(), SWT.ICON_WARNING); + msg.setText("Warning"); + msg.setMessage("Check platform of emulator support 3keys(Call/Home/End)\n" + +"If platform is not support, just change emulator skin."); + newValue.keyType = 3; } - - widget.skinPathCombo.remove(0); - widget.skinPathCombo.add(newValue.skinPathName, 0); - widget.skinPathCombo.select(0); - if (!isCreateMode) { checkModifyState(); } @@ -654,6 +648,37 @@ public class VMPropertyView { }); } + private void createHWVirtualArea(final Table table) { + widget.HWVirtualCombo = helper.makeCombo(table); + helper.addComboItem(widget.HWVirtualCombo, SupportType.getInstance().getList()); + widget.HWVirtualCombo.select(oldValue.isHWVirtualization && helper.isSupportVirtualization() + ? 0 : 1); + + if (!helper.isSupportVirtualization()) { + widget.HWVirtualCombo.setEnabled(false); + } + + createHWVirtualListener(); + } + + private void createHWVirtualListener() { + widget.HWVirtualCombo.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent e) { + int i = widget.HWVirtualCombo.getSelectionIndex(); + newValue.isHWVirtualization = i == 0 ? true : false; + + if (!isCreateMode) { + checkModifyState(); + } + } + @Override + public void widgetDefaultSelected(SelectionEvent e) { + } + + }); + } + private void checkModifyState() { if (!newValue.equals(oldValue)) { widget.confirmButton.setEnabled(true); @@ -703,8 +728,7 @@ class VMViewWidget { public Combo resolutionCombo; public Spinner DIPspinner; - public Combo skinPathCombo; - public DirectoryDialog skinPathDD; + public Combo skinTypeCombo; public Combo SDCardTypeCombo; public Combo SDCardPathCombo; @@ -716,6 +740,8 @@ class VMViewWidget { public Button selectShareFolderButton; public DirectoryDialog shareFileDD; + public Combo HWVirtualCombo; + public Button cancelButton; public Button confirmButton; @@ -727,11 +753,12 @@ class VMViewWidget { selectBaseImageButton.dispose(); resolutionCombo.dispose(); DIPspinner.dispose(); - skinPathCombo.dispose(); + skinTypeCombo.dispose(); SDCardTypeCombo.dispose(); SDCardPathCombo.dispose(); ramSizeCombo.dispose(); shareTypeCombo.dispose(); selectShareFolderButton.dispose(); + HWVirtualCombo.dispose(); } } diff --git a/src/org/tizen/emulator/manager/vms/Creator.java b/src/org/tizen/emulator/manager/vms/Creator.java index 6c0aaf9..db79ad3 100644 --- a/src/org/tizen/emulator/manager/vms/Creator.java +++ b/src/org/tizen/emulator/manager/vms/Creator.java @@ -39,6 +39,7 @@ public class Creator { createDisplay(); createRam(); createSDCard(); + createHWVirtualization(); } catch(VMsCreatorException e) { deleteFolder(folder); @@ -123,8 +124,11 @@ public class Creator { newVM.resolutionType.setWidth(Integer.valueOf(newVM.resolution.substring(0,i))); newVM.resolutionType.setHeight(Integer.valueOf(newVM.resolution.substring(i+1,newVM.resolution.length()))); - if (newVM.skinPath == newVM.skinPathName) { - newVM.skinPath = FileIO.getInstance().getSkinPath() + File.separator + newVM.skinPathName; + // TODO : modify please !! + if (newVM.keyType == 1) { // 1key + newVM.skinPath = FileIO.getInstance().getSkinPath() + File.separator + "emul_" + newVM.resolution; + } else if (newVM.keyType == 3){ // 3 key + newVM.skinPath = FileIO.getInstance().getSkinPath() + File.separator + "emul_3kyes_" + newVM.resolution; } } @@ -139,7 +143,9 @@ public class Creator { } } } - + + private void createHWVirtualization() {} + private void settingProperty() { ObjectFactory factory = EmulatorVMs.getInstance().getObjectFactory(); EmulatorConfiguration ec = property.getConfiguration(); @@ -172,7 +178,7 @@ public class Creator { ec.getUsability().setLogging(factory.createUsabilityTypeLogging()); ec.getUsability().getLogging().setLevel("NONE"); - ec.getUsability().setHwVirtualization(true); + ec.getUsability().setHwVirtualization(newVM.isHWVirtualization); ec.getUsability().setFileSharing(factory.createUsabilityTypeFileSharing()); if (!newVM.fileSharePath.isEmpty()) { diff --git a/src/org/tizen/emulator/manager/vms/Launcher.java b/src/org/tizen/emulator/manager/vms/Launcher.java index dcf02c4..e814c61 100644 --- a/src/org/tizen/emulator/manager/vms/Launcher.java +++ b/src/org/tizen/emulator/manager/vms/Launcher.java @@ -19,7 +19,6 @@ public class Launcher { static boolean launch(VMsProperty property) { String binary; String kvm = ""; - boolean exists = false; int portNo; //check available port number. @@ -36,12 +35,12 @@ public class Launcher { else binary = "emulator-x86"; - if (System.getProperty("os.name").toLowerCase().indexOf("linux") > -1 && property.getConfiguration().getUsability().isHwVirtualization()) { - File fi = new File("/dev/kvm"); - exists = fi.exists(); - if(exists) - kvm = "-enable-kvm"; + if (property.getConfiguration().getUsability().isHwVirtualization() && VMCreateHelper.isSupport) { + kvm = VMCreateHelper.enable_command; + } else { + kvm = VMCreateHelper.disable_command; } + FileIO fio = new FileIO(); // make cmd to run emulator try { @@ -169,7 +168,9 @@ public class Launcher { cmd.add("user"); cmd.add("-rtc"); cmd.add("base=utc"); - cmd.add(kvm); + if (kvm != null) { + cmd.add(kvm); + } // cmd.add("-redir"); // cmd.add("tcp:1202:10.0.2.16:22"); diff --git a/src/org/tizen/emulator/manager/vms/Modifier.java b/src/org/tizen/emulator/manager/vms/Modifier.java index 7d7bd1e..e26df84 100644 --- a/src/org/tizen/emulator/manager/vms/Modifier.java +++ b/src/org/tizen/emulator/manager/vms/Modifier.java @@ -12,31 +12,39 @@ public class Modifier { private Modifier() {} static void modify(VMsProperty property, VMPropertyValue oldVM, VMPropertyValue newVM) throws VMsWorkerException { - if(oldVM.equals(newVM)) // if nothing if modified... + if(oldVM.equals(newVM)) {// if nothing if modified... return; + } + if (!newVM.resolution.equals(oldVM.resolution)) { int i = newVM.resolution.indexOf('x'); oldVM.resolutionType.setWidth(Integer.valueOf(newVM.resolution.substring(0,i))); oldVM.resolutionType.setHeight(Integer.valueOf(newVM.resolution.substring(i+1,newVM.resolution.length()))); property.getConfiguration().getDevice().getDisplay().setResolution(oldVM.resolutionType); + // TODO : modify please !! + if (newVM.keyType == 1) { // 1key + newVM.skinPath = FileIO.getInstance().getSkinPath() + File.separator + "emul_" + newVM.resolution; + } else if (newVM.keyType == 3){ // 3 key + newVM.skinPath = FileIO.getInstance().getSkinPath() + File.separator + "emul_3kyes_" + newVM.resolution; + } + property.getConfiguration().getDevice().getDisplay().getSkinPath().setPath(newVM.skinPath); + } else { + // TODO : modify please !! + if (newVM.keyType != oldVM.keyType) { + if (newVM.keyType == 1) { // 1key + newVM.skinPath = FileIO.getInstance().getSkinPath() + File.separator + "emul_" + newVM.resolution; + } else if (newVM.keyType == 3){ // 3 key + newVM.skinPath = FileIO.getInstance().getSkinPath() + File.separator + "emul_3kyes_" + newVM.resolution; + } + property.getConfiguration().getDevice().getDisplay().getSkinPath().setPath(newVM.skinPath); + } } if (newVM.dpi != oldVM.dpi) { property.getConfiguration().getDevice().getDisplay().getDensity().setValue(newVM.dpi); } - if (newVM.skinPath != oldVM.skinPath) { - if (newVM.skinPath == newVM.skinPathName) { - newVM.skinPath = FileIO.getInstance().getSkinPath() + File.separator + newVM.skinPathName; - } - if (property.getConfiguration().getDevice().getDisplay().getSkinPath() == null) { - property.getConfiguration().getDevice().getDisplay().setSkinPath - (EmulatorVMs.getInstance().getObjectFactory().createDisplayTypeSkinPath()); - } - property.getConfiguration().getDevice().getDisplay().getSkinPath().setPath(newVM.skinPath); - } - if (newVM.isSDCardSupport != oldVM.isSDCardSupport) { if (newVM.isSDCardSupport) { modifySDCard(newVM); @@ -62,6 +70,10 @@ public class Modifier { } else if (newVM.isFileShareSupport && !newVM.fileSharePath.equals(oldVM.fileSharePath)) { property.getConfiguration().getUsability().getFileSharing().setPath(newVM.fileSharePath); } + + if (newVM.isHWVirtualization != oldVM.isHWVirtualization) { + property.getConfiguration().getUsability().setHwVirtualization(newVM.isHWVirtualization); + } EmulatorVMs.getInstance().storeXML(property); } diff --git a/src/org/tizen/emulator/manager/vms/VMCreateHelper.java b/src/org/tizen/emulator/manager/vms/VMCreateHelper.java index 20534a4..d0051e2 100644 --- a/src/org/tizen/emulator/manager/vms/VMCreateHelper.java +++ b/src/org/tizen/emulator/manager/vms/VMCreateHelper.java @@ -94,4 +94,31 @@ public class VMCreateHelper { } return list; } + + // TODO : update please !! + public static boolean isSupport = false; + public static String enable_command = ""; + public static String disable_command = null; + static { + if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) { + if(new File("\\\\.\\HAX").exists()) { + isSupport = true; + } + enable_command = "-enable-hax"; + disable_command = "-disable-hax"; + } + + if (System.getProperty("os.name").toLowerCase().indexOf("linux") > -1) { + if(new File("/dev/kvm").exists()) { + isSupport = true; + } + enable_command = "-enable-kvm"; + } + } + + + + public boolean isSupportVirtualization() { + return isSupport; + } } diff --git a/src/org/tizen/emulator/manager/vms/VMPropertyValue.java b/src/org/tizen/emulator/manager/vms/VMPropertyValue.java index 0a7f396..b6b52bf 100644 --- a/src/org/tizen/emulator/manager/vms/VMPropertyValue.java +++ b/src/org/tizen/emulator/manager/vms/VMPropertyValue.java @@ -19,8 +19,8 @@ public class VMPropertyValue implements Cloneable { public Resolution resolutionType; public String resolution; public int dpi; + public int keyType; public String skinPath; - public String skinPathName; public boolean isSDCardSupport; public String SDCardPath; @@ -32,6 +32,8 @@ public class VMPropertyValue implements Cloneable { public String fileSharePath; public String fileSharePathName; + public boolean isHWVirtualization; + private VMPropertyValue() {} // for clone... VMPropertyValue(VMsProperty property) { @@ -48,18 +50,21 @@ public class VMPropertyValue implements Cloneable { resolution = String.valueOf(re.getWidth()) + "x" + String.valueOf(re.getHeight()); dpi = property.getConfiguration().getDevice().getDisplay().getDensity().getValue(); - // Skin Path + // TODO : Skin Type.. if (property.getConfiguration().getDevice().getDisplay().getSkinPath() != null) { skinPath = property.getConfiguration().getDevice().getDisplay().getSkinPath().getPath(); if (skinPath != null) { - skinPathName = skinPath.substring(skinPath.lastIndexOf(File.separator) + 1, skinPath.length()); + if (skinPath.contains("3kyes")) { + keyType = 3; + } else { + keyType = 1; + } } else { - skinPath = ""; - skinPathName = "( None )"; + keyType = 1; } } else { - skinPath = ""; - skinPathName = "( None )"; + skinPath = null; + keyType = 1; } // @@ -83,6 +88,7 @@ public class VMPropertyValue implements Cloneable { fileSharePathName = "( None )"; } ramSize = property.getConfiguration().getDevice().getRAM().getSize().getValue(); + isHWVirtualization = property.getConfiguration().getUsability().isHwVirtualization(); } @Override @@ -100,7 +106,7 @@ public class VMPropertyValue implements Cloneable { dest.resolution = this.resolution; dest.dpi = this.dpi; dest.skinPath = this.skinPath; - dest.skinPathName = this.skinPathName; + dest.keyType = this.keyType; dest.isSDCardSupport = this.isSDCardSupport; dest.SDCardPath = this.SDCardPath; @@ -111,6 +117,7 @@ public class VMPropertyValue implements Cloneable { dest.isFileShareSupport = this.isFileShareSupport; dest.fileSharePath = this.fileSharePath; dest.fileSharePathName = this.fileSharePathName; + dest.isHWVirtualization = this.isHWVirtualization; return dest; } @@ -129,7 +136,7 @@ public class VMPropertyValue implements Cloneable { return false; if(this.dpi != dest.dpi) return false; - if(this.skinPath != dest.skinPath) + if(this.keyType != dest.keyType) return false; if(this.isSDCardSupport != dest.isSDCardSupport) return false; @@ -137,6 +144,8 @@ public class VMPropertyValue implements Cloneable { return false; if(this.isFileShareSupport != dest.isFileShareSupport) return false; + if (this.isHWVirtualization != dest.isHWVirtualization) + return false; return true; } @@ -160,7 +169,7 @@ public class VMPropertyValue implements Cloneable { value.dpi = 316; // this value be related to resolution // TODO : Skin Path value.skinPath = FileIO.getInstance().getSkinPath() + File.separator + "emul_" + value.resolution; - value.skinPathName = "emul_" + value.resolution; + value.keyType = 1; // value.isSDCardSupport = false; @@ -172,7 +181,8 @@ public class VMPropertyValue implements Cloneable { value.isFileShareSupport = false; value.fileSharePath = ""; value.fileSharePathName = "( None )"; - + + value.isHWVirtualization = true; return value; } }