INTERNAL: popup error message if sdb pull is failed by security reason 71/29671/1
authorgreatim <jaewon81.lim@samsung.com>
Fri, 31 Oct 2014 11:43:02 +0000 (20:43 +0900)
committergreatim <jaewon81.lim@samsung.com>
Fri, 31 Oct 2014 11:43:02 +0000 (20:43 +0900)
popup error message if sdb pull is failed by security reason

Change-Id: I31be7cbff03ae6de1643443deb1d5949e4ec50d9
Signed-off-by: greatim <jaewon81.lim@samsung.com>
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/HostResult.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/UserErrorWarningLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/UserErrorWarningLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java

index ba6331e..b74bfbe 100755 (executable)
@@ -53,13 +53,13 @@ public enum HostResult {
 
        ERR_READELF_UPLOAD_FAILED(-205, "readelf file size is different!!"),
 
-       ERR_DEVICE_IS_NULL(-301, "current device is null"),
+       ERR_DEVICE_IS_NULL(-301, "Current device is not available"),
 
        ERR_DEVICE_IS_OFFLINE(-302, "current device is offline"),
 
        ERR_SELECTED_APP_IS_NULL(-401, "selected app is null"),
 
-       ERR_MSG_START_FAIL(-501, "start message is not ok"),
+       ERR_MSG_START_FAIL(-501, "Current application is not available"),
 
        ERR_MSG_STOP_FAIL(-502, "stop message is not ok"),
 
@@ -74,6 +74,8 @@ public enum HostResult {
        ERR_BIN_INFO_GET_FAIL(-507, "binary info get fail..."),
        
        ERR_RECEIVE_ACK_FAIL(-508, "receiving ack message fail..."),
+       
+       ERR_BY_SECURITY_REASON(-601, "error by security reason"),
 
        ERR_DA_IS_EXIT(-901, "Dynamic Analyzer is closing"),
 
index 39e285a..fbd56c4 100644 (file)
@@ -36,6 +36,8 @@ public class UserErrorWarningLabels extends NLS {
        public static String ERROR_LIB_NOT_FOUND_INRPM;
        public static String ERROR_NO_APPID_FOR_LAUNCHPAD;
        public static String ERROR_DEVICE_CONNECTION;
+       
+       public static String ERROR_BY_SECURITY_REASON;
 
        public static String WARNING_PATH_NOT_FOUND;
        public static String WARNING_FILE_NOT_FOUND;
index f608c90..3fe3a57 100644 (file)
@@ -4,6 +4,8 @@ ERROR_LIB_NOT_FOUND_INRPM=Library file cannot be found in rpm package.
 ERROR_NO_APPID_FOR_LAUNCHPAD=There is no appid for launch_app.
 ERROR_DEVICE_CONNECTION=Failed to connect with the device.\nPlease re-run Dynamic Analyzer and reboot the device.
 
+ERROR_BY_SECURITY_REASON=You cannot analyze this application for the security reason.
+
 WARNING_PATH_NOT_FOUND=Path cannot be found.
 WARNING_FILE_NOT_FOUND=File cannot be found.
 
index 326ec1b..04c88dd 100755 (executable)
@@ -74,6 +74,7 @@ import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler;
 import org.tizen.dynamicanalyzer.model.AddrSymbolPair;
 import org.tizen.dynamicanalyzer.model.DeviceInfo;
 import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.nl.UserErrorWarningLabels;
 import org.tizen.dynamicanalyzer.project.AppInfo;
 import org.tizen.dynamicanalyzer.project.BinaryInfo;
 import org.tizen.dynamicanalyzer.project.DeviceStatusInfo;
@@ -468,15 +469,20 @@ public class Communicator30 extends BaseCommunicator {
        }
 
        private HostResult pullTheFile(String from, String to) {
+               boolean becomeSuper = false;
 
                try {
-                       Global.getCurrentDeviceInfo().getIDevice().becomeSuperUser(true);
+                       becomeSuper = Global.getCurrentDeviceInfo().getIDevice().becomeSuperUser(true);
                } catch (TimeoutException e) {
                        e.printStackTrace();
                } catch (SdbCommandRejectedException e) {
                        e.printStackTrace();
                } catch (IOException e) {
                        e.printStackTrace();
+               } finally {
+                       if (!becomeSuper) {
+                               return HostResult.ERR_BY_SECURITY_REASON;
+                       }
                }
 
                SyncResult res = CommunicatorUtils.pull(from, to);
@@ -1127,6 +1133,20 @@ public class Communicator30 extends BaseCommunicator {
                                result = pullTheFile(targetPath, localBinaryPath);
                                if (result.isSuccess()) {
                                        binInfo.setTempBinaryPath(localBinaryPath);
+                               } else if (result.equals(HostResult.ERR_BY_SECURITY_REASON)) {
+                                       // popup by security reason
+                                       Display.getDefault().syncExec(new Runnable() {
+                                               @Override
+                                               public void run() {
+                                                       final Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+                                                       DADialog dialog = new DADialog(shell, SWT.NONE, 480, 153);
+                                                       dialog.setIcon(ImageResources.DIALOG_ERROR_ICON);
+                                                       dialog.setMessage(UserErrorWarningLabels.ERROR_BY_SECURITY_REASON);
+                                                       dialog.open();
+                                               }
+                                       });
+
+                                       return;
                                }
                        } else {
                                // if local binary exist already, then check for md5sum
@@ -1166,6 +1186,20 @@ public class Communicator30 extends BaseCommunicator {
                                        result = pullTheFile(targetPath, localBinaryPath);
                                        if (result.isSuccess()) {
                                                binInfo.setTempBinaryPath(localBinaryPath);
+                                       } else if (result.equals(HostResult.ERR_BY_SECURITY_REASON)) {
+                                               // popup by security reason
+                                               Display.getDefault().syncExec(new Runnable() {
+                                                       @Override
+                                                       public void run() {
+                                                               final Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+                                                               DADialog dialog = new DADialog(shell, SWT.NONE, 480, 153);
+                                                               dialog.setIcon(ImageResources.DIALOG_ERROR_ICON);
+                                                               dialog.setMessage(UserErrorWarningLabels.ERROR_BY_SECURITY_REASON);
+                                                               dialog.open();
+                                                       }
+                                               });
+
+                                               return;
                                        }
                                } else {
                                        binInfo.setTempBinaryPath(localBinaryPath);
index c80b6fd..0f3d85a 100755 (executable)
@@ -72,7 +72,6 @@ import org.tizen.dynamicanalyzer.util.ByteUtil;
 import org.tizen.dynamicanalyzer.util.CommonUtil;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.util.UnsignedInt;
-import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 
 public class MessageParser {
@@ -87,7 +86,7 @@ public class MessageParser {
        static final int MSG_BUFFER_MAX = 5000;
        static final int MSG_BUFFER_TIMER_DELAY = 5;
        static final int MSG_BUFFER_TIMER_PERIOD = 1000; // 1 second
-       static final int WAITING_TIME = 100;
+       static final int WAITING_TIME = 10;
 
        public static final int MSG_HEADER_SIZE = 20;
        final int MSG_PAYLOAD_SIZE_INDEX = 16;