From ad09d0d21f4c16cc5df4da7d24870e17b92b32ed Mon Sep 17 00:00:00 2001 From: Nirothipan Date: Tue, 20 Jun 2017 20:30:12 +0530 Subject: [PATCH] adding constants --- .../Constants.java | 34 +++++++++++++++---- .../TryItEmulator.java | 15 ++------ 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/src/main/java/org.carbon.android.emulator/Constants.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/src/main/java/org.carbon.android.emulator/Constants.java index c3ccaabb9..278b0d9d7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/src/main/java/org.carbon.android.emulator/Constants.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/src/main/java/org.carbon.android.emulator/Constants.java @@ -18,6 +18,8 @@ package org.carbon.android.emulator; +import java.io.File; + /** * This class has the constant strings used and the system properties. */ @@ -26,14 +28,34 @@ class Constants { static final String USER_HOME_PROPERTY = "user.home"; static final String USER_DIRECTORY_PROPERTY = "user.dir"; static final String MAC_OS = "macosx"; + static final String MAC = "mac"; static final String WINDOWS_OS = "windows"; static final String WINDOWS_EXTENSION_EXE = ".exe"; static final String WINDOWS_EXTENSION_BAT = ".bat"; static final String NAME = "name="; - static final String SDK_TOOLS_URL = "sdk_tools_url"; - static final String PLATFORM_TOOLS_URL = "platform_tools_url"; - static final String BUILD_TOOL_URL = "build_tools_url"; - static final String PLATFORM_URL = "platform_url"; - static final String SYSTEM_IMAGE_URL = "sys_img_url"; - static final String HAXM_URL = "haxm_url"; + + static final String SDK_TOOLS_URL = "sdk.tools.url"; + static final String PLATFORM_TOOLS_URL = "platform.tools.url"; + static final String BUILD_TOOL_URL = "build.tools.url"; + static final String PLATFORM_URL = "platform.url"; + static final String SYSTEM_IMAGE_URL = "sys.img.url"; + static final String HAXM_URL = "haxm.url"; + + static final String DOWNLOADED_BUILD_TOOL_NAME = "downloaded.build.tool.name"; //"android-7.1.1"; + static final String BUILD_TOOLS_VERSION = "build.tool.version"; //"25.0.2"; + static final String DOWNLOADED_PLATFORM_NAME = "downloaded.platform.name"; //"android-6.0"; + static final String TARGET_VERSION = "target.version"; //"android-23"; + static final String OS_TARGET = "os.target";//"x86"; + + + static final String WSO2_AVD_NAME = "WSO2_AVD"; + static final String APK_LOCATION = File.separator + "resources" + File.separator + "android-agent.apk"; + static final String WSO2_CONFIG_LOCATION = File.separator + "resources" + File.separator + "config.ini"; + + static final String MAC_HAXM_EXTENSION = ".sh"; + static final String MAC_DARWIN = "darwin"; + +// class AndroidCommands{ +// static final String LIST_AVD = "-list-avds"; +// } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/src/main/java/org.carbon.android.emulator/TryItEmulator.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/src/main/java/org.carbon.android.emulator/TryItEmulator.java index a86f533cc..3dedf50a9 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/src/main/java/org.carbon.android.emulator/TryItEmulator.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/src/main/java/org.carbon.android.emulator/TryItEmulator.java @@ -58,21 +58,12 @@ public class TryItEmulator implements Runnable { System.out.println("Error in starting " + deviceId); e.printStackTrace(); } finally { - if (reader != null) { try { - reader.close(); + if (reader != null) reader.close(); + if (writer != null) writer.close(); } catch (IOException ignored) { - // reader close exception ignored - } + // } - if (writer != null) { - try { - writer.close(); - } catch (IOException ignored) { - // writer close exception ignored - } - } - } } }