NativeDaemonConnector: Improve NativeDaemonException reporting to include the actual error response

Signed-off-by: San Mehat <san@google.com>
diff --git a/services/java/com/android/server/NativeDaemonConnector.java b/services/java/com/android/server/NativeDaemonConnector.java
index 016aa52..9a066d3 100644
--- a/services/java/com/android/server/NativeDaemonConnector.java
+++ b/services/java/com/android/server/NativeDaemonConnector.java
@@ -219,19 +219,23 @@
                             String.format("Invalid response from daemon (%s)", line));
                 }
 
-                if ((code >= 200) && (code < 600))
+                if ((code >= 200) && (code < 600)) {
                     complete = true;
+                }
                 response.add(line);
             } catch (InterruptedException ex) {
-                Log.e(TAG, "InterruptedException");
+                Log.e(TAG, "Failed to process response", ex);
             }
         }
 
         if (code >= ResponseCode.FailedRangeStart &&
                 code <= ResponseCode.FailedRangeEnd) {
-            throw new NativeDaemonConnectorException(code, String.format(
-                                               "Command %s failed with code %d",
-                                                cmd, code));
+            /*
+             * Note: The format of the last response in this case is
+             *        "NNN <errmsg>"
+             */
+            throw new NativeDaemonConnectorException(
+                    code, cmd, response.get(response.size()-1).substring(4));
         }
         return response;
     }