From 6006f3dfe03941b41544d6de3ccab13de8461197 Mon Sep 17 00:00:00 2001 From: Munkyu Im Date: Fri, 11 Dec 2015 18:24:13 +0900 Subject: [PATCH] net: support bridge network for Windows 10 OS Because Windows 8 and above need manual bridge network, the way to detect OS supported is changed. environment veriable "os.version" is used for it. Change-Id: Iba36478572a434e869a4933dbe6e5a5484508dca Signed-off-by: Munkyu Im --- src/org/tizen/emulator/manager/EmulatorManager.java | 16 +++++++++++----- src/org/tizen/emulator/manager/tool/TapUtil.java | 6 +++--- .../manager/ui/dialog/TapDeviceDialogForWin.java | 4 ++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/org/tizen/emulator/manager/EmulatorManager.java b/src/org/tizen/emulator/manager/EmulatorManager.java index 40a884b..7d056fa 100755 --- a/src/org/tizen/emulator/manager/EmulatorManager.java +++ b/src/org/tizen/emulator/manager/EmulatorManager.java @@ -76,7 +76,7 @@ public class EmulatorManager { private static RandomAccessFile randomAccessFile; private static boolean isMac = false; private static boolean isWin = false; - private static boolean isWin8 = false; + private static boolean isWin8AndAbove = false; private static boolean isLinux = false; static { @@ -84,8 +84,14 @@ public class EmulatorManager { isLinux = true; } else if (System.getProperty("os.name").toLowerCase().indexOf("win") > -1) { //$NON-NLS-1$ //$NON-NLS-2$ isWin = true; - if (System.getProperty("os.name").startsWith("Windows 8")) { //$NON-NLS-1$ //$NON-NLS-2$ - isWin8 = true; + try { + /*The version of Windows8 is 6.2 */ + if (Float.parseFloat(System.getProperty("os.version")) >= 6.2) { //$NON-NLS-1$ //$NON-NLS-2$ + isWin8AndAbove = true; + } + } catch (NumberFormatException e) { + EMLogger.getLogger().warning(e.getMessage()); + isWin8AndAbove = false; } } else if (System.getProperty("os.name").toLowerCase().indexOf("mac") > -1) { //$NON-NLS-1$ //$NON-NLS-2$ isMac = true; @@ -130,8 +136,8 @@ public class EmulatorManager { return isWin; } - public static boolean isWin8() { - return isWin8; + public static boolean isWin8AndAbove() { + return isWin8AndAbove; } public static boolean isLinux() { diff --git a/src/org/tizen/emulator/manager/tool/TapUtil.java b/src/org/tizen/emulator/manager/tool/TapUtil.java index 9c30a80..657b247 100644 --- a/src/org/tizen/emulator/manager/tool/TapUtil.java +++ b/src/org/tizen/emulator/manager/tool/TapUtil.java @@ -389,7 +389,7 @@ public class TapUtil { } } EMLogger.getLogger().warning("found tapid: " + foundTapId); //$NON-NLS-1$ - if (EmulatorManager.isWin8()) { + if (EmulatorManager.isWin8AndAbove()) { topKey = "SYSTEM\\CurrentControlSet\\services\\NdisImPlatform\\Linkage"; //$NON-NLS-1$ } else { topKey = "SYSTEM\\CurrentControlSet\\services\\Bridge\\Linkage"; //$NON-NLS-1$ @@ -1378,7 +1378,7 @@ public class TapUtil { List cmd; ProcessResult res; try { - if (!EmulatorManager.isWin8()) { + if (!EmulatorManager.isWin8AndAbove()) { EMLogger.getLogger().info( "get CompatibleIDs from pci network device"); //$NON-NLS-1$ cmd = Arrays.asList(getDevconPath(platformVersion), "find", "=net", //$NON-NLS-1$ //$NON-NLS-2$ @@ -1476,7 +1476,7 @@ public class TapUtil { } } - if (!EmulatorManager.isWin8()) { + if (!EmulatorManager.isWin8AndAbove()) { EMLogger.getLogger().info("bind host network to bridge"); //$NON-NLS-1$ String tapPnpInstanceID = getPnpInstanceIDFromName(tapName); diff --git a/src/org/tizen/emulator/manager/ui/dialog/TapDeviceDialogForWin.java b/src/org/tizen/emulator/manager/ui/dialog/TapDeviceDialogForWin.java index 14f49d0..c667452 100644 --- a/src/org/tizen/emulator/manager/ui/dialog/TapDeviceDialogForWin.java +++ b/src/org/tizen/emulator/manager/ui/dialog/TapDeviceDialogForWin.java @@ -184,7 +184,7 @@ public class TapDeviceDialogForWin { nameText.setLayoutData(data); nameText.setEnabled(false); nameText.setText(TapUtil.getAvailableTapName()); - if (!EmulatorManager.isWin8()) { + if (!EmulatorManager.isWin8AndAbove()) { // interface (combo select) Label ifLabel = new Label(upperComp, SWT.NONE); ifLabel.setFont(FontResources.DETAIL_TITLE_FONT.getFont()); @@ -288,7 +288,7 @@ public class TapDeviceDialogForWin { // Check Tap duplication // if (TapUtil.nameNotExist(nameText.getText())) { tapName = nameText.getText(); - if (!EmulatorManager.isWin8()) { + if (!EmulatorManager.isWin8AndAbove()) { ifName = combo.getText(); } dialog.close(); -- 2.7.4