From: GiWoong Kim Date: Thu, 11 Sep 2014 05:18:54 +0000 (+0900) Subject: menu: added proxy arguments for ECP X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~247 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3d2b8e4dadc1cbbca535ed101109297242b176b2;p=sdk%2Femulator%2Fqemu.git menu: added proxy arguments for ECP Location page needs host proxy information for browsing map. Change-Id: I6342b5660f4ff49ce3ed7087385cb31aa869b4eb Signed-off-by: GiWoong Kim Signed-off-by: Munkyu Im --- diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index 3dacc5f588..f09c992159 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -310,7 +310,7 @@ char* get_emul_vm_name(void) /* emualtor http proxy */ void set_emul_http_proxy_addr(char *addr) { - strcpy(_emul_info.http_proxy_addr, addr); + strncpy(_emul_info.http_proxy_addr, addr, strlen(addr)); } char* get_emul_http_proxy_addr(void) @@ -320,7 +320,7 @@ char* get_emul_http_proxy_addr(void) void set_emul_http_proxy_port(char *port) { - strcpy(_emul_info.http_proxy_port, port); + strncpy(_emul_info.http_proxy_port, port, strlen(port)); } char* get_emul_http_proxy_port(void) diff --git a/tizen/src/emul_state.h b/tizen/src/emul_state.h index 1c4fdc3e5d..740ff93bc8 100644 --- a/tizen/src/emul_state.h +++ b/tizen/src/emul_state.h @@ -36,8 +36,8 @@ #include "maru_common.h" #include "maru_finger.h" -#define MAX_ADDR_LEN 128 -#define MAX_PORT_LEN 6 +#define MAX_ADDR_LEN 256 +#define MAX_PORT_LEN 256 enum { RESET = 0, diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index fa7c841f6f..5f47faddb5 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -301,11 +301,20 @@ static void prepare_basic_features(gchar * const kernel_cmdline) get_emul_resolution_width(), get_emul_resolution_height()); if(strlen(http_proxy) > 0) { - gchar** proxy = g_strsplit(http_proxy, ":", 2); + gchar** proxy; + if(g_str_has_prefix(http_proxy, HTTP_PREFIX)) { + char buf_proxy[MAXLEN] = {0,}; + remove_string(http_proxy, buf_proxy, HTTP_PREFIX); + proxy = g_strsplit(buf_proxy, ":", -1); + } else { + proxy = g_strsplit(http_proxy, ":", -1); + } INFO("http_proxy address: %s, port: %s\n", proxy[0], proxy[1]); set_emul_http_proxy_addr(proxy[0]); set_emul_http_proxy_port(proxy[1]); - g_strfreev(proxy); + if(proxy != NULL) { + g_strfreev(proxy); + } } g_strlcat(kernel_cmdline, tmp_str, LEN_MARU_KERNEL_CMDLINE); diff --git a/tizen/src/osutil-darwin.c b/tizen/src/osutil-darwin.c index d5edfe5c78..759aa197e0 100644 --- a/tizen/src/osutil-darwin.c +++ b/tizen/src/osutil-darwin.c @@ -454,8 +454,16 @@ int remove_sdcard_lock_os(char *sdcard) perror("file unlock error "); return ERR_UNLCK; } - unlink(lock_file); + + if (unlink(lock_file) < 0) { + perror("unlink error "); + return ERR_UNLCK; + } + + if (remove(lock_file) < 0) { + perror("remove error "); + return ERR_UNLCK; + } INFO("unlock success: %s\n", lock_file); return ERR_SUCCESS; } - diff --git a/tizen/src/osutil-linux.c b/tizen/src/osutil-linux.c index e00fcecd21..653d5860a8 100644 --- a/tizen/src/osutil-linux.c +++ b/tizen/src/osutil-linux.c @@ -212,7 +212,16 @@ int remove_sdcard_lock_os(char *sdcard) perror("file unlock error "); return ERR_UNLCK; } - unlink(lock_file); + + if (unlink(lock_file) < 0) { + perror("unlink error "); + return ERR_UNLCK; + } + + if (remove(lock_file) < 0) { + perror("remove error "); + return ERR_UNLCK; + } INFO("unlock success: %s\n", lock_file); return ERR_SUCCESS; } diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java index 9c35db4483..9a8aa996c8 100755 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java @@ -117,16 +117,10 @@ import org.tizen.emulator.skin.util.SwtUtil; */ public class EmulatorSkin { public enum SkinBasicColor { - BLUE(0, 174, 239), - YELLOW(246, 226, 0), - LIME(0, 246, 12), - VIOLET(168, 43, 255), - ORANGE(246, 110, 0), - MAGENTA(245, 48, 233), - PURPLE(94, 73, 255), - GREEN(179, 246, 0), - RED(245, 48, 48), - CYON(29, 223, 221); + BLUE(0, 174, 239), YELLOW(246, 226, 0), LIME(0, 246, 12), VIOLET(168, + 43, 255), ORANGE(246, 110, 0), MAGENTA(245, 48, 233), PURPLE( + 94, 73, 255), GREEN(179, 246, 0), RED(245, 48, 48), CYON(29, + 223, 221); private int channelRed; private int channelGreen; @@ -143,8 +137,8 @@ public class EmulatorSkin { } } - private static Logger logger = - SkinLogger.getSkinLogger(EmulatorSkin.class).getLogger(); + private static Logger logger = SkinLogger.getSkinLogger(EmulatorSkin.class) + .getLogger(); public EmulatorConfig config; protected Shell shell; @@ -189,8 +183,10 @@ public class EmulatorSkin { /** * @brief constructor - * @param config : configuration of emulator skin - * @param isOnTop : always on top flag + * @param config + * : configuration of emulator skin + * @param isOnTop + * : always on top flag */ protected EmulatorSkin(EmulatorConfig config, SkinInformation skinInfo, int displayCanvasStyle, boolean isOnTop) { @@ -238,7 +234,8 @@ public class EmulatorSkin { int red = rand.nextInt(255); int green = rand.nextInt(255); int blue = rand.nextInt(255); - this.colorVM = new Color(shell.getDisplay(), new RGB(red, green, blue)); + this.colorVM = new Color(shell.getDisplay(), new RGB(red, green, + blue)); } else { int vmIndex = (portNumber % 100) / 10; @@ -260,8 +257,10 @@ public class EmulatorSkin { imageRegistry = ImageRegistry.getInstance(); /* set emulator states */ - currentState.setCurrentResolutionWidth(config.getValidResolutionWidth()); - currentState.setCurrentResolutionHeight(config.getValidResolutionHeight()); + currentState + .setCurrentResolutionWidth(config.getValidResolutionWidth()); + currentState.setCurrentResolutionHeight(config + .getValidResolutionHeight()); currentState.setCurrentScale(config.getValidScale()); currentState.setCurrentRotationId(); @@ -279,7 +278,7 @@ public class EmulatorSkin { lcdCanvas = skinComposer.compose(displayCanvasStyle); /* */ - //TODO: move + // TODO: move if (config.getArgBoolean(ArgsConstants.INPUT_MOUSE, false) == true) { prev_x = lcdCanvas.getSize().x / 2; prev_y = lcdCanvas.getSize().y / 2; @@ -376,9 +375,10 @@ public class EmulatorSkin { shellGrabPosition.y = y; if (SwtUtil.isWindowsPlatform() == true) { - final BooleanData dataGrabbing = new BooleanData( - true, SendCommand.SEND_SKIN_GRABBED.toString()); - communicator.sendToQEMU(SendCommand.SEND_SKIN_GRABBED, dataGrabbing, false); + final BooleanData dataGrabbing = new BooleanData(true, + SendCommand.SEND_SKIN_GRABBED.toString()); + communicator.sendToQEMU(SendCommand.SEND_SKIN_GRABBED, + dataGrabbing, false); } } @@ -387,9 +387,10 @@ public class EmulatorSkin { shellGrabPosition.y = -1; if (SwtUtil.isWindowsPlatform() == true) { - final BooleanData dataGrabbing = new BooleanData( - false, SendCommand.SEND_SKIN_GRABBED.toString()); - communicator.sendToQEMU(SendCommand.SEND_SKIN_GRABBED, dataGrabbing, false); + final BooleanData dataGrabbing = new BooleanData(false, + SendCommand.SEND_SKIN_GRABBED.toString()); + communicator.sendToQEMU(SendCommand.SEND_SKIN_GRABBED, + dataGrabbing, false); } } @@ -425,11 +426,9 @@ public class EmulatorSkin { } /* save config only for emulator close */ - config.setSkinProperty( - SkinPropertiesConstants.WINDOW_X, + config.setSkinProperty(SkinPropertiesConstants.WINDOW_X, shell.getLocation().x); - config.setSkinProperty( - SkinPropertiesConstants.WINDOW_Y, + config.setSkinProperty(SkinPropertiesConstants.WINDOW_Y, shell.getLocation().y); config.setSkinProperty( SkinPropertiesConstants.WINDOW_SCALE, @@ -482,21 +481,26 @@ public class EmulatorSkin { skinFinalize(); } else { - /* Skin have to be alive until receiving shutdown request from qemu */ + /* + * Skin have to be alive until receiving shutdown request + * from qemu + */ event.doit = false; if (pressedKeyEventList.isEmpty() == true && demanderFlag.compareAndSet(false, true)) { if (null != communicator) { - communicator.sendToQEMU( - SendCommand.SEND_CLOSE_REQ, null, false); + communicator.sendToQEMU(SendCommand.SEND_CLOSE_REQ, + null, false); } /* block for a while */ try { - /* In Close emulation, - * 1000ms parameter was used for sleep function. - * So, we need a bigger value than that.*/ + /* + * In Close emulation, 1000ms parameter was used for + * sleep function. So, we need a bigger value than + * that. + */ new Timer().schedule(new TimerTask() { @Override public void run() { @@ -947,16 +951,13 @@ public class EmulatorSkin { @Override public void keyReleased(KeyEvent e) { if (logger.isLoggable(Level.INFO)) { - String character = - (e.character == '\0') ? "\\0" : - (e.character == '\n') ? "\\n" : - (e.character == '\r') ? "\\r" : - ("" + e.character); - - logger.info("'" + character + "':" - + e.keyCode + ":" - + e.stateMask + ":" - + e.keyLocation); + String character = (e.character == '\0') ? "\\0" + : (e.character == '\n') ? "\\n" + : (e.character == '\r') ? "\\r" + : ("" + e.character); + + logger.info("'" + character + "':" + e.keyCode + ":" + + e.stateMask + ":" + e.keyLocation); } else if (logger.isLoggable(Level.FINE)) { logger.fine(e.toString()); } @@ -979,7 +980,8 @@ public class EmulatorSkin { KeyEventType.RELEASED.value(), disappearKeycode, disappearStateMask, disappearKeyLocation); - communicator.sendToQEMU(SendCommand.SEND_KEYBOARD_KEY_EVENT, + communicator.sendToQEMU( + SendCommand.SEND_KEYBOARD_KEY_EVENT, keyEventData, false); removePressedKeyFromList(keyEventData); @@ -994,34 +996,38 @@ public class EmulatorSkin { KeyEventData keyEventData = null; /* separate a merged release event */ - if (previous.keyCode == SWT.CR && - (keyCode & SWT.KEYCODE_BIT) != 0 && e.character == SWT.CR) { - logger.info("send upon release : keycode=" + (int)SWT.CR); + if (previous.keyCode == SWT.CR + && (keyCode & SWT.KEYCODE_BIT) != 0 + && e.character == SWT.CR) { + logger.info("send upon release : keycode=" + + (int) SWT.CR); keyEventData = new KeyEventData( - KeyEventType.RELEASED.value(), - SWT.CR, 0, 0); - } else if (previous.keyCode == SWT.SPACE && - (keyCode & SWT.KEYCODE_BIT) != 0 && - (e.character == SWT.SPACE)) { - logger.info("send upon release : keycode=" + (int)SWT.SPACE); + KeyEventType.RELEASED.value(), SWT.CR, 0, 0); + } else if (previous.keyCode == SWT.SPACE + && (keyCode & SWT.KEYCODE_BIT) != 0 + && (e.character == SWT.SPACE)) { + logger.info("send upon release : keycode=" + + (int) SWT.SPACE); keyEventData = new KeyEventData( - KeyEventType.RELEASED.value(), - SWT.SPACE, 0, 0); - } else if (previous.keyCode == SWT.TAB && - (keyCode & SWT.KEYCODE_BIT) != 0 && - (e.character == SWT.TAB)) { - logger.info("send upon release : keycode=" + (int)SWT.TAB); + KeyEventType.RELEASED.value(), SWT.SPACE, + 0, 0); + } else if (previous.keyCode == SWT.TAB + && (keyCode & SWT.KEYCODE_BIT) != 0 + && (e.character == SWT.TAB)) { + logger.info("send upon release : keycode=" + + (int) SWT.TAB); keyEventData = new KeyEventData( - KeyEventType.RELEASED.value(), - SWT.TAB, 0, 0); - } else if (previous.keyCode == SWT.KEYPAD_CR && - (keyCode & SWT.KEYCODE_BIT) != 0 && - (e.character == SWT.CR) && - (keyCode != SWT.KEYPAD_CR)) { - logger.info("send upon release : keycode=" + (int)SWT.KEYPAD_CR); + KeyEventType.RELEASED.value(), SWT.TAB, 0, + 0); + } else if (previous.keyCode == SWT.KEYPAD_CR + && (keyCode & SWT.KEYCODE_BIT) != 0 + && (e.character == SWT.CR) + && (keyCode != SWT.KEYPAD_CR)) { + logger.info("send upon release : keycode=" + + (int) SWT.KEYPAD_CR); keyEventData = new KeyEventData( KeyEventType.RELEASED.value(), @@ -1029,7 +1035,8 @@ public class EmulatorSkin { } if (keyEventData != null) { - communicator.sendToQEMU(SendCommand.SEND_KEYBOARD_KEY_EVENT, + communicator.sendToQEMU( + SendCommand.SEND_KEYBOARD_KEY_EVENT, keyEventData, false); removePressedKeyFromList(keyEventData); } @@ -1062,8 +1069,10 @@ public class EmulatorSkin { disappearStateMask = stateMask; disappearKeyLocation = e.keyLocation; } else { - /* three or more keys were pressed at the - * same time */ + /* + * three or more keys were pressed at the same + * time + */ if (disappearEvent == true) { logger.info("replace the disappearEvent : " + disappearKeycode + "->" + keyCode); @@ -1077,11 +1086,10 @@ public class EmulatorSkin { int previousStateMask = previous.stateMask; if (logger.isLoggable(Level.INFO)) { - String character = - (previous.character == '\0') ? "\\0" : - (previous.character == '\n') ? "\\n" : - (previous.character == '\r') ? "\\r" : - ("" + previous.character); + String character = (previous.character == '\0') ? "\\0" + : (previous.character == '\n') ? "\\n" + : (previous.character == '\r') ? "\\r" + : ("" + previous.character); logger.info("send previous release : '" + character + "':" @@ -1109,16 +1117,13 @@ public class EmulatorSkin { } /* end isWindowsPlatform */ if (logger.isLoggable(Level.INFO)) { - String character = - (e.character == '\0') ? "\\0" : - (e.character == '\n') ? "\\n" : - (e.character == '\r') ? "\\r" : - ("" + e.character); - - logger.info("'" + character + "':" - + e.keyCode + ":" - + e.stateMask + ":" - + e.keyLocation); + String character = (e.character == '\0') ? "\\0" + : (e.character == '\n') ? "\\n" + : (e.character == '\r') ? "\\r" + : ("" + e.character); + + logger.info("'" + character + "':" + e.keyCode + ":" + + e.stateMask + ":" + e.keyLocation); } else if (logger.isLoggable(Level.FINE)) { logger.fine(e.toString()); } @@ -1141,11 +1146,11 @@ public class EmulatorSkin { currentState.getCurrentRotationId()); MouseEventData mouseEventData = new MouseEventData( - MouseButtonType.LEFT.value(), eventType, - e.x, e.y, geometry[0], geometry[1], 0); + MouseButtonType.LEFT.value(), eventType, e.x, e.y, geometry[0], + geometry[1], 0); - communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT, - mouseEventData, false); + communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT, mouseEventData, + false); } protected void mouseUpDelivery(MouseEvent e) { @@ -1154,15 +1159,15 @@ public class EmulatorSkin { currentState.getCurrentResolutionHeight(), currentState.getCurrentScale(), currentState.getCurrentRotationId()); - logger.info("mouseUp in display" + - " x:" + geometry[0] + " y:" + geometry[1]); + logger.info("mouseUp in display" + " x:" + geometry[0] + " y:" + + geometry[1]); MouseEventData mouseEventData = new MouseEventData( MouseButtonType.LEFT.value(), MouseEventType.RELEASE.value(), e.x, e.y, geometry[0], geometry[1], 0); - communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT, - mouseEventData, false); + communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT, mouseEventData, + false); } protected void mouseDownDelivery(MouseEvent e) { @@ -1171,35 +1176,35 @@ public class EmulatorSkin { currentState.getCurrentResolutionHeight(), currentState.getCurrentScale(), currentState.getCurrentRotationId()); - logger.info("mouseDown in display" + - " x:" + geometry[0] + " y:" + geometry[1]); + logger.info("mouseDown in display" + " x:" + geometry[0] + " y:" + + geometry[1]); MouseEventData mouseEventData = new MouseEventData( MouseButtonType.LEFT.value(), MouseEventType.PRESS.value(), e.x, e.y, geometry[0], geometry[1], 0); - communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT, - mouseEventData, false); + communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT, mouseEventData, + false); } - protected void keyReleasedDelivery(int keyCode, - int stateMask, int keyLocation, boolean remove) { + protected void keyReleasedDelivery(int keyCode, int stateMask, + int keyLocation, boolean remove) { KeyEventData keyEventData = new KeyEventData( KeyEventType.RELEASED.value(), keyCode, stateMask, keyLocation); - communicator.sendToQEMU( - SendCommand.SEND_KEYBOARD_KEY_EVENT, keyEventData, false); + communicator.sendToQEMU(SendCommand.SEND_KEYBOARD_KEY_EVENT, + keyEventData, false); if (remove == true) { removePressedKeyFromList(keyEventData); } } - protected void keyPressedDelivery(int keyCode, - int stateMask, int keyLocation, boolean add) { + protected void keyPressedDelivery(int keyCode, int stateMask, + int keyLocation, boolean add) { KeyEventData keyEventData = new KeyEventData( KeyEventType.PRESSED.value(), keyCode, stateMask, keyLocation); - communicator.sendToQEMU( - SendCommand.SEND_KEYBOARD_KEY_EVENT, keyEventData, false); + communicator.sendToQEMU(SendCommand.SEND_KEYBOARD_KEY_EVENT, + keyEventData, false); if (add == true) { addPressedKeyToList(keyEventData); @@ -1271,8 +1276,7 @@ public class EmulatorSkin { } protected void rearrangeSkin() { - skinComposer.arrangeSkin( - currentState.getCurrentScale(), + skinComposer.arrangeSkin(currentState.getCurrentScale(), currentState.getCurrentRotationId()); } @@ -1296,17 +1300,14 @@ public class EmulatorSkin { if (rotationId == SkinRotations.LANDSCAPE_ID) { /* landscape */ - displayTransform.translate( - lcdCanvas.getSize().y * -1, 0); + displayTransform.translate(lcdCanvas.getSize().y * -1, 0); } else if (rotationId == SkinRotations.REVERSE_PORTRAIT_ID) { /* reverse-portrait */ - displayTransform.translate( - lcdCanvas.getSize().x * -1, + displayTransform.translate(lcdCanvas.getSize().x * -1, lcdCanvas.getSize().y * -1); } else if (rotationId == SkinRotations.REVERSE_LANDSCAPE_ID) { /* reverse-landscape */ - displayTransform.translate( - 0, lcdCanvas.getSize().x * -1); + displayTransform.translate(0, lcdCanvas.getSize().x * -1); } } @@ -1378,12 +1379,11 @@ public class EmulatorSkin { if (isDisplayDragging == true) { logger.info("auto release : mouseEvent"); - MouseEventData mouseEventData = new MouseEventData( - 0, MouseEventType.RELEASE.value(), - 0, 0, 0, 0, 0); + MouseEventData mouseEventData = new MouseEventData(0, + MouseEventType.RELEASE.value(), 0, 0, 0, 0, 0); - communicator.sendToQEMU( - SendCommand.SEND_MOUSE_EVENT, mouseEventData, false); + communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT, + mouseEventData, false); } } @@ -1396,8 +1396,8 @@ public class EmulatorSkin { logger.fine("Open detail info"); } - DetailInfoDialog detailInfoDialog = new DetailInfoDialog( - shell, communicator, config, skinInfo); + DetailInfoDialog detailInfoDialog = new DetailInfoDialog(shell, + communicator, config, skinInfo); detailInfoDialog.open(); } }; @@ -1434,8 +1434,8 @@ public class EmulatorSkin { final List rotationList = new ArrayList(); - Iterator> iterator = - SkinRotations.getRotationIterator(); + Iterator> iterator = SkinRotations + .getRotationIterator(); while (iterator.hasNext()) { Entry entry = iterator.next(); @@ -1454,26 +1454,30 @@ public class EmulatorSkin { } /* temp : swap rotation menu names */ - if (currentState.getCurrentResolutionWidth() > - currentState.getCurrentResolutionHeight()) { + if (currentState.getCurrentResolutionWidth() > currentState + .getCurrentResolutionHeight()) { for (MenuItem m : rotationList) { short rotationId = (Short) m.getData(); if (rotationId == SkinRotations.PORTRAIT_ID) { - String landscape = SkinRotations.getRotation( - SkinRotations.LANDSCAPE_ID).getName().value(); + String landscape = SkinRotations + .getRotation(SkinRotations.LANDSCAPE_ID).getName() + .value(); m.setText(landscape); } else if (rotationId == SkinRotations.LANDSCAPE_ID) { - String portrait = SkinRotations.getRotation( - SkinRotations.PORTRAIT_ID).getName().value(); + String portrait = SkinRotations + .getRotation(SkinRotations.PORTRAIT_ID).getName() + .value(); m.setText(portrait); } else if (rotationId == SkinRotations.REVERSE_PORTRAIT_ID) { - String landscapeReverse = SkinRotations.getRotation( - SkinRotations.REVERSE_LANDSCAPE_ID).getName().value(); + String landscapeReverse = SkinRotations + .getRotation(SkinRotations.REVERSE_LANDSCAPE_ID) + .getName().value(); m.setText(landscapeReverse); } else if (rotationId == SkinRotations.REVERSE_LANDSCAPE_ID) { - String portraitReverse = SkinRotations.getRotation( - SkinRotations.REVERSE_PORTRAIT_ID).getName().value(); + String portraitReverse = SkinRotations + .getRotation(SkinRotations.REVERSE_PORTRAIT_ID) + .getName().value(); m.setText(portraitReverse); } } @@ -1500,7 +1504,8 @@ public class EmulatorSkin { currentState.getCurrentScale(), rotationId); /* location correction */ - Rectangle monitorBounds = Display.getDefault().getBounds(); + Rectangle monitorBounds = Display.getDefault() + .getBounds(); Rectangle emulatorBounds = shell.getBounds(); shell.setLocation( Math.max(emulatorBounds.x, monitorBounds.x), @@ -1537,7 +1542,7 @@ public class EmulatorSkin { return; } - final int scale = (Integer)item.getData(); /* percentage */ + final int scale = (Integer) item.getData(); /* percentage */ shell.getDisplay().syncExec(new Runnable() { @Override @@ -1546,7 +1551,8 @@ public class EmulatorSkin { currentState.getCurrentRotationId()); /* location correction */ - Rectangle monitorBounds = Display.getDefault().getBounds(); + Rectangle monitorBounds = Display.getDefault() + .getBounds(); Rectangle emulatorBounds = shell.getBounds(); shell.setLocation( Math.max(emulatorBounds.x, monitorBounds.x), @@ -1575,11 +1581,14 @@ public class EmulatorSkin { boolean on = item.equals(popupMenu.interpolationHighItem); isOnInterpolation = on; - logger.info("Select scale interpolation : " + isOnInterpolation); + logger.info("Select scale interpolation : " + + isOnInterpolation); - communicator.sendToQEMU(SendCommand.SEND_INTERPOLATION_STATE, - new BooleanData(on, SendCommand.SEND_INTERPOLATION_STATE.toString()), - false); + communicator.sendToQEMU( + SendCommand.SEND_INTERPOLATION_STATE, + new BooleanData(on, + SendCommand.SEND_INTERPOLATION_STATE + .toString()), false); } } }; @@ -1598,12 +1607,14 @@ public class EmulatorSkin { MenuItem layoutSelected = (MenuItem) e.widget; if (layoutSelected.getSelection() == true) { - for (MenuItem layout : layoutSelected.getParent().getItems()) { + for (MenuItem layout : layoutSelected.getParent() + .getItems()) { if (layout != layoutSelected) { /* uncheck other menu items */ layout.setSelection(false); } else { - int layoutIndex = getKeyWindowKeeper().getLayoutIndex(); + int layoutIndex = getKeyWindowKeeper() + .getLayoutIndex(); if (getKeyWindowKeeper().determineLayout() != layoutIndex) { /* switch */ getKeyWindowKeeper().closeKeyWindow(); @@ -1619,13 +1630,15 @@ public class EmulatorSkin { if (getKeyWindowKeeper().getKeyWindow() == null) { if (getKeyWindowKeeper().getRecentlyDocked() != SWT.NONE) { getKeyWindowKeeper().openKeyWindow( - getKeyWindowKeeper().getRecentlyDocked(), false); + getKeyWindowKeeper().getRecentlyDocked(), + false); getKeyWindowKeeper().setRecentlyDocked(SWT.NONE); } else { /* opening for first time */ getKeyWindowKeeper().openKeyWindow( - KeyWindowKeeper.DEFAULT_DOCK_POSITION, false); + KeyWindowKeeper.DEFAULT_DOCK_POSITION, + false); } } else { getKeyWindowKeeper().openKeyWindow( @@ -1690,16 +1703,17 @@ public class EmulatorSkin { @Override public void widgetSelected(SelectionEvent e) { // TODO: - /* if (!communicator.isSensorDaemonStarted()) { - SkinUtil.openMessage(shell, null, - "Host Keyboard is not ready.\n" - + "Please wait until the emulator is completely boot up.", - SWT.ICON_WARNING, config); - popupMenu.hostKbdOnItem.setSelection(isOnKbd); - popupMenu.hostKbdOffItem.setSelection(!isOnKbd); - - return; - } */ + /* + * if (!communicator.isSensorDaemonStarted()) { + * SkinUtil.openMessage(shell, null, + * "Host Keyboard is not ready.\n" + + * "Please wait until the emulator is completely boot up.", + * SWT.ICON_WARNING, config); + * popupMenu.hostKbdOnItem.setSelection(isOnKbd); + * popupMenu.hostKbdOffItem.setSelection(!isOnKbd); + * + * return; } + */ MenuItem item = (MenuItem) e.getSource(); if (item.getSelection()) { @@ -1708,8 +1722,10 @@ public class EmulatorSkin { logger.info("Select host keyboard : " + isOnKbd); - communicator.sendToQEMU(SendCommand.SEND_HOST_KBD_STATE, - new BooleanData(on, SendCommand.SEND_HOST_KBD_STATE.toString()), false); + communicator.sendToQEMU( + SendCommand.SEND_HOST_KBD_STATE, + new BooleanData(on, SendCommand.SEND_HOST_KBD_STATE + .toString()), false); } } }; @@ -1723,7 +1739,8 @@ public class EmulatorSkin { public void widgetSelected(SelectionEvent e) { logger.info("Open the about dialog"); - AboutDialog dialog = new AboutDialog(shell, config, imageRegistry); + AboutDialog dialog = new AboutDialog(shell, config, + imageRegistry); dialog.open(); } }; @@ -1771,7 +1788,9 @@ public class EmulatorSkin { if (communicator.isSdbDaemonStarted() == false) { logger.warning("SDB is not ready."); - SkinUtil.openMessage(shell, null, + SkinUtil.openMessage( + shell, + null, "SDB is not ready.\n" + "Please wait until the emulator is completely boot up.", SWT.ICON_WARNING, config); @@ -1782,7 +1801,8 @@ public class EmulatorSkin { File sdbFile = new File(sdbPath); if (sdbFile.exists() == false) { - logger.info("SDB file does not exist : " + sdbFile.getAbsolutePath()); + logger.info("SDB file does not exist : " + + sdbFile.getAbsolutePath()); try { SkinUtil.openMessage(shell, null, @@ -1805,12 +1825,14 @@ public class EmulatorSkin { "-s", "emulator-" + portSdb, "shell"); } else if (SwtUtil.isMacPlatform()) { procSdb.command("./sdbscript", "emulator-" + portSdb); - /* procSdb.command( "/usr/X11/bin/uxterm", "-T", - "emulator-" + portSdb, "-e", sdbPath,"shell"); */ + /* + * procSdb.command( "/usr/X11/bin/uxterm", "-T", "emulator-" + * + portSdb, "-e", sdbPath,"shell"); + */ } else { /* Linux */ - procSdb.command("/usr/bin/gnome-terminal", - "--title=" + SkinUtil.makeEmulatorName(config), - "-x", sdbPath, "-s", "emulator-" + portSdb, "shell"); + procSdb.command("/usr/bin/gnome-terminal", "--title=" + + SkinUtil.makeEmulatorName(config), "-x", sdbPath, + "-s", "emulator-" + portSdb, "shell"); } logger.info(procSdb.command().toString()); @@ -1819,12 +1841,12 @@ public class EmulatorSkin { procSdb.start(); /* open the sdb shell */ } catch (Exception ee) { logger.log(Level.SEVERE, ee.getMessage(), ee); - SkinUtil.openMessage(shell, null, - "Fail to open Shell : \n" + ee.getMessage(), - SWT.ICON_ERROR, config); + SkinUtil.openMessage(shell, null, "Fail to open Shell : \n" + + ee.getMessage(), SWT.ICON_ERROR, config); } - communicator.sendToQEMU(SendCommand.SEND_OPEN_SHELL, null, false); + communicator.sendToQEMU(SendCommand.SEND_OPEN_SHELL, null, + false); } }; @@ -1857,21 +1879,46 @@ public class EmulatorSkin { } String emulName = SkinUtil.getVmName(config); - int portSdb = config.getArgInt(ArgsConstants.VM_BASE_PORT); + int basePort = config.getArgInt(ArgsConstants.VM_BASE_PORT); + String proxyAddr = config.getArg(ArgsConstants.PROXY_ADDR); + String proxyPort = config.getArg(ArgsConstants.PROXY_PORT); ProcessBuilder procEcp = new ProcessBuilder(); procEcp.redirectErrorStream(true); // FIXME: appropriate running binary setting is necessary. if (SwtUtil.isWindowsPlatform()) { - procEcp.command("java.exe", "-jar", ecpPath, "vmname=" - + emulName, "base.port=" + portSdb); + if (proxyAddr != null && proxyPort != null) { + procEcp.command("java.exe", "-Dhttp.proxyHost=" + + proxyAddr, "-Dhttp.proxyPort=" + proxyPort, + "-jar", ecpPath, "vmname=" + emulName, + "base.port=" + basePort); + } else { + procEcp.command("java.exe", "-jar", ecpPath, "vmname=" + + emulName, "base.port=" + basePort); + } } else if (SwtUtil.isMacPlatform()) { - procEcp.command("java", "-jar", "-XstartOnFirstThread", - ecpPath, "vmname=" + emulName, "base.port=" - + portSdb); + if (proxyAddr != null && proxyPort != null) { + procEcp.command("java", + "-Dhttp.proxyHost=" + proxyAddr, + "-Dhttp.proxyPort=" + proxyPort, "-jar", + "-XstartOnFirstThread", ecpPath, "vmname=" + + emulName, "base.port=" + basePort); + } else { + procEcp.command("java", "-jar", "-XstartOnFirstThread", + ecpPath, "vmname=" + emulName, "base.port=" + + basePort); + } } else { /* Linux */ - procEcp.command("java", "-jar", ecpPath, "vmname=" - + emulName, "base.port=" + portSdb); + if (proxyAddr != null && proxyPort != null) { + procEcp.command("java", + "-Dhttp.proxyHost=" + proxyAddr, + "-Dhttp.proxyPort=" + proxyPort, "-jar", + ecpPath, "vmname=" + emulName, "base.port=" + + basePort); + } else { + procEcp.command("java", "-jar", ecpPath, "vmname=" + + emulName, "base.port=" + basePort); + } } logger.info(procEcp.command().toString()); @@ -1919,7 +1966,8 @@ public class EmulatorSkin { public void widgetSelected(SelectionEvent e) { logger.info("Close menu is selected"); - communicator.sendToQEMU(SendCommand.SEND_CLOSE_REQ, null, false); + communicator + .sendToQEMU(SendCommand.SEND_CLOSE_REQ, null, false); } }; @@ -1959,12 +2007,12 @@ public class EmulatorSkin { } } - keyReleasedDelivery(data.keycode, - data.stateMask, data.keyLocation, false); + keyReleasedDelivery(data.keycode, data.stateMask, + data.keyLocation, false); logger.info("auto release : keycode=" + data.keycode - + ", stateMask=" + data.stateMask - + ", keyLocation=" + data.keyLocation); + + ", stateMask=" + data.stateMask + ", keyLocation=" + + data.keyLocation); } } diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java index fbdb821c3b..e8830a0e94 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java @@ -81,6 +81,8 @@ public class EmulatorConfig { public static final String INPUT_MOUSE = "input.mouse"; public static final String INPUT_TOUCHSCREEN = "input.touch"; public static final String INPUT_TOUCH_MAXPOINT = "input.touch.maxpoint"; + public static final String PROXY_ADDR = "proxy.addr"; + public static final String PROXY_PORT = "proxy.port"; } public interface SkinPropertiesConstants { diff --git a/tizen/src/skin/maruskin_client.c b/tizen/src/skin/maruskin_client.c index 1a236cfa08..a1c29ff65b 100644 --- a/tizen/src/skin/maruskin_client.c +++ b/tizen/src/skin/maruskin_client.c @@ -67,6 +67,8 @@ MULTI_DEBUG_CHANNEL(qemu, skin_client); #define OPT_INPUT_MOUSE "input.mouse" #define OPT_INPUT_TOUCH "input.touch" #define OPT_MAX_TOUCHPOINT "input.touch.maxpoint" +#define OPT_PROXY_ADDR "proxy.addr" +#define OPT_PROXY_PORT "proxy.port" #define OPT_BOOLEAN_TRUE "true" #define OPT_BOOLEAN_FALSE "false" @@ -104,9 +106,9 @@ static void *run_skin_client(void *arg) int skin_server_port = get_skin_server_port(); int vm_base_port = get_emul_vm_base_port(); - char buf_skin_server_port[16]; - char buf_uid[16]; - char buf_vm_base_port[16]; + char buf_skin_server_port[16] = { 0, }; + char buf_uid[16] = { 0, }; + char buf_vm_base_port[16] = { 0, }; sprintf(buf_skin_server_port, "%d", skin_server_port); sprintf(buf_uid, "%d", uid); sprintf(buf_vm_base_port, "%d", vm_base_port); @@ -121,10 +123,17 @@ static void *run_skin_client(void *arg) /* input */ char buf_input[12] = { 0, }; - if (is_emul_input_mouse_enable() == true) + if (is_emul_input_mouse_enable() == true) { strcpy(buf_input, OPT_INPUT_MOUSE); - else + } else { strcpy(buf_input, OPT_INPUT_TOUCH); + } + + /* network */ + char buf_proxy_addr[MAX_ADDR_LEN] = { 0, }; + char buf_proxy_port[MAX_PORT_LEN] = { 0, }; + sprintf(buf_proxy_addr, "%s", get_emul_http_proxy_addr()); + sprintf(buf_proxy_port, "%s", get_emul_http_proxy_port()); #ifdef CONFIG_WIN32 /* find java path in 64bit windows */ @@ -182,7 +191,11 @@ static void *run_skin_client(void *arg) strlen(buf_input) + EQUAL_LEN + strlen(OPT_BOOLEAN_TRUE) + SPACE_LEN + strlen(OPT_MAX_TOUCHPOINT) + EQUAL_LEN + - len_maxtouchpoint + SPACE_LEN + 1 + + len_maxtouchpoint + SPACE_LEN + + strlen(OPT_PROXY_ADDR) + EQUAL_LEN + + strlen(buf_proxy_addr) + SPACE_LEN + + strlen(OPT_PROXY_PORT) + EQUAL_LEN + + strlen(buf_proxy_port) + SPACE_LEN + 1 + strlen(argv); INFO("skin command length : %d\n", cmd_len); @@ -202,6 +215,8 @@ static void *run_skin_client(void *arg) %s=%s \ %s=%s \ %s=%d \ +%s=%s \ +%s=%s \ %s", JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAVA_LIBRARY_PATH, #ifdef CONFIG_WIN32 @@ -216,6 +231,8 @@ static void *run_skin_client(void *arg) OPT_DISPLAY_SHM, buf_display_shm, buf_input, OPT_BOOLEAN_TRUE, OPT_MAX_TOUCHPOINT, maxtouchpoint, + OPT_PROXY_ADDR, buf_proxy_addr, + OPT_PROXY_PORT, buf_proxy_port, argv); INFO("command for swt : %s\n", cmd);