package org.tizen.dynamicanalyzer.common;
-import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.model.DeviceInfo;
import org.tizen.dynamicanalyzer.project.AppInfo;
+import org.tizen.dynamicanalyzer.project.PackageInfo;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.util.Logger;
DeviceInfo device = DACommunicator.getDeviceByName(deviceName);
GlobalInformation.setCurrentDeviceInfo(device);
- List<AppInfo> appList = device.getAppInfoList();
-
- AppInfo appInfo = null;
- for (int i = 0; i < appList.size(); i++) {
- if (appid.equals(appList.get(i).getInfo(AppInfo.PROPERTY.PACKAGE.index))) {
- appInfo = appList.get(i);
- break;
- }
- }
-
- if (null == appInfo) {
+ PackageInfo pkgInfo = DACommunicator.getPkgInfoByPkgId(appid);
+ if (null == pkgInfo) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
Logger.debug("invalid application name :" + appid);
return;
}
- final String appLabel = appInfo.getInfo(AppInfo.PROPERTY.LABEL.index);
+ final String appLabel = pkgInfo.getMainApp().getInfo(AppInfo.PROPERTY.LABEL.index);
Logger.debug("IDE recv - deviceName: " + deviceName
+ " appName : " + appLabel);
package org.tizen.dynamicanalyzer.common;
import org.tizen.dynamicanalyzer.model.DeviceInfo;
-import org.tizen.dynamicanalyzer.project.AppInfo;
+import org.tizen.dynamicanalyzer.project.PackageInfo;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.swap.channel.control.RunTimeConfiguration;
// So this class contains only static methods and variables.
public class GlobalInformation {
private static DeviceInfo currentDevice = null;
- private static AppInfo currentApplication = null;
+ private static PackageInfo currentApplication = null;
private static Project currentProject = null;
private static RunTimeConfiguration currentConfiguration = null;
currentProject = project;
}
- public static AppInfo getCurrentApplication() {
+ public static PackageInfo getCurrentApplication() {
return currentApplication;
}
- public static void setCurrentApplication(AppInfo appInfo) {
- currentApplication = appInfo;
+ public static void setCurrentApplication(PackageInfo pkgInfo) {
+ currentApplication = pkgInfo;
}
public static RunTimeConfiguration getCurrentConfiguration() {
import org.tizen.dynamicanalyzer.common.HostResult;
import org.tizen.dynamicanalyzer.model.DeviceInfo;
-import org.tizen.dynamicanalyzer.project.AppInfo;
+import org.tizen.dynamicanalyzer.project.PackageInfo;
public abstract class BaseCommunicator {
public abstract void closeSock();
- public void onAppSelected(AppInfo app) {
+ public void onAppSelected(PackageInfo pkg) {
}
}
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.model.DeviceInfo;
import org.tizen.dynamicanalyzer.project.AppInfo;
+import org.tizen.dynamicanalyzer.project.PackageInfo;
import org.tizen.dynamicanalyzer.swap.channel.control.EventObject;
import org.tizen.dynamicanalyzer.swap.channel.control.ReplayEvent;
import org.tizen.dynamicanalyzer.swap.logparser.DataManagerRegistry;
isEmul = 1;
}
- AppInfo app = GlobalInformation.getCurrentApplication();
- if (null == app) {
+ PackageInfo pkg = GlobalInformation.getCurrentApplication();
+ if (null == pkg) {
return HostResult.ERR_SELECTED_APP_IS_NULL;
}
String rearMessage = CommonConstants.EMPTY + res + isEmul + isArm
+ CommonConstants.CMD_SPLIT
+ ConfigureManager.getInstance().getConfiguration(device)
+ CommonConstants.CMD_SPLIT
- + app.getInfo(AppInfo.PROPERTY.EXEC.index);
+ + pkg.getMainApp().getInfo(AppInfo.PROPERTY.EXEC.index);
String message = AnalyzerConstants.MSG_START
+ CommonConstants.CMD_SPLIT + rearMessage.length()
import java.io.File;
import java.net.Socket;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
private static List<DeviceInfo> devices = null;
private static List<String> filterMultiLines = new ArrayList<String>();
- private static List<String> unittestList = new ArrayList<String>();
- private static List<String> imeList = new ArrayList<String>();
private static List<String> uploadDataResult = new ArrayList<String>();
private static List<String> checkVersionResult = new ArrayList<String>();
cmdResultMultiLines.clear();
filterMultiLines.clear();
uploadDataResult.clear();
- unittestList.clear();
}
public static List<DeviceInfo> getDevices() {
return devNameList;
}
- public static List<AppInfo> getAppListFromTarget() {
- if (null == GlobalInformation.getCurrentDeviceInfo()) {
+ public static Map<String, PackageInfo> getAppListFromTarget() {
+ DeviceInfo curDev = GlobalInformation.getCurrentDeviceInfo();
+ if (curDev == null) {
return null;
}
- List<AppInfo> appInfoList = GlobalInformation.getCurrentDeviceInfo()
- .getAppInfoList();
- HashMap<String, AppInfo> appInfoHash = GlobalInformation.getCurrentDeviceInfo()
- .getAppInfoHash();
- List<AppInfo> backList = new ArrayList<AppInfo>();
- backList.addAll(appInfoHash.values());
cmdResultMultiLines.clear();
+ CommunicatorUtils.execHostCommand(AnalyzerShellCommands.DACOMMAND_FIND_UNITTEST,
+ new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] appLines) {
+ for (int i = 0; i < appLines.length; i++) {
+ filterMultiLines.add(appLines[i]);
+ }
+ }
+ });
+
+ curDev.parseUnittestList(cmdResultMultiLines);
+ cmdResultMultiLines.clear();
+ CommunicatorUtils.execShellCommand(AnalyzerShellCommands.DACOMMAND_FIND_IME,
+ new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] appLines) {
+ for (int i = 0; i < appLines.length; i++) {
+ filterMultiLines.add(appLines[i]);
+ }
+ }
+ });
+
+ curDev.parseImeList(cmdResultMultiLines);
+
+ cmdResultMultiLines.clear();
CommunicatorUtils.execShellCommand(AnalyzerShellCommands.CMD_APPLICATION_LIST,
new MultiLineReceiver() {
@Override
});
cmdResultMultiLines.add("");
- checkUnittest();
- checkIME();
-
// add lines for running process
cmdResultMultiLines.add(AppInfo.PROPERTY.APPID.name + ":"
+ AnalyzerConstants.RUNNING_PROCESS);
+ AnalyzerConstants.RUNNING_PROCESS);
cmdResultMultiLines.add(AppInfo.PROPERTY.LABEL.name + ":"
+ AnalyzerConstants.RUNNING_PROCESS);
- cmdResultMultiLines.add(AppInfo.PROPERTY.APPTYPE.name + ":"
- + AppInfo.APPTYPE_RUNNING);
+ cmdResultMultiLines.add(AppInfo.PROPERTY.APPTYPE.name + ":" + AppInfo.APPTYPE_RUNNING);
cmdResultMultiLines.add("");
// add lines for without-executable
+ AnalyzerConstants.COMMON_EXECUTABLE);
cmdResultMultiLines.add(AppInfo.PROPERTY.LABEL.name + ":"
+ AnalyzerConstants.COMMON_EXECUTABLE);
- cmdResultMultiLines.add(AppInfo.PROPERTY.APPTYPE.name + ":"
- + AppInfo.APPTYPE_EXEC);
+ cmdResultMultiLines.add(AppInfo.PROPERTY.APPTYPE.name + ":" + AppInfo.APPTYPE_EXEC);
cmdResultMultiLines.add("");
// add lines for without-executable
+ AnalyzerConstants.WITHOUT_EXECUTABLE);
cmdResultMultiLines.add(AppInfo.PROPERTY.LABEL.name + ":"
+ AnalyzerConstants.WITHOUT_EXECUTABLE);
- cmdResultMultiLines.add(AppInfo.PROPERTY.APPTYPE.name + ":"
- + AppInfo.APPTYPE_NONE);
+ cmdResultMultiLines.add(AppInfo.PROPERTY.APPTYPE.name + ":" + AppInfo.APPTYPE_NONE);
cmdResultMultiLines.add("");
- int size = cmdResultMultiLines.size();
+ curDev.parseAppList(cmdResultMultiLines);
- for (int i = 0; i < size; i++) {
- String line = cmdResultMultiLines.get(i);
- if (line.startsWith("Appid")) {
- List<String> lines = new ArrayList<String>();
- int ii;
- for (ii = 0; ii + i < size; ii++) {
- String inputLine = cmdResultMultiLines.get(ii + i);
- if (inputLine.isEmpty()) {
- continue;
- } else if (ii != 0 && inputLine.startsWith("Appid")) {
- break;
- }
- lines.add(cmdResultMultiLines.get(ii + i));
- }
- i += ii - 1;
-
- AppInfo appInfo = makePackageInfo(
- GlobalInformation.getCurrentDeviceInfo(), lines);
- if (null != appInfo) {
- // && appInfo.getInfo(AppInfo.MULTIPLE_INDEX).equals(
- // AppInfo.FLAG_ZERO)
- // && appInfo.getInfo(AppInfo.NODISPLAY_INDEX).equals(
- // AppInfo.FLAG_ZERO)) {
- String pkgId = appInfo.getInfo(AppInfo.PROPERTY.PACKAGE.index);
- String appId = appInfo.getInfo(AppInfo.PROPERTY.APPID.index);
-
- if (null == appInfoHash.get(appId)) {
- if (!isUnittest(pkgId) && !isIME(appId)) {
- appInfoList.add(appInfo);
- appInfoHash.put(appId, appInfo);
- }
- } else {
- backList.remove(appInfoHash.get(appId));
- }
- }
- }
- }
- if (!backList.isEmpty()) {
- for (AppInfo app : backList) {
- String appId = app.getInfo(AppInfo.PROPERTY.APPID.index);
- appInfoList.remove(app);
- appInfoHash.remove(appId);
- }
- }
-
- return appInfoList;
+ return curDev.getPackageInfoHash();
}
public static Map<Integer, String> getProcessListFromTarget() {
return processMap;
}
- private static boolean isUnittest(String pkgId) {
- if (null != unittestList && !unittestList.isEmpty()) {
- for (String id : unittestList) {
- if (id.equals(pkgId)) {
- return true;
- }
- }
- }
- return false;
- }
-
- private static boolean isIME(String appId) {
- if (null != imeList && !imeList.isEmpty()) {
- for (String id : imeList) {
- if (id.equals(appId)) {
- return true;
- }
- }
- }
- return false;
- }
-
- private static void checkUnittest() {
- unittestList.clear();
- if (null == GlobalInformation.getCurrentDeviceInfo()) {
- return;
- }
- String appInstallPath = GlobalInformation.getCurrentDeviceInfo().getIDevice()
- .getAppInstallPath();
-
- filterMultiLines.clear();
- CommunicatorUtils.execHostCommand(AnalyzerShellCommands.DACOMMAND_FIND_UNITTEST,
- new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] appLines) {
- for (int i = 0; i < appLines.length; i++) {
- filterMultiLines.add(appLines[i]);
- }
- }
- });
-
- if (filterMultiLines.isEmpty()) {
- return;
- }
-
- for (String line : filterMultiLines) {
- if (line.contains(appInstallPath)) {
- line = line.replaceFirst(appInstallPath + CommonConstants.SLASH,
- CommonConstants.EMPTY);
- int index = line.indexOf(CommonConstants.SLASH);
- line = line.substring(0, index);
- unittestList.add(line);
- }
- }
- }
-
- private static void checkIME() {
- imeList.clear();
- if (null == GlobalInformation.getCurrentDeviceInfo()) {
- return;
- }
+ public static PackageInfo getPkgInfoByLabel(String appLabel) {
+ DeviceInfo curDev = GlobalInformation.getCurrentDeviceInfo();
+ if (null != curDev) {
+ Map<String, PackageInfo> pkgHash = curDev.getPackageInfoHash();
- filterMultiLines.clear();
- CommunicatorUtils.execShellCommand(AnalyzerShellCommands.DACOMMAND_FIND_IME,
- new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] appLines) {
- for (int i = 0; i < appLines.length; i++) {
- filterMultiLines.add(appLines[i]);
- }
- }
- });
-
- if (filterMultiLines.isEmpty()) {
- return;
- }
-
- for (String line : filterMultiLines) {
- String appId = "appid";//$NON-NLS-1$
- if (line.contains("apptype") && line.contains("c++app")) {
- line = line.trim();
- int index = line.indexOf(appId);
- // 2 means length of String " ["
- line = line.substring(index + appId.length() + 2, line.length() - 1);
- imeList.add(line);
- }
- }
- }
-
- private static AppInfo makePackageInfo(DeviceInfo device, List<String> lines) {
- AppInfo appInfo = new AppInfo();
- for (int i = 0; i < lines.size(); i++) {
- String line = lines.get(i);
- int index = line.indexOf(":");
- if (index > 0) {
- String key = line.substring(0, index).trim();
- String data = line.substring(index + 1, line.length()).trim();
-
- AppInfo.PROPERTY p = AppInfo.PROPERTY.get(key);
- if (p != null) {
- appInfo.setInfo(p.index, data);
+ for (Map.Entry<String, PackageInfo> entry : pkgHash.entrySet()) {
+ AppInfo app = entry.getValue().getMainApp();
+ String label = app.getInfo(AppInfo.PROPERTY.LABEL.index);
+ if (appLabel.equals(label)) {
+ return entry.getValue();
}
}
}
- String pkgId = appInfo.getInfo(AppInfo.PROPERTY.PACKAGE.index);
- PackageInfo pkgInfo = device.getPackageInfoHash().get(pkgId);
- if (null == pkgInfo) {
- pkgInfo = new PackageInfo(pkgId);
- pkgInfo.addAppInfo(appInfo);
- device.getPackageInfoHash().put(pkgId, pkgInfo);
- } else {
- pkgInfo.addAppInfo(appInfo);
- }
- return appInfo;
- }
-
- public static AppInfo getPkgInfoByName(String appLabel) {
- if (null != GlobalInformation.getCurrentDeviceInfo()) {
- int size = GlobalInformation.getCurrentDeviceInfo().getAppInfoList().size();
- for (int i = 0; i < size; i++) {
- AppInfo pkgInfo = GlobalInformation.getCurrentDeviceInfo()
- .getAppInfoList().get(i);
- if (pkgInfo.getInfo(AppInfo.PROPERTY.LABEL.index).equals(appLabel)) {
- return pkgInfo;
- }
- }
- }
return null;
}
- public static AppInfo getPkgInfoByAppPkgId(String pkgid) {
+ public static PackageInfo getPkgInfoByPkgId(String pkgid) {
if (null != GlobalInformation.getCurrentDeviceInfo()) {
- int size = GlobalInformation.getCurrentDeviceInfo().getAppInfoList().size();
- for (int i = 0; i < size; i++) {
- AppInfo ai = GlobalInformation.getCurrentDeviceInfo().getAppInfoList()
- .get(i);
- if (ai.getInfo(AppInfo.PROPERTY.PACKAGE.index).equals(pkgid)) {
- return ai;
- }
- }
+ return GlobalInformation.getCurrentDeviceInfo().getPackageInfoHash().get(pkgid);
+ } else {
+ return null;
}
- return null;
}
public static void removeCommand(String path) {
- CommunicatorUtils.execShellCommand(AnalyzerShellCommands.CMD_REMOVE
- + CommonConstants.SPACE + path);
+ CommunicatorUtils.execShellCommand(AnalyzerShellCommands.CMD_REMOVE + CommonConstants.SPACE
+ + path);
}
public static boolean isTargetEmulator() {
}
});
- Logger.debug("device changed : " + device.getSerialNumber() + " "
- + changeMask);
+ Logger.debug("device changed : " + device.getSerialNumber() + " " + changeMask);
if (1 == changeMask) {
if (!AnalyzerManager.isRunning()) {
DeviceInfo devInfo = new DeviceInfo(device);
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
- ToolbarArea.getInstance().setDeviceComboItems(selectedDevice,
- deviceSerials);
+ ToolbarArea.getInstance().setDeviceComboItems(selectedDevice, deviceSerials);
}
});
}
Logger.debug("Failed to get " + from); //$NON-NLS-1$
}
- AnalyzerUtil
- .checkLogs(PathManager.DA_LOG_PATH, DAEMONLOG_PREFIX, DAEMONLOG_COUNT);
+ AnalyzerUtil.checkLogs(PathManager.DA_LOG_PATH, DAEMONLOG_PREFIX, DAEMONLOG_COUNT);
}
// public static String getLocalhost() {
}
public static BufferedReader getSockBufferedReader() {
- return GlobalInformation.getCurrentDeviceInfo().getCommunicator()
- .getDataBufferedReader();
+ return GlobalInformation.getCurrentDeviceInfo().getCommunicator().getDataBufferedReader();
}
public static void closeAll() {
}
public static HostResult handleControlMessage(String msg) {
- return GlobalInformation.getCurrentDeviceInfo().getCommunicator()
- .handleControlMessage(msg);
+ return GlobalInformation.getCurrentDeviceInfo().getCommunicator().handleControlMessage(msg);
}
public static Map<Integer, String> sendProcessAddInfoMessage(List<Integer> pids) {
DeviceInfo dev = GlobalInformation.getCurrentDeviceInfo();
if (dev != null) {
if (isSWAPVersion()) {
- return ((Communicator30) dev.getCommunicator())
- .sendProcessAddInfoMessage(pids);
+ return ((Communicator30) dev.getCommunicator()).sendProcessAddInfoMessage(pids);
}
}
return null;
public static HostResult sendBinaryInfoMessageForLib(List<BinarySettingData> input) {
if (isSWAPVersion()) {
- return ((Communicator30) GlobalInformation.getCurrentDeviceInfo()
- .getCommunicator()).sendBinaryInfoMessageForLib(input);
+ return ((Communicator30) GlobalInformation.getCurrentDeviceInfo().getCommunicator())
+ .sendBinaryInfoMessageForLib(input);
}
return null;
}
public static HostResult sendSWAPMessage(int messageId, List<BinarySettingData> input) {
if (isSWAPVersion()) {
- return ((Communicator30) GlobalInformation.getCurrentDeviceInfo()
- .getCommunicator()).sendSWAPMessage(messageId, input);
+ return ((Communicator30) GlobalInformation.getCurrentDeviceInfo().getCommunicator())
+ .sendSWAPMessage(messageId, input);
}
return null;
}
public static HostResult sendScreenShotMessage() {
if (isSWAPVersion()) {
- return ((Communicator30) GlobalInformation.getCurrentDeviceInfo()
- .getCommunicator()).sendScreenShotRequest();
+ return ((Communicator30) GlobalInformation.getCurrentDeviceInfo().getCommunicator())
+ .sendScreenShotRequest();
}
return null;
}
import org.tizen.dynamicanalyzer.model.DeviceInfo;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.project.AppInfo;
+import org.tizen.dynamicanalyzer.project.PackageInfo;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.util.CommonUtil;
final String deviceName = new String(strMsg[MSG_INDEX_DEVICE].trim());
final String projectType = new String(strMsg[MSG_INDEX_PROJECT_TYPE].trim());
- final String binaryOfTarget = new String(
- strMsg[MSG_INDEX_BINARY_OF_TARGET].trim());
+ final String binaryOfTarget = new String(strMsg[MSG_INDEX_BINARY_OF_TARGET].trim());
final String executablePath = new String(strMsg[MSG_INDEX_EXECUTABLE_PATH].trim());
List<String> localPackagePathList = new ArrayList<String>();
for (int i = MSG_INDEX_LOCAL_PACKAGE_PATH; i < strMsg.length; i++) {
GlobalInformation.setCurrentDeviceInfo(device);
DACommunicator.getAppListFromTarget();
- AppInfo appInfo = null;
+ PackageInfo pkgInfo = null;
if (projectType.equals(PROJECT_TYPE_OSP) || projectType.equals(PROJECT_TYPE_EFL)
|| projectType.equals(PROJECT_TYPE_WEBAPP)) {
- appInfo = DACommunicator.getPkgInfoByAppPkgId(binaryOfTarget);
- if (appInfo == null) {
+ pkgInfo = DACommunicator.getPkgInfoByPkgId(binaryOfTarget);
+ if (pkgInfo == null) {
popupMessageUnsupportedApp(binaryOfTarget);
return;
}
if (localPackagePathList.size() > 0) {
- appInfo.setLocalPackagePath(localPackagePathList);
+ pkgInfo.getMainApp().setLocalPackagePath(localPackagePathList);
}
- final String appLabel = appInfo.getInfo(AppInfo.PROPERTY.LABEL.index);
- Logger.debug("IDE recv - deviceName: " + deviceName + " appName : "
- + appLabel);
+ final String appLabel = pkgInfo.getMainApp().getInfo(AppInfo.PROPERTY.LABEL.index);
+ Logger.debug("IDE recv - deviceName: " + deviceName + " appName : " + appLabel);
Display.getDefault().syncExec(new Runnable() {
public void run() {
for (int i = 0; i < localPackagePathList.size(); i++) {
String path = localPackagePathList.get(i);
- if (path.endsWith(RpmUtil.RPM_EXT)
- && path.contains(RpmUtil.DEBUGINFO)) {
+ if (path.endsWith(RpmUtil.RPM_EXT) && path.contains(RpmUtil.DEBUGINFO)) {
debugrpm = path;
- } else if (path.endsWith(RpmUtil.RPM_EXT)
- && path.contains(RpmUtil.DEBUGSOURCE)) {
+ } else if (path.endsWith(RpmUtil.RPM_EXT) && path.contains(RpmUtil.DEBUGSOURCE)) {
srcrpm = path;
} else if (path.endsWith(RpmUtil.RPM_EXT)) {
mainrpm = path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.HostResult;
public class DeviceInfo {
private IDevice device = null;
- private String selectedApplication = null;
+ private String selectedPackage = null;
private String targetVersion = null;
private BaseCommunicator communicator = null;
private boolean configSuccess = false;
- private List<AppInfo> appInfoList = null;
- private HashMap<String, AppInfo> appInfoHash = null;
- private HashMap<String, PackageInfo> pkgInfoHash = null;
+ private Map<String, PackageInfo> pkgInfoHash = new HashMap<String, PackageInfo>();
+ private List<String> pkgInfoString = new ArrayList<String>();
+
+ private List<String> unittestList = new ArrayList<String>();
+ private List<String> imeList = new ArrayList<String>();
private DeviceStatusInfo statusInfo = null;
public DeviceInfo(IDevice device) {
this.device = device;
- appInfoList = new ArrayList<AppInfo>();
- appInfoHash = new HashMap<String, AppInfo>();
- pkgInfoHash = new HashMap<String, PackageInfo>();
statusInfo = new DeviceStatusInfo(CommunicatorUtils.getApiMap(device));
}
- public void setSelectedAppName(String name) {
- selectedApplication = name;
+ public void setSelectedPackageID(String id) {
+ selectedPackage = id;
}
- public String getSelectedAppName() {
- return selectedApplication;
+ public String getSelectedPackageID() {
+ return selectedPackage;
}
public IDevice getIDevice() {
return device;
}
- public List<AppInfo> getAppInfoList() {
- return appInfoList;
- }
-
- public HashMap<String, AppInfo> getAppInfoHash() {
- return appInfoHash;
- }
-
public void setTargetVersion(String version) {
targetVersion = version;
if (version.contains(AnalyzerConstants.DA_VERSION_SWAP)) {
}
public boolean equals(DeviceInfo target) {
- if (device.getSerialNumber().equals(
- target.getIDevice().getSerialNumber())) {
+ if (device.getSerialNumber().equals(target.getIDevice().getSerialNumber())) {
return true;
}
return false;
return communicator.sendConfigurationMessage(this, type, message);
}
- public HashMap<String, PackageInfo> getPackageInfoHash() {
+ public Map<String, PackageInfo> getPackageInfoHash() {
return pkgInfoHash;
}
public void setConfigSuccess(boolean success) {
configSuccess = success;
}
+
+ public void parseUnittestList(List<String> lines) {
+ unittestList.clear();
+ if (lines.isEmpty()) {
+ return;
+ }
+
+ String appInstallPath = getIDevice().getAppInstallPath();
+
+ for (String line : lines) {
+ if (line.contains(appInstallPath)) {
+ line = line.replaceFirst(appInstallPath + CommonConstants.SLASH,
+ CommonConstants.EMPTY);
+ int index = line.indexOf(CommonConstants.SLASH);
+ line = line.substring(0, index);
+ unittestList.add(line);
+ }
+ }
+ }
+
+ public void parseImeList(List<String> lines) {
+ imeList.clear();
+ if (lines.isEmpty()) {
+ return;
+ }
+
+ for (String line : lines) {
+ String appId = "appid";//$NON-NLS-1$
+ if (line.contains("apptype") && line.contains("c++app")) {
+ line = line.trim();
+ int index = line.indexOf(appId);
+ // 2 means length of String " ["
+ line = line.substring(index + appId.length() + 2, line.length() - 1);
+ imeList.add(line);
+ }
+ }
+ }
+
+ public void parseAppList(List<String> lines) {
+ if (changedAppList(lines)) {
+ pkgInfoString.clear();
+ pkgInfoString.addAll(lines);
+
+ // parsing app list lines
+ pkgInfoHash.clear();
+
+ int size = lines.size();
+
+ for (int i = 0; i < size; i++) {
+ if (lines.get(i).startsWith("Appid")) {
+ List<String> applines = new ArrayList<String>();
+
+ int k;
+ for (k = 0; k + i < size; k++) {
+ String inputLine = lines.get(k + i);
+ if (inputLine.isEmpty()) {
+ continue;
+ } else if (k != 0 && inputLine.startsWith("Appid")) {
+ break;
+ }
+ applines.add(inputLine);
+ }
+ i += k - 1;
+
+ AppInfo appInfo = makeAppInfo(applines);
+
+ String appID = appInfo.getAppId();
+ String pkgID = appInfo.getPackageId();
+
+ if (!isUnittest(pkgID) && !isIME(appID)) {
+ PackageInfo pkgInfo = pkgInfoHash.get(pkgID);
+ if (null == pkgInfo) {
+ pkgInfo = new PackageInfo(pkgID);
+ pkgInfoHash.put(pkgID, pkgInfo);
+ }
+ pkgInfo.addAppInfo(appInfo);
+ }
+ }
+ }
+ }
+ }
+
+ private AppInfo makeAppInfo(List<String> lines) {
+ AppInfo appInfo = new AppInfo();
+ for (int i = 0; i < lines.size(); i++) {
+ String line = lines.get(i);
+ int index = line.indexOf(':');
+ if (index > 0) {
+ String key = line.substring(0, index).trim();
+ String data = line.substring(index + 1, line.length()).trim();
+
+ AppInfo.PROPERTY p = AppInfo.PROPERTY.get(key);
+ if (p != null) {
+ appInfo.setInfo(p.index, data);
+ }
+ }
+ }
+
+ return appInfo;
+ }
+
+ private boolean changedAppList(List<String> strings) {
+ if (pkgInfoString != null) {
+ if (pkgInfoString.size() == strings.size()) {
+ int i;
+ int ssize = pkgInfoString.size();
+ for (i = 0; i < ssize; i++) {
+ if (pkgInfoString.get(i) == null) {
+ if (strings.get(i) != null) {
+ break;
+ }
+ } else if (strings.get(i) == null) {
+ break;
+ } else if (!pkgInfoString.get(i).equals(strings.get(i))) {
+ break;
+ }
+ }
+
+ if (i == ssize)
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private boolean isUnittest(String pkgId) {
+ if (null != unittestList && !unittestList.isEmpty()) {
+ for (String id : unittestList) {
+ if (id.equals(pkgId)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean isIME(String appId) {
+ if (null != imeList && !imeList.isEmpty()) {
+ for (String id : imeList) {
+ if (id.equals(appId)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
}
public List<AppInfo> getAppInfos() {
return appInfos;
}
+
+ // TODO: ensure main app is the first app in package
+ public AppInfo getMainApp() {
+ return appInfos.get(0);
+ }
}
private static final String SECTION_E = "]";
private static final String PRIMITIVE_SECTION = SECTION_F + "Primitive" + SECTION_E;
- private static final String DEVICE_SECTION = SECTION_F + "Device Information"
- + SECTION_E;
- private static final String APP_SECTION = SECTION_F + "Application information"
- + SECTION_E;
+ private static final String DEVICE_SECTION = SECTION_F + "Device Information" + SECTION_E;
+ private static final String APP_SECTION = SECTION_F + "Application information" + SECTION_E;
private static final String VERSION = "version";
private static final String PROTOCOL_VERSION = "protocolVersion";
public void initForTrace() {
if (null == GlobalInformation.getCurrentApplication()) {
String comboText = ToolbarArea.getInstance().getAppCombo().getText();
- AppInfo appInfo = DACommunicator.getPkgInfoByName(comboText);
- GlobalInformation.setCurrentApplication(appInfo);
- GlobalInformation.getCurrentDeviceInfo().getCommunicator()
- .onAppSelected(appInfo);
+ PackageInfo pkgInfo = DACommunicator.getPkgInfoByLabel(comboText);
+ GlobalInformation.setCurrentApplication(pkgInfo);
+ GlobalInformation.getCurrentDeviceInfo().getCommunicator().onAppSelected(pkgInfo);
}
setProtocolVersion(GlobalInformation.getCurrentDeviceInfo().getTargetVersion());
- setDeviceStatusInfo(GlobalInformation.getCurrentDeviceInfo()
- .getDeviceStatusInfo());
- setApplicationInfo(GlobalInformation.getCurrentApplication());
+ setDeviceStatusInfo(GlobalInformation.getCurrentDeviceInfo().getDeviceStatusInfo());
+ setApplicationInfo(GlobalInformation.getCurrentApplication().getMainApp());
RunTimeConfiguration currentConfig = GlobalInformation.getCurrentConfiguration();
if (currentConfig != null) {
addConfigHistory(currentConfig);
}
- setAppName(GlobalInformation.getCurrentApplication().getInfo(
- AppInfo.PROPERTY.LABEL.index));
- setPackageID(GlobalInformation.getCurrentApplication().getInfo(
- AppInfo.PROPERTY.PACKAGE.index));
+ setAppName(GlobalInformation.getCurrentApplication().getMainApp()
+ .getInfo(AppInfo.PROPERTY.LABEL.index));
+ setPackageID(GlobalInformation.getCurrentApplication().getPackageId());
DeviceInfo deviceName = GlobalInformation.getCurrentDeviceInfo();
if (null != deviceName && null != deviceName.getIDevice().getSerialNumber()
&& !deviceName.getIDevice().getSerialNumber().isEmpty()) {
- setDevice(GlobalInformation.getCurrentDeviceInfo().getIDevice()
- .getSerialNumber());
+ setDevice(GlobalInformation.getCurrentDeviceInfo().getIDevice().getSerialNumber());
} else {
setDevice(CommonConstants.SPACE);
}
List<String> functionNames = targetDeviceStatusInfo.getFunctionList();
int size = functionNames.size();
List<List<Object>> insertData = new ArrayList<List<Object>>();
-
- for(int i = 0; i < size; i++) {
+
+ for (int i = 0; i < size; i++) {
List<Object> insertRowData = new ArrayList<Object>();
-
+
try {
insertRowData.add(new Integer(i));
insertRowData.add(new String(functionNames.get(i)));
private BufferedReader getOpenReader(String savePath) {
BufferedReader reader = null;
StringBuffer projectInfoSavedFile = new StringBuffer(savePath);
- projectInfoSavedFile.append(File.separator).append(
- PathConstants.PROJECT_INFO_FILE_NAME);
+ projectInfoSavedFile.append(File.separator).append(PathConstants.PROJECT_INFO_FILE_NAME);
File saveFile = new File(projectInfoSavedFile.toString());
if (saveFile.isFile()) {
List<List<Object>> functionNames = functionNameTable.getFunctionNameFromDB();
if (null == functionNames) {
Logger.error("failed - load function names");
- } else {
+ } else {
int size = functionNames.size();
for (int i = 0; i < size; i++) {
List<Object> functionName = functionNames.get(i);
int id = (Integer) functionName.get(FunctionNameDBTable.COLUMN.FUNCTIONID.index);
- String name = (String) functionName.get(FunctionNameDBTable.COLUMN.FUNCTIONNAME.index);
+ String name = (String) functionName
+ .get(FunctionNameDBTable.COLUMN.FUNCTIONNAME.index);
functionList.add(id, name);
}
}
public String getUserFunctionPosition() {
if (userFunctionBin == null || userFunctionBin.isEmpty()) {
if (AnalyzerManager.isOsp()) {
- userFunctionBin = new String(GlobalInformation.getCurrentApplication()
- .getInfo(AppInfo.PROPERTY.EXEC.index) + ".exe"); //$NON-NLS-1$
+ userFunctionBin = new String(GlobalInformation.getCurrentApplication().getMainApp()
+ .getInfo(AppInfo.PROPERTY.EXEC.index)
+ + ".exe"); //$NON-NLS-1$
} else {
- userFunctionBin = new String(GlobalInformation.getCurrentApplication()
+ userFunctionBin = new String(GlobalInformation.getCurrentApplication().getMainApp()
.getInfo(AppInfo.PROPERTY.EXEC.index));
}
}
if (pmap != null) {
int binaryID = pmap.getMainbinary().getBinaryID();
- return project.getDeviceStatusInfo().getBinaryInfo(binaryID)
- .getTargetBinaryPath();
+ return project.getDeviceStatusInfo().getBinaryInfo(binaryID).getTargetBinaryPath();
} else {
return CommonConstants.EMPTY;
}
if (binInfo.getType() != 1) {
isPieBuild = false;
}
- functionName = SymbolManager.addr2func(localPath, pcStr, isPieBuild,
- baseAddr);
+ functionName = SymbolManager.addr2func(localPath, pcStr, isPieBuild, baseAddr);
}
- if (null == functionName || functionName.isEmpty()
- || functionName.equals("_end")) { //$NON-NLS-1$
+ if (null == functionName || functionName.isEmpty() || functionName.equals("_end")) { //$NON-NLS-1$
functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
} else {
String prevFunctionName = functionName;
symbol = getUserFunctionPosition(pid, time)
+ AnalyzerConstants.CALLSTACK_API_TOKEN_STRING + functionName;
} else {
- HashMap<String, BinaryInfo> binInfoMap = BinarySettingManager
- .getInstance().getTargetBinInfoMap();
+ HashMap<String, BinaryInfo> binInfoMap = BinarySettingManager.getInstance()
+ .getTargetBinInfoMap();
LibraryObject libraryObject = pmap.getLibraryByAddress(addr);
if (null != libraryObject) {
if (binInfo.getType() != 1) {
isPieBuild = false;
}
- functionName = SymbolManager.addr2func(localPath, pcStr,
- isPieBuild, baseAddr);
+ functionName = SymbolManager.addr2func(localPath, pcStr, isPieBuild,
+ baseAddr);
if (null == functionName || functionName.isEmpty()
|| functionName.equals("_end")) { //$NON-NLS-1$
functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
} else {
String prevFunctionName = functionName;
- functionName = SymbolManager
- .demanglingFunctionName(prevFunctionName);
+ functionName = SymbolManager.demanglingFunctionName(prevFunctionName);
}
// need to be checked again - in case pid is not main
// application
} else {
functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
}
- symbol = path + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING
- + functionName;
+ symbol = path + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING + functionName;
}
}
}
public class Communicator30 extends BaseCommunicator {
static final boolean PRINT_CONTROL_LOG_TOFILE = true;
-
+
private static final int CONTROL_HEADER_SIZE = 8;
-
+
private PrintWriter printWriter = null;
@Override
replayData = ByteUtil.getByte(ReplayTraceHandler.REPLAY_OFF);
}
- byte[] rear = ByteUtil
- .getByte(userSpaceInst.toByteStream(), replayData);
+ byte[] rear = ByteUtil.getByte(userSpaceInst.toByteStream(), replayData);
int length = rear.length;
- byte[] ret = ByteUtil.getByte(AnalyzerConstants.MSG_START_SWAP, length,
- rear);
+ byte[] ret = ByteUtil.getByte(AnalyzerConstants.MSG_START_SWAP, length, rear);
Logger.debug("print start message");
// ByteUtils.printByteArrayForStart(ret);
if (PRINT_CONTROL_LOG_TOFILE) {
- File logPath = new File(
- PathManager.DA_DEBUG_CONTROL_CHANNEL_LOG_FILE);
+ File logPath = new File(PathManager.DA_DEBUG_CONTROL_CHANNEL_LOG_FILE);
if (logPath.exists()) {
logPath.delete();
}
try {
- printWriter = new PrintWriter(new BufferedWriter(
- new FileWriter(logPath)), true);
+ printWriter = new PrintWriter(new BufferedWriter(new FileWriter(logPath)), true);
} catch (IOException e) {
e.printStackTrace();
}
Thread dataThread = new Thread(null, new DataChannelThread(),
AnalyzerConstants.COMMUNICATOR_RECEIVE_THREAD);
// start message send
- HostResult result = handleControlMessage(
- GlobalInformation.getCurrentDeviceInfo(), ret);
+ HostResult result = handleControlMessage(GlobalInformation.getCurrentDeviceInfo(), ret);
Logger.performance("TEST", "Start Trace", "Make and Send start message");
// FIX
if (result.isSuccess()) {
if (!isCorrectAck(MSG_START_ACK, result)) {
HostResult failResult = HostResult.ERR_MSG_START_FAIL;
- failResult.setMessage(ErrorCode.getError(
- getReturnId(result.getRet())).toString());
+ failResult.setMessage(ErrorCode.getError(getReturnId(result.getRet())).toString());
DACommunicator.setRunning(false);
dataThread = null;
return failResult;
index += INT_SIZE;
int nano = ByteUtil.toInt(data, index);
- AnalyzerManager.getProject().setProfilingStartTime(
- new DATime(sec, nano));
+ AnalyzerManager.getProject().setProfilingStartTime(new DATime(sec, nano));
}
} else {
DACommunicator.setRunning(false);
ToolbarArea.getInstance().startTimer();
Logger.performance("TEST", "Start Trace", "Start Timer");
SWAPLogParser.startLogParser();
- Logger.performance("TEST", "Start Trace",
- "Start SWAP log parser thread");
+ Logger.performance("TEST", "Start Trace", "Start SWAP log parser thread");
// start registered data manager thread
DataManagerRegistry.startThreads();
Logger.performance("TEST", "Start Trace", "Start DataManager threads");
if (pkgInfo.getPackageId().equals(AnalyzerConstants.RUNNING_PROCESS)) {
// if running process is selected for tracing
- Map<Integer, String> selectedProcess = apps.get(0)
- .getRunningProcesses();
+ Map<Integer, String> selectedProcess = apps.get(0).getRunningProcesses();
if (selectedProcess != null && selectedProcess.size() > 0) {
- for (Map.Entry<Integer, String> entry : selectedProcess
- .entrySet()) {
- BinaryInfo binInfo = AnalyzerManager.getProject()
- .getDeviceStatusInfo()
+ for (Map.Entry<Integer, String> entry : selectedProcess.entrySet()) {
+ BinaryInfo binInfo = AnalyzerManager.getProject().getDeviceStatusInfo()
.getBinaryInfo(entry.getValue());
String temppath = binInfo.getTempBinaryPath();
if (temppath == null) {
appInst.setApplicationId(entry.getKey().toString());
appInst.setExecutablePath(entry.getValue());
- List<FunctionInst> functionInstList = getFunctionInstList(
- apps.get(0), temppath);
+ List<FunctionInst> functionInstList = getFunctionInstList(apps.get(0), temppath);
appInst.getFunctionInstList().addAll(functionInstList);
appInst.setFunctionCount(functionInstList.size());
output.getAppInstList().add(appInst);
}
}
- } else if (pkgInfo.getPackageId().equals(
- AnalyzerConstants.WITHOUT_EXECUTABLE)) {
+ } else if (pkgInfo.getPackageId().equals(AnalyzerConstants.WITHOUT_EXECUTABLE)) {
// TODO : if no executable is selected for tracing (system wide
// tracing)
return null;
continue;
}
- BinaryInfo binInfo = AnalyzerManager.getProject()
- .getDeviceStatusInfo().getBinaryInfo(app.getExecPath());
+ BinaryInfo binInfo = AnalyzerManager.getProject().getDeviceStatusInfo()
+ .getBinaryInfo(app.getExecPath());
String temppath = binInfo.getTempBinaryPath();
if (temppath == null) {
// this means the app binary does not exist in device
appInst.setExecutablePath(app.getExecPath());
Logger.debug("Set execute path : " + app.getExecPath());
- List<FunctionInst> functionInstList = getFunctionInstList(app,
- temppath);
+ List<FunctionInst> functionInstList = getFunctionInstList(app, temppath);
appInst.getFunctionInstList().addAll(functionInstList);
appInst.setFunctionCount(functionInstList.size());
output.getAppInstList().add(appInst);
return functionInstList;
}
- public HostResult sendBinaryInfoMessage(AppInfo selectedApp) {
+ public HostResult sendBinaryInfoMessage(PackageInfo selectedPkg) {
// send config message
List<String> paths = new ArrayList<String>();
byte[] msgBinInfo = ByteUtil.toBytes(AnalyzerConstants.MSG_BINARY_INFO);
DeviceInfo curDevice = GlobalInformation.getCurrentDeviceInfo();
- if (AnalyzerConstants.RUNNING_PROCESS.equals(selectedApp.getAppId())) {
- Map<Integer, String> selProcess = selectedApp.getRunningProcesses();
+ if (AnalyzerConstants.RUNNING_PROCESS.equals(selectedPkg.getPackageId())) {
+ Map<Integer, String> selProcess = selectedPkg.getMainApp().getRunningProcesses();
int binCount = selProcess.size();
preMsg = ByteUtil.getByte(binCount);
paths.add(entry.getValue());
preMsg = ByteUtil.getByte(preMsg, entry.getValue());
}
- } else if (AnalyzerConstants.WITHOUT_EXECUTABLE.equals(selectedApp
- .getAppId())) {
+ } else if (AnalyzerConstants.WITHOUT_EXECUTABLE.equals(selectedPkg.getPackageId())) {
// do not send message for system wide trace
return HostResult.SUCCESS;
} else {
- PackageInfo pkgInfo = curDevice.getPackageInfoHash().get(
- selectedApp.getPackageId());
- List<AppInfo> apps = pkgInfo.getAppInfos();
+ List<AppInfo> apps = selectedPkg.getAppInfos();
if (null == apps) {
return HostResult.ERR_BIN_INFO_GET_FAIL;
}
private HostResult pullTheFile(String from, String to) {
try {
- GlobalInformation.getCurrentDeviceInfo().getIDevice()
- .becomeSuperUser(true);
+ GlobalInformation.getCurrentDeviceInfo().getIDevice().becomeSuperUser(true);
} catch (TimeoutException e) {
e.printStackTrace();
} catch (SdbCommandRejectedException e) {
}
@Override
- public HostResult sendConfigurationMessage(DeviceInfo devInfo, int type,
- String message) {
+ public HostResult sendConfigurationMessage(DeviceInfo devInfo, int type, String message) {
// send config message
byte[] config = ByteUtil.toBytes(AnalyzerConstants.MSG_CONFIG);
RunTimeConfiguration rt = new RunTimeConfiguration();
- rt.setFeatures(
- ConfigureManager.getInstance().getConfiguration(devInfo),
- ConfigureManager.getInstance().getPreConfiguration(devInfo));
- rt.setSystemTracePeriod(ConfigureManager.getInstance()
- .getSystemPeriod());
+ rt.setFeatures(ConfigureManager.getInstance().getConfiguration(devInfo), ConfigureManager
+ .getInstance().getPreConfiguration(devInfo));
+ rt.setSystemTracePeriod(ConfigureManager.getInstance().getSystemPeriod());
rt.setSamplingPeriod(ConfigureManager.getInstance().getSamplingPeriod());
byte[] rtByte = rt.toByteStream();
int length = rtByte.length;
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- final Shell shell = WorkbenchUtil.getWorkbenchWindow()
- .getShell();
+ final Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
DADialog dialog = new DADialog(shell, SWT.NONE, 550, 153);
dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
dialog.setMessage("Configuration failed..");
byte[] stop = ByteUtil.toBytes(AnalyzerConstants.MSG_STOP_SWAP);
int length = 0;
byte[] stopMsg = ByteUtil.getByte(stop, length);
- HostResult result = handleControlMessage(
- GlobalInformation.getCurrentDeviceInfo(), stopMsg);
+ HostResult result = handleControlMessage(GlobalInformation.getCurrentDeviceInfo(),
+ stopMsg);
if (result.isSuccess()) {
if (isCorrectAck(MSG_STOP_ACK, result)) {
printWriter.printf("\n");
}
controlSock.getOutputStream().write(message);
- Logger.debug("wait for ack... [send message : "
- + ByteUtil.toInt(message) + " ]");
+ Logger.debug("wait for ack... [send message : " + ByteUtil.toInt(message) + " ]");
int readsize = -1;
byte[] cbuf = new byte[DACommunicator.READ_BUFFER_SIZE];
-
+
Logger.debug("blocked");
blocked = true;
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
readsize = controlSock.getInputStream().read(cbuf, 0, CONTROL_HEADER_SIZE);
if (readsize == CONTROL_HEADER_SIZE) {
baos.write(cbuf, 0, readsize);
int payloadsize = ByteUtil.toInt(cbuf, INT_SIZE);
-
+
do {
readsize = controlSock.getInputStream().read(cbuf);
baos.write(cbuf, 0, readsize);
-
+
payloadsize -= readsize;
} while (payloadsize > 0);
blocked = false;
HostResult result = HostResult.SUCCESS;
Socket controlSock = null;
try {
- controlSock = new Socket(CommonConstants.LOCAL_HOST,
- CommunicatorUtils.LOCAL_PORT);
+ controlSock = new Socket(CommonConstants.LOCAL_HOST, CommunicatorUtils.LOCAL_PORT);
controlSock.setSoTimeout(AnalyzerConstants.CONTROL_SOCKET_TIMEOUT);
controlSock.setReuseAddress(true);
controlSock.setTcpNoDelay(true);
HostResult result = HostResult.SUCCESS;
Socket dataSock = null;
try {
- dataSock = new Socket(CommonConstants.LOCAL_HOST,
- CommunicatorUtils.LOCAL_PORT);
+ dataSock = new Socket(CommonConstants.LOCAL_HOST, CommunicatorUtils.LOCAL_PORT);
dataSock.setSoTimeout(AnalyzerConstants.DATA_SOCKET_TIMEOUT);
dataSock.setReuseAddress(true);
dataSock.setTcpNoDelay(true);
index += INT_SIZE;
if (ackType == msgId) {
- if (paylen != INT_SIZE
- || retId == ErrorCode.SUCCESS.getErrorNumber()) {
+ if (paylen != INT_SIZE || retId == ErrorCode.SUCCESS.getErrorNumber()) {
return true;
}
}
return GlobalInformation.getCurrentDeviceInfo().getDataSock();
}
- private void processTargetInfo(byte[] payload, int index,
- DeviceStatusInfo tInfo) {
+ private void processTargetInfo(byte[] payload, int index, DeviceStatusInfo tInfo) {
long systemMemorySize = 0;
long storageSize = 0;
int bluetoothSupport = 0;
}
@Override
- public void onAppSelected(AppInfo app) {
- if (app != null) {
- HostResult hr = sendBinaryInfoMessage(app);
+ public void onAppSelected(PackageInfo pkg) {
+ if (pkg != null) {
+ HostResult hr = sendBinaryInfoMessage(pkg);
if (!hr.isSuccess()) {
Logger.debug("binary info get failed :" + hr.getMessage());
}
public HostResult sendScreenShotRequest() {
byte[] msg = ByteUtil.getByte(AnalyzerConstants.MSG_GET_SCREENSHOT, 0);
HostResult result = HostResult.SUCCESS;
- Socket controlSock = GlobalInformation.getCurrentDeviceInfo()
- .getControlSock();
+ Socket controlSock = GlobalInformation.getCurrentDeviceInfo().getControlSock();
try {
if (null != controlSock && !controlSock.isClosed()) {
return result;
}
- public HostResult sendSWAPMessage(int messageId,
- List<BinarySettingData> settings) {
- HashMap<String, BinaryInfo> targetBinInfoMap = BinarySettingManager
- .getInstance().getTargetBinInfoMap();
+ public HostResult sendSWAPMessage(int messageId, List<BinarySettingData> settings) {
+ HashMap<String, BinaryInfo> targetBinInfoMap = BinarySettingManager.getInstance()
+ .getTargetBinInfoMap();
byte[] msg = new byte[0];
int count = settings.size();
int failedCount = 0;
size = size - exSize;
libInst = ByteUtil.getByte(libInst, binaryPath, size);
for (int i = 0; i < size; i++) {
- libInst = ByteUtil.getByte(libInst, functionInstList.get(i)
- .toByteStream());
+ libInst = ByteUtil.getByte(libInst, functionInstList.get(i).toByteStream());
}
}
count = count - failedCount;
msg = ByteUtil.getByte(msg, length, libInst);
// ByteUtils.printByteArrayForStart(msg);
- HostResult result = handleControlMessage(
- GlobalInformation.getCurrentDeviceInfo(), msg);
+ HostResult result = handleControlMessage(GlobalInformation.getCurrentDeviceInfo(), msg);
int ackMsg = AnalyzerConstants.MSG_SWAP_INST_ADD_ACK;
if (messageId == AnalyzerConstants.MSG_SWAP_INST_REMOVE) {
}
int length = sendbin.length;
- byte[] msg = ByteUtil
- .getByte(AnalyzerConstants.MSG_GET_PROCESS_ADD_INFO,
- length, sendbin);
- HostResult result = handleControlMessage(
- GlobalInformation.getCurrentDeviceInfo(), msg);
+ byte[] msg = ByteUtil.getByte(AnalyzerConstants.MSG_GET_PROCESS_ADD_INFO, length,
+ sendbin);
+ HostResult result = handleControlMessage(GlobalInformation.getCurrentDeviceInfo(), msg);
if (result.isSuccess()
- && isCorrectAck(
- AnalyzerConstants.MSG_GET_PROCESS_ADD_INFO_ACK,
- result)) {
+ && isCorrectAck(AnalyzerConstants.MSG_GET_PROCESS_ADD_INFO_ACK, result)) {
// parse binary info
byte[] payload = getMessagePayload(result.getRet());
int index = 0;
return infoMap;
}
- public HostResult sendBinaryInfoMessageForLib(
- List<BinarySettingData> binaryData) {
+ public HostResult sendBinaryInfoMessageForLib(List<BinarySettingData> binaryData) {
List<String> binPaths = new ArrayList<String>();
for (BinarySettingData data : binaryData) {
}
int length = sendBin.length;
- byte[] msg = ByteUtil.getByte(AnalyzerConstants.MSG_BINARY_INFO,
- length, sendBin);
- HostResult result = handleControlMessage(
- GlobalInformation.getCurrentDeviceInfo(), msg);
+ byte[] msg = ByteUtil.getByte(AnalyzerConstants.MSG_BINARY_INFO, length, sendBin);
+ HostResult result = handleControlMessage(GlobalInformation.getCurrentDeviceInfo(), msg);
if (!result.isSuccess() || !isCorrectAck(MSG_BINARY_INFO_ACK, result)) {
return HostResult.ERR_BIN_INFO_GET_FAIL;
for (int i = 0; i < count; i++) {
String targetPath = targetPaths.get(i);
- BinaryInfo binInfo = curDevice.getDeviceStatusInfo().getBinaryInfo(
- targetPath);
+ BinaryInfo binInfo = curDevice.getDeviceStatusInfo().getBinaryInfo(targetPath);
int binaryType = ByteUtil.toInt(payload, index);
index += INT_SIZE;
// check local binary path validation
// host has no binary file - pull binary file from target
- if (splitLocalBinaryPath.length < 3
- || !(new File(localBinaryPath)).exists()) {
+ if (splitLocalBinaryPath.length < 3 || !(new File(localBinaryPath)).exists()) {
localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH + File.separator
+ getFileName(targetPath);
result = pullTheFile(targetPath, localBinaryPath);
String localHashCode = null;
try {
Runtime rt = Runtime.getRuntime();
- Process process = rt.exec(new String[] {
- getMd5Command(), localBinaryPath });
+ Process process = rt.exec(new String[] { getMd5Command(), localBinaryPath });
process.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(
process.getInputStream()));
Logger.debug("host md5sum get failed : " + errorStr);
result = HostResult.ERR_BIN_INFO_GET_FAIL;
} else {
- // md5sum.exe prepend "\" when target binary is not in current directory
+ // md5sum.exe prepend "\" when target binary is not in
+ // current directory
if (CommonUtil.isWin()) {
line = line.replace("\\", "");
}
result = HostResult.ERR_BIN_INFO_GET_FAIL;
}
- if (localHashCode == null
- || 0 != localHashCode.compareTo(binInfo.getMd5sumValue())) {
- localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
- + File.separator + getFileName(targetPath);
+ if (localHashCode == null || 0 != localHashCode.compareTo(binInfo.getMd5sumValue())) {
+ localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH + File.separator
+ + getFileName(targetPath);
result = pullTheFile(targetPath, localBinaryPath);
if (result.isSuccess()) {
binInfo.setTempBinaryPath(localBinaryPath);
}
}
}
-
+
private String getMd5Command() {
String cmd = null;
if (CommonUtil.isLinux()) {
- cmd = AnalyzerShellCommands.CMD_LINUX_MD_5_SUM;
+ cmd = AnalyzerShellCommands.CMD_LINUX_MD_5_SUM;
} else if (CommonUtil.isMac()) {
- cmd = AnalyzerShellCommands.CMD_MAC_MD_5_SUM;
+ cmd = AnalyzerShellCommands.CMD_MAC_MD_5_SUM;
} else if (CommonUtil.isWin()) {
- cmd = PathManager.DA_TOOL_FOLDER_PATH + File.separator
- + "md5sum.exe";
+ cmd = PathManager.DA_TOOL_FOLDER_PATH + File.separator + "md5sum.exe";
} else { // should never be here
Logger.error("Unknown host OS!\n");
}
-
+
return cmd;
}
-
+
private String parseMd5Result(String line) {
String md5value = null;
- String[] splitResult = line.trim().split(
- CommonConstants.SPACE);
-
+ String[] splitResult = line.trim().split(CommonConstants.SPACE);
+
if (CommonUtil.isLinux()) {
md5value = new String(splitResult[0]);
- } else if (CommonUtil.isMac()) { // In md5's output, hash value comes last
+ } else if (CommonUtil.isMac()) { // In md5's output, hash value comes
+ // last
md5value = new String(splitResult[splitResult.length - 1]);
} else if (CommonUtil.isWin()) {
- md5value = new String(splitResult[0]);
+ md5value = new String(splitResult[0]);
} else { // should never be here
- Logger.error("Unknown host OS!\n");
+ Logger.error("Unknown host OS!\n");
}
-
+
return md5value;
}
}
import org.tizen.dynamicanalyzer.model.DeviceInfo;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.project.AppInfo;
+import org.tizen.dynamicanalyzer.project.PackageInfo;
import org.tizen.dynamicanalyzer.project.ProcessInformation;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.resources.ColorResources;
public static final int REPLAY_EDIT_BUTTON = 9;
public static final String ALL_PROCESS = "All Processes";
- public static final String PROCESS_SPLITER = CommonConstants.SPACE
- + CommonConstants.COLON + CommonConstants.SPACE;
+ public static final String PROCESS_SPLITER = CommonConstants.SPACE + CommonConstants.COLON
+ + CommonConstants.SPACE;
private static ToolbarArea coolbarArea;
String text = appCombo.getText();
if ((null != pDeviceName && !pDeviceName.isEmpty() && pDeviceName
.equals(sDeviceName))
- && (null != appName && !appName.isEmpty() && appName
- .equals(text))) {
+ && (null != appName && !appName.isEmpty() && appName.equals(text))) {
replayButton.setButtonEnabled(true);
replayEditButton.setButtonEnabled(false);
// disable button until complete TV SDK
@Override
public void selectionEvent(DACustomCombo combo) {
String oldDeviceName = null;
- DeviceInfo oldDevInfo = GlobalInformation
- .getCurrentDeviceInfo();
+ DeviceInfo oldDevInfo = GlobalInformation.getCurrentDeviceInfo();
if (oldDevInfo != null)
oldDeviceName = oldDevInfo.getIDevice().getSerialNumber();
String serial = combo.getText();
if (null != idevices) {
for (int i = 0; i < idevices.length; i++) {
- int index = serials.indexOf(idevices[i]
- .getSerialNumber());
+ int index = serials.indexOf(idevices[i].getSerialNumber());
if (index < 0) {
diffList.add(idevices[i]);
}
if (null != appName && !appName.isEmpty()) {
boolean enablestart = true;
- AppInfo selectedApp = DACommunicator
- .getPkgInfoByName(appName);
- if (null != selectedApp) {
+ PackageInfo selectedPkg = DACommunicator.getPkgInfoByLabel(appName);
+ if (null != selectedPkg) {
if (appName.equals(AnalyzerConstants.RUNNING_PROCESS)) {
- Shell shell = WorkbenchUtil.getWorkbenchWindow()
- .getShell();
- ProcessExplorerDialog pdialog = new ProcessExplorerDialog(
- shell);
- pdialog.setProcessList(selectedApp
- .getRunningProcesses());
+ Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+ ProcessExplorerDialog pdialog = new ProcessExplorerDialog(shell);
+ pdialog.setProcessList(selectedPkg.getMainApp().getRunningProcesses());
Object result = pdialog.open();
if (result != null) {
@SuppressWarnings("unchecked")
Map<Integer, String> processes = (Map<Integer, String>) result;
- selectedApp.setRunningProcesses(processes);
+ selectedPkg.getMainApp().setRunningProcesses(processes);
}
- if (selectedApp.getRunningProcesses() == null) {
+ if (selectedPkg.getMainApp().getRunningProcesses() == null) {
enablestart = false;
}
}
- GlobalInformation.setCurrentApplication(selectedApp);
- GlobalInformation.getCurrentDeviceInfo()
- .getCommunicator().onAppSelected(selectedApp);
- GlobalInformation
- .getCurrentDeviceInfo()
- .setSelectedAppName(
- selectedApp
- .getInfo(AppInfo.PROPERTY.LABEL.index));
+ GlobalInformation.setCurrentApplication(selectedPkg);
+ GlobalInformation.getCurrentDeviceInfo().getCommunicator()
+ .onAppSelected(selectedPkg);
+ GlobalInformation.getCurrentDeviceInfo().setSelectedPackageID(
+ selectedPkg.getPackageId());
} else {
enablestart = false;
}
- if (enablestart
- && null != GlobalInformation.getCurrentDeviceInfo()) {
+ if (enablestart && null != GlobalInformation.getCurrentDeviceInfo()) {
// AnalyzerUtil
// .setRecordState(RecordStateSourceProvider.RECORD_READY);
AnalyzerManager.setRunningState(false);
@Override
public void selectionEvent(DACustomCombo combo) {
- BaseView baseView = (BaseView) WorkbenchUtil
- .getViewPart(BaseView.ID);
+ BaseView baseView = (BaseView) WorkbenchUtil.getViewPart(BaseView.ID);
baseView.getTopComposite().updateView();
}
});
int pcount = pids.length;
for (int i = 0; i < pcount; i++) {
- ProcessInformation process = project
- .getProcessInformation(pids[i]);
+ ProcessInformation process = project.getProcessInformation(pids[i]);
String binName = process.getProcessName();
if (binName == null || binName.isEmpty()) {
- int bid = process.getLastProcessMemoryMap()
- .getMainbinary().getBinaryID();
- String binPath = project.getDeviceStatusInfo()
- .getBinaryInfo(bid).getTargetBinaryPath();
+ int bid = process.getLastProcessMemoryMap().getMainbinary().getBinaryID();
+ String binPath = project.getDeviceStatusInfo().getBinaryInfo(bid)
+ .getTargetBinaryPath();
if (null != binPath && !binPath.isEmpty()) {
- int index = binPath
- .lastIndexOf(CommonConstants.SLASH);
- binName = binPath.substring(index + 1,
- binPath.length());
+ int index = binPath.lastIndexOf(CommonConstants.SLASH);
+ binName = binPath.substring(index + 1, binPath.length());
}
}
}
});
- saveTraceButton
- .addClickListener(new DACustomButtonClickEventListener() {
-
- @Override
- public void handleClickEvent(DACustomButton button) {
- Shell shell = WorkbenchUtil.getWorkbenchWindow()
- .getShell();
- SaveAsDialog dialog = new SaveAsDialog(shell);
- Object result = dialog.open();
- if (null != result) {
- if (!CommandActionHandler.save(dialog.getSaveFileName())) {
- DADialog warninglog = new DADialog(shell, SWT.NONE);
- warninglog.setIcon(ImageResources.DIALOG_WARNING_ICON);
- warninglog.setMessage(AnalyzerLabels.SAVE_FAILED);
- warninglog.open();
- }
+ saveTraceButton.addClickListener(new DACustomButtonClickEventListener() {
- button.setButtonEnabled(false);
- }
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+ SaveAsDialog dialog = new SaveAsDialog(shell);
+ Object result = dialog.open();
+ if (null != result) {
+ if (!CommandActionHandler.save(dialog.getSaveFileName())) {
+ DADialog warninglog = new DADialog(shell, SWT.NONE);
+ warninglog.setIcon(ImageResources.DIALOG_WARNING_ICON);
+ warninglog.setMessage(AnalyzerLabels.SAVE_FAILED);
+ warninglog.open();
}
- });
- openTraceButton
- .addClickListener(new DACustomButtonClickEventListener() {
+ button.setButtonEnabled(false);
+ }
+ }
+ });
- @Override
- public void handleClickEvent(DACustomButton button) {
- Shell shell = WorkbenchUtil.getWorkbenchWindow()
- .getShell();
- OpenTraceDialog dialog = new OpenTraceDialog(shell);
- dialog.open();
- }
- });
+ openTraceButton.addClickListener(new DACustomButtonClickEventListener() {
+
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+ OpenTraceDialog dialog = new OpenTraceDialog(shell);
+ dialog.open();
+ }
+ });
replayButton.addClickListener(new DACustomButtonClickEventListener() {
}
});
- replayEditButton
- .addClickListener(new DACustomButtonClickEventListener() {
+ replayEditButton.addClickListener(new DACustomButtonClickEventListener() {
- @Override
- public void handleClickEvent(DACustomButton button) {
- Shell shell = WorkbenchUtil.getWorkbenchWindow()
- .getShell();
- ReplayEditDialog dialog = new ReplayEditDialog(shell);
- dialog.open();
- }
- });
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+ ReplayEditDialog dialog = new ReplayEditDialog(shell);
+ dialog.open();
+ }
+ });
configButton.addClickListener(new DACustomButtonClickEventListener() {
}
});
- screenshotButton
- .addClickListener(new DACustomButtonClickEventListener() {
+ screenshotButton.addClickListener(new DACustomButtonClickEventListener() {
- @Override
- public void handleClickEvent(DACustomButton button) {
- DACommunicator.sendScreenShotMessage();
- }
- });
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ DACommunicator.sendScreenShotMessage();
+ }
+ });
aboutButton.addClickListener(new DACustomButtonClickEventListener() {
}
});
- viewSourceButton
- .addClickListener(new DACustomButtonClickEventListener() {
- @Override
- public void handleClickEvent(DACustomButton button) {
+ viewSourceButton.addClickListener(new DACustomButtonClickEventListener() {
+ @Override
+ public void handleClickEvent(DACustomButton button) {
- // TODO : use for test code...
+ // TODO : use for test code...
- }
- });
+ }
+ });
}
public void setStartButtonToolTipText(final String text) {
setToolbarStartStopState(true);
- if (null == DACommunicator.getDevices()
- || DACommunicator.getDevices().isEmpty()) {
+ if (null == DACommunicator.getDevices() || DACommunicator.getDevices().isEmpty()) {
deviceCombo.setEnabled(false);
}
- if (!deviceCombo.isEnabled()
- || null == GlobalInformation.getCurrentDeviceInfo()) {
+ if (!deviceCombo.isEnabled() || null == GlobalInformation.getCurrentDeviceInfo()) {
appCombo.setEnabled(false);
}
- if (!appCombo.isEnabled()
- || null == GlobalInformation.getCurrentApplication()) {
+ if (!appCombo.isEnabled() || null == GlobalInformation.getCurrentApplication()) {
setStartButtonEnablement(false);
}
@Override
public void run() {
- StartProcessManager.getInstance().startProcessStart(
- "prepare for tracing");
+ StartProcessManager.getInstance().startProcessStart("prepare for tracing");
}
});
/** which contains start, TimerClock, save, open and replay buttons. */
// Creates start button.
- startButton = new DACustomButton(parent, ImageResources.START,
- ImageResources.START_PUSH, ImageResources.START_HOVER,
- ImageResources.START_DISABLE);
+ startButton = new DACustomButton(parent, ImageResources.START, ImageResources.START_PUSH,
+ ImageResources.START_HOVER, ImageResources.START_DISABLE);
// startButton.setButtonEnabled(false);
setStartButtonState(false);
startButton.setToolTipText(ShortCutManager.START_TRACE);
timerClock.setClockFont(FontResources.TIMER);
// // Creates save trace button.
- saveTraceButton = new DACustomButton(parent, ImageResources.SAVE,
- ImageResources.SAVE_PUSH, ImageResources.SAVE_HOVER,
- ImageResources.SAVE_DISABLE);
+ saveTraceButton = new DACustomButton(parent, ImageResources.SAVE, ImageResources.SAVE_PUSH,
+ ImageResources.SAVE_HOVER, ImageResources.SAVE_DISABLE);
saveTraceButton.setButtonEnabled(false);
saveTraceButton.setBackground(ColorResources.COOLBAR_BG_COLOR);
saveTraceButton.setToolTipText(ShortCutManager.SAVE_TRACE);
buttons.put(SAVE_BUTTON, saveTraceButton);
// // Creates open trace button.
- openTraceButton = new DACustomButton(parent, ImageResources.OPEN,
- ImageResources.OPEN_PUSH, ImageResources.OPEN_HOVER,
- ImageResources.OPEN_DISABLE);
+ openTraceButton = new DACustomButton(parent, ImageResources.OPEN, ImageResources.OPEN_PUSH,
+ ImageResources.OPEN_HOVER, ImageResources.OPEN_DISABLE);
openTraceButton.setToolTipText(ShortCutManager.OPEN_TRACE);
openTraceButton.setBackground(ColorResources.COOLBAR_BG_COLOR);
buttons.put(OPEN_BUTTON, openTraceButton);
buttons.put(REPLAY_BUTTON, replayButton);
// Creates replayEdit button.
- replayEditButton = new DACustomButton(parent,
- ImageResources.REPLAY_EDIT, ImageResources.REPLAY_EDIT_PUSH,
- ImageResources.REPLAY_EDIT_HOVER,
+ replayEditButton = new DACustomButton(parent, ImageResources.REPLAY_EDIT,
+ ImageResources.REPLAY_EDIT_PUSH, ImageResources.REPLAY_EDIT_HOVER,
ImageResources.REPLAY_EDIT_DISABLE);
replayEditButton.setToolTipText(ShortCutManager.REPLAY_EDIT);
replayEditButton.setBackground(ColorResources.COOLBAR_BG_COLOR);
buttons.put(REPLAY_EDIT_BUTTON, replayEditButton);
// Creates config button
- configButton = new DACustomButton(parent,
- ImageResources.SETTINGS_NORMAL, ImageResources.SETTINGS_PUSH,
- ImageResources.SETTINGS_HOVER, ImageResources.SETTINGS_DISABLE);
+ configButton = new DACustomButton(parent, ImageResources.SETTINGS_NORMAL,
+ ImageResources.SETTINGS_PUSH, ImageResources.SETTINGS_HOVER,
+ ImageResources.SETTINGS_DISABLE);
configButton.setToolTipText(ShortCutManager.COOLBAR_AREA_SETTING);
configButton.setBackground(ColorResources.COOLBAR_BG_COLOR);
buttons.put(CONFIG_BUTTON, configButton);
// Creates screenshot button
- screenshotButton = new DACustomButton(parent,
- ImageResources.SCREEN_SHOT_NORMAL,
- ImageResources.SCREEN_SHOT_PUSH,
- ImageResources.SCREEN_SHOT_HOVER,
+ screenshotButton = new DACustomButton(parent, ImageResources.SCREEN_SHOT_NORMAL,
+ ImageResources.SCREEN_SHOT_PUSH, ImageResources.SCREEN_SHOT_HOVER,
ImageResources.SCREEN_SHOT_DISABLE);
screenshotButton.setToolTipText("Capture screen");
screenshotButton.setBackground(ColorResources.COOLBAR_BG_COLOR);
buttons.put(SCREENSHOT_BUTTON, screenshotButton);
// Creates about button.
- aboutButton = new DACustomButton(parent, ImageResources.ABOUT,
- ImageResources.ABOUT_PUSH, ImageResources.ABOUT_HOVER,
- ImageResources.ABOUT_DISABLE);
+ aboutButton = new DACustomButton(parent, ImageResources.ABOUT, ImageResources.ABOUT_PUSH,
+ ImageResources.ABOUT_HOVER, ImageResources.ABOUT_DISABLE);
aboutButton.setToolTipText(ShortCutManager.COOLBAR_AREA_ABOUT);
aboutButton.setBackground(ColorResources.COOLBAR_BG_COLOR);
buttons.put(ABOUT_BUTTON, aboutButton);
// Creates view source button.
- viewSourceButton = new DACustomToggleButton(parent,
- ImageResources.VIEW_SOURCE_NORMAL,
- ImageResources.VIEW_SOURCE_PUSH,
- ImageResources.VIEW_SOURCE_HOVER,
- ImageResources.VIEW_SOURCE_DISABLE,
- ImageResources.VIEW_SOURCE_TOGGLE,
- ImageResources.VIEW_SOURCE_TOGGLE_HOVER,
- ImageResources.VIEW_SOURCE_TOGGLE_PUSH);
- viewSourceButton
- .setToolTipText(ShortCutManager.COOLBAR_AREA_VIEW_SOURCE);
+ viewSourceButton = new DACustomToggleButton(parent, ImageResources.VIEW_SOURCE_NORMAL,
+ ImageResources.VIEW_SOURCE_PUSH, ImageResources.VIEW_SOURCE_HOVER,
+ ImageResources.VIEW_SOURCE_DISABLE, ImageResources.VIEW_SOURCE_TOGGLE,
+ ImageResources.VIEW_SOURCE_TOGGLE_HOVER, ImageResources.VIEW_SOURCE_TOGGLE_PUSH);
+ viewSourceButton.setToolTipText(ShortCutManager.COOLBAR_AREA_VIEW_SOURCE);
viewSourceButton.setBackground(ColorResources.COOLBAR_BG_COLOR);
buttons.put(SOURCE_BUTTON, viewSourceButton);
private DACustomCombo makeDACustomCombo(Composite parent) {
DACustomCombo returnCombo = new DACustomCombo(parent, SWT.NONE);
- returnCombo.setComboGradation(
- ColorResources.TOOLBAR_COMBO_NORMAL_START,
- ColorResources.TOOLBAR_COMBO_NORMAL_END,
- ColorResources.TOOLBAR_COMBO_PUSH_START,
- ColorResources.TOOLBAR_COMBO_PUSH_END,
- ColorResources.TOOLBAR_COMBO_HOVER_START,
- ColorResources.TOOLBAR_COMBO_HOVER_END,
- ColorResources.TOOLBAR_COMBO_DISABLE_START,
+ returnCombo.setComboGradation(ColorResources.TOOLBAR_COMBO_NORMAL_START,
+ ColorResources.TOOLBAR_COMBO_NORMAL_END, ColorResources.TOOLBAR_COMBO_PUSH_START,
+ ColorResources.TOOLBAR_COMBO_PUSH_END, ColorResources.TOOLBAR_COMBO_HOVER_START,
+ ColorResources.TOOLBAR_COMBO_HOVER_END, ColorResources.TOOLBAR_COMBO_DISABLE_START,
ColorResources.TOOLBAR_COMBO_DISABLE_END);
- returnCombo.setOutlineColors(
- ColorResources.TOOLBAR_COMBO_OUTLINE_NORMAL_IN_COLOR,
+ returnCombo.setOutlineColors(ColorResources.TOOLBAR_COMBO_OUTLINE_NORMAL_IN_COLOR,
ColorResources.TOOLBAR_COMBO_OUTLINE_PUSH_IN_COLOR,
ColorResources.TOOLBAR_COMBO_OUTLINE_HOVER_IN_COLOR,
ColorResources.TOOLBAR_COMBO_OUTLINE_DISABLE_IN_COLOR);
ImageResources.TOOLBAR_COMBO_BUTTON_NORMAL,
ImageResources.TOOLBAR_COMBO_BUTTON_DISABLE);
returnCombo.setComboImagePoint(new Point(130, 9));
- returnCombo.setComboButtonColor(
- ColorResources.TOOLBAR_COMBO_BUTTON_NORMAL_COLOR,
+ returnCombo.setComboButtonColor(ColorResources.TOOLBAR_COMBO_BUTTON_NORMAL_COLOR,
ColorResources.TOOLBAR_COMBO_BUTTON_PUSH_COLOR,
ColorResources.TOOLBAR_COMBO_BUTTON_HOVER_COLOR,
ColorResources.TOOLBAR_COMBO_BUTTON_DISABLE_COLOR);
- returnCombo.setArrowOutlineColors(
- ColorResources.TOOLBAR_COMBO_ARROW_OUTLINE_COLOR,
+ returnCombo.setArrowOutlineColors(ColorResources.TOOLBAR_COMBO_ARROW_OUTLINE_COLOR,
ColorResources.TOOLBAR_COMBO_ARROW_OUTLINE_COLOR,
ColorResources.TOOLBAR_COMBO_ARROW_OUTLINE_COLOR,
ColorResources.TOOLBAR_COMBO_ARROW_OUTLINE_COLOR);
returnCombo.setEnabled(true);
returnCombo.setComboFont(FontResources.COMBO);
returnCombo.setItemFont(FontResources.DROPDOWN);
- returnCombo.setFontColors(
- ColorResources.TOOLBAR_COMBO_FONT_NORMAL_COLOR,
+ returnCombo.setFontColors(ColorResources.TOOLBAR_COMBO_FONT_NORMAL_COLOR,
ColorResources.TOOLBAR_COMBO_FONT_NORMAL_COLOR,
ColorResources.TOOLBAR_COMBO_FONT_NORMAL_COLOR,
ColorResources.TOOLBAR_COMBO_FONT_DISABLE_COLOR);
appCombo.setEnabled(true);
appCombo.initCombo();
- List<AppInfo> apps = addToAppComboFromTarget();
-
- if (apps != null && apps.size() > 0) {
- String appName = GlobalInformation.getCurrentDeviceInfo()
- .getSelectedAppName();
- if (null == appName) {
+ List<PackageInfo> pkgs = addToAppComboFromTarget();
+
+ if (pkgs != null && pkgs.size() > 0) {
+ String packageID = GlobalInformation.getCurrentDeviceInfo().getSelectedPackageID();
+ if (null != packageID && DACommunicator.getPkgInfoByPkgId(packageID) != null) {
+ PackageInfo pkgInfo = DACommunicator.getPkgInfoByPkgId(packageID);
+ appCombo.setText(pkgInfo.getMainApp().getInfo(AppInfo.PROPERTY.LABEL.index));
+ GlobalInformation.setCurrentApplication(pkgInfo);
+ GlobalInformation.getCurrentDeviceInfo().getCommunicator().onAppSelected(pkgInfo);
+ GlobalInformation.getCurrentDeviceInfo().setSelectedPackageID(
+ pkgInfo.getPackageId());
+ // startButton.setButtonEnabled(true);
+ setStartButtonState(true);
+ } else {
appCombo.select(0);
- GlobalInformation.setCurrentApplication(apps.get(0));
+ GlobalInformation.setCurrentApplication(pkgs.get(0));
GlobalInformation.getCurrentDeviceInfo().getCommunicator()
- .onAppSelected(apps.get(0));
- GlobalInformation.getCurrentDeviceInfo().setSelectedAppName(
- apps.get(0).getInfo(AppInfo.PROPERTY.LABEL.index));
- } else {
- AppInfo appInfo = DACommunicator.getPkgInfoByName(appName);
- if (null != appInfo) {
- appCombo.setText(appName);
- GlobalInformation.setCurrentApplication(appInfo);
- GlobalInformation.getCurrentDeviceInfo().getCommunicator()
- .onAppSelected(appInfo);
- GlobalInformation
- .getCurrentDeviceInfo()
- .setSelectedAppName(
- appInfo.getInfo(AppInfo.PROPERTY.LABEL.index));
- // startButton.setButtonEnabled(true);
- setStartButtonState(true);
- } else {
- appCombo.setText(appName);
- appCombo.select(0);
- GlobalInformation.setCurrentApplication(null);
- }
+ .onAppSelected(pkgs.get(0));
+ GlobalInformation.getCurrentDeviceInfo().setSelectedPackageID(
+ pkgs.get(0).getPackageId());
}
} else {
appCombo.select(0);
} else {
int size = items.size();
int selIndex = 0;
- String selDevice = GlobalInformation.getCurrentDeviceInfo()
- .getIDevice().getSerialNumber();
+ String selDevice = GlobalInformation.getCurrentDeviceInfo().getIDevice()
+ .getSerialNumber();
for (int i = 0; i < size; i++) {
deviceCombo.add(items.get(i));
if (items.get(i).equals(selDevice)) {
}
deviceCombo.select(selIndex);
- GlobalInformation.setCurrentDeviceInfo(DACommunicator
- .getDeviceByName(items.get(selIndex)));
+ GlobalInformation.setCurrentDeviceInfo(DACommunicator.getDeviceByName(items
+ .get(selIndex)));
deviceCombo.setToolTipText(items.get(selIndex));
if (null == oldDevice || !oldDevice.equals(selDevice)) {
}
}
- private void addToAppCombo(List<AppInfo> apps) {
+ private void addToAppCombo(List<PackageInfo> appPkgs) {
appCombo.initCombo();
- if (apps != null && apps.size() > 0) {
- int itemsSize = apps.size();
+ if (appPkgs != null && appPkgs.size() > 0) {
+ int itemsSize = appPkgs.size();
for (int i = 0; i < itemsSize; i++) {
- appCombo.add(apps.get(i).getInfo(AppInfo.PROPERTY.LABEL.index));
+ AppInfo mainapp = appPkgs.get(i).getMainApp();
+ String label = mainapp.getInfo(AppInfo.PROPERTY.LABEL.index);
+ if (label.isEmpty()) {
+ label = mainapp.getExecFileName();
+ mainapp.setInfo(AppInfo.PROPERTY.LABEL.index, label);
+ }
+ appCombo.add(label);
}
} else {
appCombo.add(CommonConstants.EMPTY);
}
}
- private List<AppInfo> addToAppComboFromTarget() {
- List<AppInfo> apps = DACommunicator.getAppListFromTarget();
+ private List<PackageInfo> addToAppComboFromTarget() {
+ Map<String, PackageInfo> pkgInfos = DACommunicator.getAppListFromTarget();
- List<AppInfo> appcomboList = new ArrayList<AppInfo>();
- if (apps != null) {
+ List<PackageInfo> appcomboList = new ArrayList<PackageInfo>();
+ if (pkgInfos != null) {
// TODO : reconstruct real app list for app combo
// relation between package and app?
- for (AppInfo app : apps) {
- String appid = app.getInfo(AppInfo.PROPERTY.APPID.index);
- String pkgid = app.getInfo(AppInfo.PROPERTY.PACKAGE.index);
- if (appid.startsWith(pkgid)
- && !appid.contains(AnalyzerConstants.APPCONTROL)) {
- appcomboList.add(app);
+ for (Map.Entry<String, PackageInfo> entry : pkgInfos.entrySet()) {
+ AppInfo mainapp = entry.getValue().getMainApp();
+ if (!mainapp.getAppId().contains(AnalyzerConstants.APPCONTROL)) {
+ appcomboList.add(entry.getValue());
}
}
}
addToAppCombo(appcomboList);
- return apps;
+ return appcomboList;
}
public void setAppComboText(final String text) {
- AppInfo appInfo = DACommunicator.getPkgInfoByName(text);
- if (null != appInfo) {
- GlobalInformation.setCurrentApplication(appInfo);
- GlobalInformation.getCurrentDeviceInfo().getCommunicator()
- .onAppSelected(appInfo);
- GlobalInformation.getCurrentDeviceInfo().setSelectedAppName(
- appInfo.getInfo(AppInfo.PROPERTY.LABEL.index));
+ PackageInfo pkgInfo = DACommunicator.getPkgInfoByLabel(text);
+ if (null != pkgInfo) {
+ GlobalInformation.setCurrentApplication(pkgInfo);
+ GlobalInformation.getCurrentDeviceInfo().getCommunicator().onAppSelected(pkgInfo);
+ GlobalInformation.getCurrentDeviceInfo().setSelectedPackageID(pkgInfo.getPackageId());
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
}
public void setAppComboTextByAppId(String id) {
- AppInfo appInfo = DACommunicator.getPkgInfoByAppPkgId(id);
- if (null != appInfo) {
- GlobalInformation.setCurrentApplication(appInfo);
- GlobalInformation.getCurrentDeviceInfo().getCommunicator()
- .onAppSelected(appInfo);
- GlobalInformation.getCurrentDeviceInfo().setSelectedAppName(
- appInfo.getInfo(AppInfo.PROPERTY.LABEL.index));
- appCombo.setText(appInfo.getInfo(AppInfo.PROPERTY.LABEL.index));
+ PackageInfo pkgInfo = DACommunicator.getPkgInfoByPkgId(id);
+ if (null != pkgInfo) {
+ GlobalInformation.setCurrentApplication(pkgInfo);
+ GlobalInformation.getCurrentDeviceInfo().getCommunicator().onAppSelected(pkgInfo);
+ GlobalInformation.getCurrentDeviceInfo().setSelectedPackageID(pkgInfo.getPackageId());
+ appCombo.setText(pkgInfo.getMainApp().getInfo(AppInfo.PROPERTY.LABEL.index));
}
}
}
String text = deviceCombo.getText();
- String device = GlobalInformation.getCurrentDeviceInfo()
- .getIDevice().getSerialNumber();
+ String device = GlobalInformation.getCurrentDeviceInfo().getIDevice()
+ .getSerialNumber();
if (!device.equals(text)) {
// startButton.setButtonEnabled(false);
setStartButtonState(false);
private void setStartButtonImagesToStop(boolean isStarted) {
if (isStarted) {
- startButton.setImages(ImageResources.STOP,
- ImageResources.STOP_PUSH, ImageResources.STOP_HOVER,
- ImageResources.START_DISABLE);
+ startButton.setImages(ImageResources.STOP, ImageResources.STOP_PUSH,
+ ImageResources.STOP_HOVER, ImageResources.START_DISABLE);
startButton.setToolTipText(ShortCutManager.STOP_TRACE);
} else {
- startButton.setImages(ImageResources.START,
- ImageResources.START_PUSH, ImageResources.START_HOVER,
- ImageResources.START_DISABLE);
+ startButton.setImages(ImageResources.START, ImageResources.START_PUSH,
+ ImageResources.START_HOVER, ImageResources.START_DISABLE);
startButton.setToolTipText(ShortCutManager.START_TRACE);
}
}