From 77aee29d6cfb919ca58cf1d64b68050d13aaa514 Mon Sep 17 00:00:00 2001 From: "minkee.lee" Date: Tue, 5 Aug 2014 15:34:19 +0900 Subject: [PATCH] Mobile: Apply template and device configuration. - Template file for property ui applied. - Sensor, jack, devices on/off enable. Change-Id: Ib74f2d558d63242168509fbb727b333f54a96120 Signed-off-by: minkee.lee --- .../manager/mobile/ui/detail/ItemListFactory.java | 86 +++++++--- .../manager/mobile/ui/detail/TDisplayItem.java | 5 + .../manager/mobile/ui/detail/TFileShareItem.java | 5 + .../manager/mobile/ui/detail/THWSupportItem.java | 5 + .../manager/mobile/ui/detail/TNFCItem.java | 5 + .../manager/mobile/ui/detail/TNameTextItem.java | 7 +- .../manager/mobile/ui/detail/TRAMItem.java | 5 + .../mobile/ui/detail/TSupportSuspendItem.java | 4 + .../manager/mobile/ui/detail/TTouchPointItem.java | 5 + .../emulator/manager/mobile/vms/Launcher.java | 181 ++++++++++++++++++--- template/standard.xml | 28 ---- template/x86-kiran-template.xml | 74 +++++++++ template/x86-kiran.xml | 50 ++++++ template/x86-standard-template.xml | 72 ++++++++ template/x86-standard.xml | 48 ++++++ 15 files changed, 504 insertions(+), 76 deletions(-) delete mode 100644 template/standard.xml create mode 100644 template/x86-kiran-template.xml create mode 100644 template/x86-kiran.xml create mode 100644 template/x86-standard-template.xml create mode 100644 template/x86-standard.xml diff --git a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/ItemListFactory.java b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/ItemListFactory.java index 9670b5b..5ea07d6 100644 --- a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/ItemListFactory.java +++ b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/ItemListFactory.java @@ -30,63 +30,95 @@ package org.tizen.emulator.manager.mobile.ui.detail; import java.util.ArrayList; +import java.util.List; import org.tizen.emulator.manager.EmulatorManager; import org.tizen.emulator.manager.EmulatorManager.ManagerModeType; +import org.tizen.emulator.manager.ui.detail.item.CommonItemListFactory; import org.tizen.emulator.manager.ui.detail.item.IInfoViewItem; -import org.tizen.emulator.manager.ui.detail.item.IItemListFactory; import org.tizen.emulator.manager.ui.detail.item.IModifyViewItem; +import org.tizen.emulator.manager.ui.detail.item.IViewItem; +import org.tizen.emulator.manager.vms.xml.template.ItemList; -public class ItemListFactory implements IItemListFactory { +public class ItemListFactory extends CommonItemListFactory { private static ArrayList infoList = null; private static ArrayList modifyList = null; + @ Override - public ArrayList getInfoItemList() { + public ArrayList getInfoItemList(ItemList template) { // if (infoList == null) { - makeInfoList(); + infoList = new ArrayList(); + makeItemListOld(infoList); + makeItemList(infoList, template); // } return infoList; } @ Override - public ArrayList getModifyItemList() { + public ArrayList getModifyItemList(ItemList template) { // if (modifyList == null) { - makeModifyList(); + modifyList = new ArrayList(); + makeItemListOld(modifyList); + makeItemList(modifyList, template); // } return modifyList; } - private static void makeInfoList() { - infoList = new ArrayList(); + private static void makeItemListOld(List list) { + List itemList = (List)list; - infoList.add(new TNameTextItem()); - infoList.add(new TDisplayItem()); - infoList.add(new TRAMItem()); - infoList.add(new TTouchPointItem()); + itemList.add(new TNameTextItem()); + itemList.add(new TDisplayItem()); + itemList.add(new TRAMItem()); + itemList.add(new TTouchPointItem()); if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) { - infoList.add(new TSupportSuspendItem()); + itemList.add(new TSupportSuspendItem()); } - infoList.add(new TFileShareItem()); - infoList.add(new THWSupportItem()); - infoList.add(new TNFCItem()); + + itemList.add(new TFileShareItem()); + itemList.add(new THWSupportItem()); + } - private static void makeModifyList() { - modifyList = new ArrayList(); +// private static void makeModifyList() { +// modifyList = new ArrayList(); +// +// modifyList.add(new TNameTextItem()); +// modifyList.add(new TDisplayItem()); +// modifyList.add(new TRAMItem()); +// modifyList.add(new TTouchPointItem()); +// if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) { +// modifyList.add(new TSupportSuspendItem()); +// } +// modifyList.add(new TFileShareItem()); +// modifyList.add(new THWSupportItem()); +// +// } + + @Override + public void makeItemList(List itemList, + ItemList template) { + if (template == null) { + makeItemListOld(itemList); // TODO old + } else { + makePropertyItemList(itemList, template.getPropertyList()); + makeDeviceItemList(itemList, template.getDeviceList()); - modifyList.add(new TNameTextItem()); - modifyList.add(new TDisplayItem()); - modifyList.add(new TRAMItem()); - modifyList.add(new TTouchPointItem()); - if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) { - modifyList.add(new TSupportSuspendItem()); } - modifyList.add(new TFileShareItem()); - modifyList.add(new THWSupportItem()); - modifyList.add(new TNFCItem()); + } + + @Override + public void makeCustomItemList(List itemList, + List templateList) { + if (templateList == null || templateList.size() == 0) { + makeItemListOld(itemList); // TODO old + } else { + + makeCustomDeviceItemList(itemList, templateList); + } } } diff --git a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TDisplayItem.java b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TDisplayItem.java index db9de26..87cfe7a 100644 --- a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TDisplayItem.java +++ b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TDisplayItem.java @@ -529,4 +529,9 @@ public class TDisplayItem extends DetailViewItem { dpiSpinner.setFocus(); } } + + @Override + public boolean checkValue() { + return true; + } } diff --git a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TFileShareItem.java b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TFileShareItem.java index d44698f..c83509a 100644 --- a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TFileShareItem.java +++ b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TFileShareItem.java @@ -335,4 +335,9 @@ public class TFileShareItem extends DetailViewItem { } } + @Override + public boolean checkValue() { + return true; + } + } diff --git a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/THWSupportItem.java b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/THWSupportItem.java index bc5b225..0f1a704 100644 --- a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/THWSupportItem.java +++ b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/THWSupportItem.java @@ -378,4 +378,9 @@ public class THWSupportItem extends DetailViewItem { } } } + + @Override + public boolean checkValue() { + return true; + } } diff --git a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TNFCItem.java b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TNFCItem.java index 2c03f84..28be3b8 100644 --- a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TNFCItem.java +++ b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TNFCItem.java @@ -197,4 +197,9 @@ public class TNFCItem extends DetailViewItem { return true; } + @Override + public boolean checkValue() { + return true; + } + } diff --git a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TNameTextItem.java b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TNameTextItem.java index 99ddba2..5b7b2f2 100644 --- a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TNameTextItem.java +++ b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TNameTextItem.java @@ -111,7 +111,7 @@ public class TNameTextItem extends DetailViewItem { data.left = new FormAttachment(0, TITLE_LEFT_GAP); data.top = new FormAttachment(0, TITLE_TOP_GAP); data.height = TITLE_HEIGHT; - data.width = TITLE_WIDTH; + data.width = 100; subTitleLabel.setLayoutData(data); subTitleLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor()); subTitleLabel.addPaintListener(new PaintListener() { @@ -476,5 +476,10 @@ public class TNameTextItem extends DetailViewItem { return true; } + + @Override + public boolean checkValue() { + return true; + } } diff --git a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TRAMItem.java b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TRAMItem.java index eee6efd..377683d 100644 --- a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TRAMItem.java +++ b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TRAMItem.java @@ -168,4 +168,9 @@ public class TRAMItem extends DetailViewItem { public void settingStatus(boolean isRefresh) { // TODO Auto-generated method stub } + + @Override + public boolean checkValue() { + return true; + } } diff --git a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TSupportSuspendItem.java b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TSupportSuspendItem.java index ed823b6..3893498 100644 --- a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TSupportSuspendItem.java +++ b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TSupportSuspendItem.java @@ -148,4 +148,8 @@ public class TSupportSuspendItem extends DetailViewItem { value.isSupportSuspend = newSupport; } + @Override + public boolean checkValue() { + return true; + } } diff --git a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TTouchPointItem.java b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TTouchPointItem.java index cf7bb34..5c3c559 100644 --- a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TTouchPointItem.java +++ b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/ui/detail/TTouchPointItem.java @@ -103,4 +103,9 @@ public class TTouchPointItem extends DetailViewItem { public void settingStatus(boolean isRefresh) { // TODO Auto-generated method stub } + + @Override + public boolean checkValue() { + return true; + } } diff --git a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/vms/Launcher.java b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/vms/Launcher.java index 6971cc8..e66f287 100644 --- a/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/vms/Launcher.java +++ b/plugin-project/mobile-plugin/src/org/tizen/emulator/manager/mobile/vms/Launcher.java @@ -55,6 +55,7 @@ import org.tizen.emulator.manager.vms.VMProperty; import org.tizen.emulator.manager.vms.helper.CheckingRunningEmulator; import org.tizen.emulator.manager.vms.helper.MonitoringEmulator; import org.tizen.emulator.manager.vms.helper.VMLauncherException; +import org.tizen.emulator.manager.vms.xml.OptionType; import org.tizen.emulator.manager.vms.xml.TouchType; public class Launcher implements ILauncher { @@ -62,6 +63,31 @@ public class Launcher implements ILauncher { private String binPath = null; private static Launcher launcher; + + // Option names in vm_config.xml + // Add if need. + public static final String OPT_DEVICE = "device"; + public static final String OPT_NFC = "nfc"; + public static final String OPT_BATTERY = "battery"; + public static final String OPT_CAMERA = "camera"; + public static final String OPT_HWKEY = "hwkey"; + public static final String OPT_SWAP = "swap"; + public static final String OPT_CODEC = "codec"; + + public static final String OPT_JACK = "jack"; + public static final String OPT_EARJACK = "earjack"; + public static final String OPT_USB = "usb"; + public static final String OPT_CHARGER = "charger"; + + public static final String OPT_SENSOR = "sensor"; + public static final String OPT_ACCEL = "accel"; + public static final String OPT_GYRO = "gyro"; + public static final String OPT_GEO = "geo"; + public static final String OPT_LIGHT = "light"; + public static final String OPT_PROXI = "proxi"; + public static final String OPT_HAPTIC = "haptic"; + public static final String OPT_ROTATION = "rot"; + public static Launcher getInstance() { if (launcher == null) { launcher = new Launcher(); @@ -73,6 +99,7 @@ public class Launcher implements ILauncher { isConsole = EmulatorManager.isConsoleMode(); } + @Override public List getLaunchCommand(VMProperty property, String path) throws VMLauncherException { String binary; @@ -225,7 +252,8 @@ public class Launcher implements ILauncher { cmd.add("user,dhcpstart=10.0.2.16"); cmd.add("-rtc"); cmd.add("base=utc"); - if (property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage() != null) { + if (property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage() != null + && checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_SWAP))) { cmd.add("-drive"); cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage().getValue() + ",if=virtio,index=2"); } @@ -271,33 +299,39 @@ public class Launcher implements ILauncher { cmd.add("-device"); cmd.add("virtio-evdi-pci"); - // for sensor (enabled accel, geo, gyro, light and proxi) - cmd.add("-device"); - cmd.add("virtio-sensor-pci,sensors=accel&geo&gyro&light&proxi&haptic&rot"); - - // for battery + // for brightness cmd.add("-device"); - cmd.add("virtio-power-pci"); + cmd.add("maru-brightness"); - // for jacks (enabled charger, earjack and usb) - cmd.add("-device"); - cmd.add("virtio-jack-pci,jacks=earjack&charger&usb"); + // for hardware key + if (checkOnOff(property.getPropertyValue().getAdvancedOptionValue(OPT_HWKEY))) { + cmd.add("-device"); + cmd.add("virtio-hwkey-pci"); + } - // for nfc - String nfcValue = property.getPropertyValue().getExtendedOptionVal(TNFCItem.OPTION_NFC); - if (nfcValue.equals(TNFCItem.NFC_ON)) { + // for codec + if (checkOnOff(property.getPropertyValue().getAdvancedOptionValue(OPT_CODEC))) { cmd.add("-device"); - cmd.add("virtio-nfc-pci"); + cmd.add("codec-pci"); } - cmd.add("-device"); - cmd.add("codec-pci"); + // for nfc +// if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_NFC))) { +// cmd.add("-device"); +// cmd.add("virtio-nfc-pci"); +// } - cmd.add("-device"); - cmd.add("maru-brightness"); + // for battery + if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_BATTERY))) { + cmd.add("-device"); + cmd.add("virtio-power-pci"); + } - cmd.add("-device"); - cmd.add("maru-camera"); + // for camera + if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_CAMERA))) { + cmd.add("-device"); + cmd.add("maru-camera"); + } cmd.add("-device"); TouchType touchType = property.getConfiguration().getDevice().getTouch(); @@ -306,6 +340,99 @@ public class Launcher implements ILauncher { } else { cmd.add("virtio-touchscreen-pci"); } + + // for sensor (enabled accel, geo, gyro, light, haptic, rot) + OptionType sensor = property.getPropertyValue().getAdvancedOption(OPT_SENSOR); + if (sensor != null) { + cmd.add("-device"); + + StringBuilder sb = new StringBuilder(); + if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_ACCEL))) { + if(!sb.toString().isEmpty()) { + sb.append("&"); + } + sb.append("accel"); + } + if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_GEO))) { + if(!sb.toString().isEmpty()) { + sb.append("&"); + } + sb.append("geo"); + } + if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_GYRO))) { + if(!sb.toString().isEmpty()) { + sb.append("&"); + } + sb.append("gyro"); + } + if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_LIGHT))) { + if(!sb.toString().isEmpty()) { + sb.append("&"); + } + sb.append("light"); + } + if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_PROXI))) { + if(!sb.toString().isEmpty()) { + sb.append("&"); + } + sb.append("proxi"); + } + if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_HAPTIC))) { + if(!sb.toString().isEmpty()) { + sb.append("&"); + } + sb.append("haptic"); + } + if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_ROTATION))) { + if(!sb.toString().isEmpty()) { + sb.append("&"); + } + sb.append("rot"); + } + + if (sb.toString().isEmpty()) { + cmd.add("virtio-sensor-pci"); + } else { + sb.insert(0, "virtio-sensor-pci,sensors="); + cmd.add(sb.toString()); + } + } + + // for jacks (enabled charger, earjack and usb) + // for sensor (enabled accel, geo, gyro, light and proxi) + OptionType jacks = property.getPropertyValue().getAdvancedOption(OPT_JACK); + if (jacks != null) { + cmd.add("-device"); + + StringBuilder sb = new StringBuilder(); + if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_JACK, OPT_EARJACK))) { + if(!sb.toString().isEmpty()) { + sb.append("&"); + } + sb.append("earjack"); + } + if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_JACK, OPT_CHARGER))) { + if(!sb.toString().isEmpty()) { + sb.append("&"); + } + sb.append("charger"); + } + if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_JACK, OPT_USB))) { + if(!sb.toString().isEmpty()) { + sb.append("&"); + } + sb.append("usb"); + } + + if (sb.toString().isEmpty()) { + cmd.add("virtio-jack-pci"); + } else { + sb.insert(0, "virtio-jack-pci,jacks="); + cmd.add(sb.toString()); + } + } + + } /* append user added options if exists */ @@ -410,4 +537,18 @@ public class Launcher implements ILauncher { return process; } + + private boolean checkOnOff(String value) { + if (value.toLowerCase().equals("on")) { + return true; + } else if (value.toLowerCase().equals("off")) { + return false; + } else if (value.isEmpty()){ + return true; + } else { + return false; + } + } + + } diff --git a/template/standard.xml b/template/standard.xml deleted file mode 100644 index 9dee199..0000000 --- a/template/standard.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - NONE - - - true - true - - - - - 480 - 800 - - 207 - - - 512 - - - - on - diff --git a/template/x86-kiran-template.xml b/template/x86-kiran-template.xml new file mode 100644 index 0000000..48bf67c --- /dev/null +++ b/template/x86-kiran-template.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/template/x86-kiran.xml b/template/x86-kiran.xml new file mode 100644 index 0000000..2d5b7d4 --- /dev/null +++ b/template/x86-kiran.xml @@ -0,0 +1,50 @@ + + + + + + + + NONE + + + true + true + + + + + 480 + 800 + + 207 + + + 512 + + + + + + + + + diff --git a/template/x86-standard-template.xml b/template/x86-standard-template.xml new file mode 100644 index 0000000..c48ab7a --- /dev/null +++ b/template/x86-standard-template.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/template/x86-standard.xml b/template/x86-standard.xml new file mode 100644 index 0000000..e1ea352 --- /dev/null +++ b/template/x86-standard.xml @@ -0,0 +1,48 @@ + + + + + + + + NONE + + + true + true + + + + + 720 + 1280 + + 316 + + + 512 + + + + + + + + -- 2.7.4