if (app.getAppId().contains("_AppControl")) {
continue;
}
+
+ // TODO : make new protocol field or message for launched app and
+ // instrucmented app
+ if (!app.getAppId().equals(app.getPackageId())) {
+ continue;
+ }
+
+ BinaryInfo binInfo = app.getMainBinaryInfo();
+ if (binInfo.getTempBinaryPath() == null) {
+ // this means the app binary does not exist in device
+ continue;
+ }
+
ApplicationInst appInst = new ApplicationInst();
+ // TODO : add more app type or launch type (core app and efl app)
String appType = app.getInfo(AppInfo.APPTYPE_INDEX);
if (appType.contains(AppInfo.APPTYPE_CPP)) {
appInst.setApplicationType(ApplicationInst.APPTYPE_TIZEN);
} else if (appType.contains(AppInfo.APPTYPE_WEB)) {
appInst.setApplicationType(ApplicationInst.APPTYPE_WEB);
appInst.setApplicationId(app.getAppId());
+ } else if (appType.contains(AppInfo.APPTYPE_CAPP)) {
+ appInst.setApplicationType(ApplicationInst.APPTYPE_TIZEN);
+ appInst.setApplicationId(app.getAppId());
} else {
appInst.setApplicationType(ApplicationInst.APPTYPE_COMMON_EXEC);
appInst.setApplicationId(CommonConstants.EMPTY);
appInst.setExecutablePath(app.getExecPath());
DA_LOG.debug("Set execute path : " + app.getExecPath());
- BinaryInfo binInfo = app.getMainBinaryInfo();
List<AddrSymbolPair> symbols = app.getSymbols(binInfo
.getTempBinaryPath());
List<FunctionInst> functionInstList = appInst.getFunctionInstList();
index += INT_SIZE;
localBinaryPath = ByteUtil.getString(payload, index).trim();
index += ByteUtil.getStringLength(payload, index);
- String[] splitLocalBinaryPath = localBinaryPath
- .split(CommonConstants.SLASH);
+ String md5sum = ByteUtil.getString(payload, index);
+ index += ByteUtil.getStringLength(payload, index);
+
+ binInfo.setType(binaryType);
+ binInfo.setMd5sumValue(md5sum);
binInfo.setLocalBinaryPath(localBinaryPath);
- // init source binary path
- binInfo.setTempBinaryPath(localBinaryPath);
- if (splitLocalBinaryPath.length == 0
- || splitLocalBinaryPath.length < 3) {
- localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
- + File.separator + getFileName(targetPath);
- result = pullTheFile(targetPath, localBinaryPath);
- if (result.isSuccess()) {
- binInfo.setTempBinaryPath(localBinaryPath);
- }
- String md5sum = ByteUtil.getString(payload, index);
- index += ByteUtil.getStringLength(payload, index);
- binInfo.setType(binaryType);
- binInfo.setTempBinaryPath(localBinaryPath);
- binInfo.setMd5sumValue(md5sum);
- continue;
- } else {
- String md5sum = ByteUtil.getString(payload, index);
- index += ByteUtil.getStringLength(payload, index);
- binInfo.setType(binaryType);
- binInfo.setTempBinaryPath(localBinaryPath);
- binInfo.setMd5sumValue(md5sum);
- }
+ String[] splitLocalBinaryPath = localBinaryPath
+ .split(CommonConstants.SLASH);
- // host has no binary file - pull binary file from target
- // change binary file path of host
- File binFile = new File(localBinaryPath);
- if (!binFile.exists()) {
+ // check local binary path validation
+ if (splitLocalBinaryPath.length < 3) {
localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
+ File.separator + getFileName(targetPath);
result = pullTheFile(targetPath, localBinaryPath);
if (result.isSuccess()) {
binInfo.setTempBinaryPath(localBinaryPath);
}
- continue;
- }
-
- String localHashCode = null;
- try {
- Runtime rt = Runtime.getRuntime();
- Process process = rt.exec(new String[] {
- AnalyzerShellCommands.CMD_MD_5_SUM, localBinaryPath });
- process.waitFor();
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(process.getInputStream()));
- BufferedReader error = new BufferedReader(
- new InputStreamReader(process.getErrorStream()));
- String line = reader.readLine();
- String errorStr = error.readLine();
- if (null == line) {
- DA_LOG.debug("host md5sum get failed : " + errorStr);
- result = HostResult.ERR_BIN_INFO_GET_FAIL;
- continue;
- }
- String[] splitResult = line.trim().split(CommonConstants.SPACE);
- localHashCode = new String(splitResult[0]);
- } catch (IOException e) {
- e.printStackTrace();
- result = HostResult.ERR_BIN_INFO_GET_FAIL;
- continue;
- } catch (InterruptedException e) {
- e.printStackTrace();
- return HostResult.ERR_BIN_INFO_GET_FAIL;
- }
-
- String targetHashCode = binInfo.getMd5sumValue();
- if (0 != targetHashCode.compareTo(localHashCode)) {
- localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
- + File.separator + getFileName(targetPath);
- result = pullTheFile(targetPath, localBinaryPath);
- if (result.isSuccess()) {
- binInfo.setTempBinaryPath(localBinaryPath);
+ } else {
+ // host has no binary file - pull binary file from target
+ // change binary file path of host
+ File binFile = new File(localBinaryPath);
+ if (!binFile.exists()) {
+ localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
+ + File.separator + getFileName(targetPath);
+ result = pullTheFile(targetPath, localBinaryPath);
+ if (result.isSuccess()) {
+ binInfo.setTempBinaryPath(localBinaryPath);
+ }
+ } else {
+ // if local binary exist already, then check for md5sum
+ String localHashCode = null;
+ try {
+ Runtime rt = Runtime.getRuntime();
+ Process process = rt.exec(new String[] {
+ AnalyzerShellCommands.CMD_MD_5_SUM,
+ localBinaryPath });
+ process.waitFor();
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(process.getInputStream()));
+ BufferedReader error = new BufferedReader(
+ new InputStreamReader(process.getErrorStream()));
+ String line = reader.readLine();
+ String errorStr = error.readLine();
+ if (null == line) {
+ DA_LOG.debug("host md5sum get failed : " + errorStr);
+ result = HostResult.ERR_BIN_INFO_GET_FAIL;
+ } else {
+ String[] splitResult = line.trim().split(
+ CommonConstants.SPACE);
+ localHashCode = new String(splitResult[0]);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ result = HostResult.ERR_BIN_INFO_GET_FAIL;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ result = HostResult.ERR_BIN_INFO_GET_FAIL;
+ }
+
+ if (localHashCode != null) {
+ String targetHashCode = binInfo.getMd5sumValue();
+ if (0 != targetHashCode.compareTo(localHashCode)) {
+ localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
+ + File.separator + getFileName(targetPath);
+ result = pullTheFile(targetPath, localBinaryPath);
+ if (result.isSuccess()) {
+ binInfo.setTempBinaryPath(localBinaryPath);
+ }
+ } else {
+ binInfo.setTempBinaryPath(localBinaryPath);
+ }
+ }
}
- continue;
}
}
return result;
SyncResult res = CommunicatorUtils.pull(from, to);
if (null != res && res.isOk()) {
- DA_LOG.debug("binary copy success!!");//$NON-NLS-1$
+ DA_LOG.debug("binary copy success : " + from);//$NON-NLS-1$
} else {
DA_LOG.debug("Failed to get " + from); //$NON-NLS-1$
return HostResult.ERR_BIN_INFO_GET_FAIL;
baos.write(cbuf, 0, readsize);
} while (readsize == DACommunicator.READ_BUFFER_SIZE * 2);
blocked = false;
-
+
readsize = baos.size();
cbuf = baos.toByteArray();
if (PRINT_CONTROL_LOG_TOFILE && printWriter != null) {
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;
index += INT_SIZE;
localBinaryPath = ByteUtil.getString(payload, index).trim();
index += ByteUtil.getStringLength(payload, index);
+ String md5sum = ByteUtil.getString(payload, index);
+ index += ByteUtil.getStringLength(payload, index);
+
+ binInfo.setType(binaryType);
+ binInfo.setMd5sumValue(md5sum);
binInfo.setLocalBinaryPath(localBinaryPath);
- binInfo.setTempBinaryPath(localBinaryPath);
+
String[] splitLocalBinaryPath = localBinaryPath
.split(CommonConstants.SLASH);
- if (splitLocalBinaryPath.length <= 0) {
- localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
- + File.separator + getFileName(binPaths.get(i));
- result = pullTheFile(binPaths.get(i), localBinaryPath);
- if (result.isSuccess()) {
- String md5sum = ByteUtil.getString(payload, index);
- index += ByteUtil.getStringLength(payload, index);
- binInfo.setType(binaryType);
- binInfo.setTempBinaryPath(localBinaryPath);
- binInfo.setMd5sumValue(md5sum);
- }
- continue;
- } else {
- String md5sum = ByteUtil.getString(payload, index);
- index += ByteUtil.getStringLength(payload, index);
- binInfo.setType(binaryType);
- binInfo.setTempBinaryPath(localBinaryPath);
- binInfo.setMd5sumValue(md5sum);
- }
-
- // host has no binary file - pull binary file from target
- // change binary file path of host
- File binFile = new File(localBinaryPath);
- if (!binFile.exists()) {
- localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
- + File.separator + getFileName(binPaths.get(i));
- result = pullTheFile(binPaths.get(i), localBinaryPath);
- if (result.isSuccess()) {
- binInfo.setTempBinaryPath(localBinaryPath);
- }
- continue;
- }
-
- String localHashCode = null;
- try {
- Runtime rt = Runtime.getRuntime();
- Process process = rt.exec(new String[] {
- AnalyzerShellCommands.CMD_MD_5_SUM, localBinaryPath });
- process.waitFor();
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(process.getInputStream()));
- BufferedReader error = new BufferedReader(
- new InputStreamReader(process.getErrorStream()));
- String line = reader.readLine();
- String errorStr = error.readLine();
- if (null == line) {
- DA_LOG.error("host md5sum get failed : " + errorStr);
- continue;
- }
- String[] splitResult = line.trim().split(CommonConstants.SPACE);
- localHashCode = new String(splitResult[0]);
- } catch (IOException e) {
- e.printStackTrace();
- continue;
- } catch (InterruptedException e) {
- e.printStackTrace();
- continue;
- }
- String targetHashCode = binInfo.getMd5sumValue();
- if (!targetHashCode.equals(localHashCode)) {
+ // check for local binary path validation
+ if (splitLocalBinaryPath.length < 3) {
localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
+ File.separator + getFileName(binPaths.get(i));
result = pullTheFile(binPaths.get(i), localBinaryPath);
if (result.isSuccess()) {
binInfo.setTempBinaryPath(localBinaryPath);
}
- continue;
} else {
- binInfo.setTempBinaryPath(localBinaryPath);
+ // host has no binary file - pull binary file from target
+ // change binary file path of host
+ File binFile = new File(localBinaryPath);
+ if (!binFile.exists()) {
+ localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
+ + File.separator + getFileName(binPaths.get(i));
+ result = pullTheFile(binPaths.get(i), localBinaryPath);
+ if (result.isSuccess()) {
+ binInfo.setTempBinaryPath(localBinaryPath);
+ }
+ } else {
+ // if local binary exist already, then check for md5sum
+ String localHashCode = null;
+ try {
+ Runtime rt = Runtime.getRuntime();
+ Process process = rt.exec(new String[] {
+ AnalyzerShellCommands.CMD_MD_5_SUM,
+ localBinaryPath });
+ process.waitFor();
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(process.getInputStream()));
+ BufferedReader error = new BufferedReader(
+ new InputStreamReader(process.getErrorStream()));
+ String line = reader.readLine();
+ String errorStr = error.readLine();
+ if (null == line) {
+ DA_LOG.error("host md5sum get failed : " + errorStr);
+ } else {
+ String[] splitResult = line.trim().split(
+ CommonConstants.SPACE);
+ localHashCode = new String(splitResult[0]);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ if (localHashCode != null) {
+ String targetHashCode = binInfo.getMd5sumValue();
+ if (!targetHashCode.equals(localHashCode)) {
+ localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
+ + File.separator
+ + getFileName(binPaths.get(i));
+ result = pullTheFile(binPaths.get(i),
+ localBinaryPath);
+ if (result.isSuccess()) {
+ binInfo.setTempBinaryPath(localBinaryPath);
+ }
+ } else {
+ binInfo.setTempBinaryPath(localBinaryPath);
+ }
+ }
+ }
}
}
BinarySettingManager.getInstance().addBinaryInfos(binInfoList);