}
}
+ public static DAResult checkPrivilege() {
+ DeviceInfo device = Global.getCurrentDeviceInfo();
+ if (device == null) {
+ return new DAResult(ErrorCode.ERR_NO_DEVICE);
+ }
+
+ if (!CommunicatorUtils.becomeSuperUser(device.getIDevice())) {
+ return new DAResult(ErrorCode.ERR_BY_SECURITY);
+ }
+
+ return new DAResult(ErrorCode.SUCCESS);
+ }
+
public static String getRealpath(String path) {
DeviceInfo device = Global.getCurrentDeviceInfo();
if (device == null) {
ERROR_DEVICE_NOT_FOUND=There is no connected device.\nPlease check the connection with device.
ERROR_UNSUPPORTED_PROTOCOL=This version of platform of the device is not supported.\nPlease update the platform of device and retry.
-ERROR_BY_SECURITY_REASON=You cannot analyze this application for the security reason.
+ERROR_BY_SECURITY_REASON=This operation is not allowed due to security reason.
ERROR_NONEXIST_APPLICATION=does not exist in device.\nPlease check that the application has been installed successfully.
ERROR_UNSUPPORTED_APPLICATION=is unsupported application.
PackageInfo selectedPkg = curDev.getPkgInfoByLabel(appName);
if (null != selectedPkg) {
if (appName.equals(AnalyzerConstants.RUNNING_PROCESS_LABEL)) {
- 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;
- selectedPkg.getMainApp().setRunningProcesses(processes);
+ DAResult presult = DACommunicator.checkPrivilege();
+ if (presult.isSuccess()) {
+ 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;
+ selectedPkg.getMainApp().setRunningProcesses(processes);
+ }
+ } else {
+ UIAction.showWarning(presult);
}
} else if (appName.equals(AnalyzerConstants.COMMON_EXECUTABLE_LABEL)) {
Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();