return processMap;
}
+
+ public static String getProcessNameFromTarget(int pid) {
+ if (null == GlobalInformation.getCurrentDeviceInfo()) {
+ return null;
+ }
+ String processName = null;
+ cmdResultMultiLines.clear();
+ String command = String.format( AnalyzerShellCommands.CMD_PROCESS_NAME, pid );
+ // get process name from target
+ CommunicatorUtils.execShellCommand(command,
+ new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] appLines) {
+ for (int i = 0; i < appLines.length; i++) {
+ cmdResultMultiLines.add(appLines[i]);
+ }
+ }
+ });
+ processName = cmdResultMultiLines.get(1);
+ return processName;
+ }
- private static boolean isUnittest(String pkgId) {
- if (null != unittestList && !unittestList.isEmpty()) {
- for (String id : unittestList) {
- if (id.equals(pkgId)) {
- return true;
- }
- }
- }
- return false;
- }
+ public static PackageInfo getPkgInfoByLabel(String appLabel) {
+ DeviceInfo curDev = GlobalInformation.getCurrentDeviceInfo();
+ if (null != curDev) {
+ Map<String, PackageInfo> pkgHash = curDev.getPackageInfoHash();
- private static boolean isIME(String appId) {
- if (null != imeList && !imeList.isEmpty()) {
- for (String id : imeList) {
- if (id.equals(appId)) {
- return true;
+ 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();
}
}
}