SETTING: optimize getPlatformName for device
authorgreatim <jaewon81.lim@samsung.com>
Tue, 7 Oct 2014 08:50:44 +0000 (17:50 +0900)
committergreatim <jaewon81.lim@samsung.com>
Tue, 7 Oct 2014 08:50:44 +0000 (17:50 +0900)
optimize getPlatformName for device (only one time)

Change-Id: I35c3fd87a11bba08bc2902bc03cabb20453ba7a3
Signed-off-by: greatim <jaewon81.lim@samsung.com>
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/DeviceInfo.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDataManager.java

index c616412..4fa51f4 100644 (file)
@@ -31,6 +31,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
+import org.tizen.common.core.application.ProfileInfo;
 import org.tizen.dynamicanalyzer.common.HostResult;
 import org.tizen.dynamicanalyzer.communicator.BaseCommunicator;
 import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
@@ -53,6 +54,8 @@ public class DeviceInfo {
 
        private DeviceStatusInfo statusInfo = null;
 
+       private String platformName = null;
+
        /*** for version 3.0 */
        private int remotePort = -1;
        private Socket controlSock = null;
@@ -153,6 +156,19 @@ public class DeviceInfo {
                return pkgInfoHash.get(pkgId);
        }
 
+       public String getPlatformName() {
+               if (platformName == null) {
+                       platformName = ProfileInfo.getPlatformName(device); // mobile-2.3
+                       // device.getPlatformInfo().getProfileName(); // mobile
+                       
+                       if (platformName == null) {
+                               platformName = CommonConstants.EMPTY;
+                       }
+               }
+
+               return platformName;
+       }
+
        public boolean isEmulator() {
                if (device != null) {
                        if (device.getSerialNumber().contains(CommonConstants.EMULATOR)) {
index 4bfdbd4..d4498df 100644 (file)
@@ -40,7 +40,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.tizen.common.core.application.ProfileInfo;
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.common.path.PathManager;
@@ -50,7 +49,6 @@ import org.tizen.dynamicanalyzer.model.DeviceInfo;
 import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
 import org.tizen.dynamicanalyzer.util.CommonUtil;
 import org.tizen.dynamicanalyzer.util.Logger;
-import org.tizen.sdblib.IDevice;
 
 public class SettingDataManager {
 
@@ -334,10 +332,8 @@ public class SettingDataManager {
                DeviceInfo currentDevice = Global.getCurrentDeviceInfo();
 
                if (currentDevice != null) {
-                       IDevice device = currentDevice.getIDevice();
-                       String profileName = ProfileInfo.getPlatformName(device); // mobile-2.3
-                       // device.getPlatformInfo().getProfileName(); // mobile
-                       
+                       String profileName = currentDevice.getPlatformName();
+
                        if (profileName != null && !(profileName.isEmpty())) {
                                if (isTarget(profileName)) {
                                        return map.get(profileName);