aboutsummaryrefslogtreecommitdiffstats
path: root/ddms
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@google.com>2010-01-28 14:40:26 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-01-28 14:40:26 -0800
commite089d046d1f8835237e5fa27b13e3c68ed5e35ab (patch)
tree41d6e129ef6f3e93468a96d4c3fb9fb55188ae70 /ddms
parent49d14bf54ac2393ae438a3f04cea7a88032f5208 (diff)
parent1e722f56f7b84cbf1f6459a83118c3e8e216c461 (diff)
downloadsdk-e089d046d1f8835237e5fa27b13e3c68ed5e35ab.zip
sdk-e089d046d1f8835237e5fa27b13e3c68ed5e35ab.tar.gz
sdk-e089d046d1f8835237e5fa27b13e3c68ed5e35ab.tar.bz2
Merge "Display VM message on profiling error"
Diffstat (limited to 'ddms')
-rw-r--r--ddms/libs/ddmlib/src/com/android/ddmlib/ClientData.java7
-rw-r--r--ddms/libs/ddmlib/src/com/android/ddmlib/HandleProfiling.java15
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/handler/MethodProfilingHandler.java20
3 files changed, 28 insertions, 14 deletions
diff --git a/ddms/libs/ddmlib/src/com/android/ddmlib/ClientData.java b/ddms/libs/ddmlib/src/com/android/ddmlib/ClientData.java
index a064634..eca0be4 100644
--- a/ddms/libs/ddmlib/src/com/android/ddmlib/ClientData.java
+++ b/ddms/libs/ddmlib/src/com/android/ddmlib/ClientData.java
@@ -325,18 +325,21 @@ public class ClientData {
/**
* Called when method tracing failed to start
* @param client the client that was profiled.
+ * @param message an optional (<code>null<code> ok) error message to be displayed.
*/
- void onStartFailure(Client client);
+ void onStartFailure(Client client, String message);
/**
* Called when method tracing failed to end on the VM side
* @param client the client that was profiled.
+ * @param message an optional (<code>null<code> ok) error message to be displayed.
*/
- void onEndFailure(Client client);
+ void onEndFailure(Client client, String message);
/**
* Called when method tracing failed to end locally.
* @param client the client that was profiled.
+ * @param message the mandatory message to display.
*/
void onEndLocalFailure(Client client, String message);
}
diff --git a/ddms/libs/ddmlib/src/com/android/ddmlib/HandleProfiling.java b/ddms/libs/ddmlib/src/com/android/ddmlib/HandleProfiling.java
index 7d2eb45..8526975 100644
--- a/ddms/libs/ddmlib/src/com/android/ddmlib/HandleProfiling.java
+++ b/ddms/libs/ddmlib/src/com/android/ddmlib/HandleProfiling.java
@@ -156,7 +156,7 @@ final class HandleProfiling extends ChunkHandler {
Log.d("ddm-prof", "Method profiling has finished");
} else {
- handler.onEndFailure(client);
+ handler.onEndFailure(client, null /*message*/);
Log.w("ddm-prof", "Method profiling has failed (check device log)");
}
@@ -287,6 +287,15 @@ final class HandleProfiling extends ChunkHandler {
}
private void handleFAIL(Client client, ByteBuffer data) {
+ /*int errorCode =*/ data.getInt();
+ int length = data.getInt() * 2;
+ String message = null;
+ if (length > 0) {
+ byte[] messageBuffer = new byte[length];
+ data.get(messageBuffer, 0, length);
+ message = new String(messageBuffer);
+ }
+
// this can be sent if
// - MPRS failed (like wrong permission)
// - MPSE failed for whatever reason
@@ -299,14 +308,14 @@ final class HandleProfiling extends ChunkHandler {
// and notify of failure
IMethodProfilingHandler handler = ClientData.getMethodProfilingHandler();
if (handler != null) {
- handler.onStartFailure(client);
+ handler.onStartFailure(client, message);
}
} else {
// this is MPRE
// notify of failure
IMethodProfilingHandler handler = ClientData.getMethodProfilingHandler();
if (handler != null) {
- handler.onEndFailure(client);
+ handler.onEndFailure(client, message);
}
}
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/handler/MethodProfilingHandler.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/handler/MethodProfilingHandler.java
index c029186..15cb907 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/handler/MethodProfilingHandler.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/handler/MethodProfilingHandler.java
@@ -45,24 +45,26 @@ public class MethodProfilingHandler extends BaseFileHandler
super(parentShell);
}
- public void onStartFailure(final Client client) {
+ public void onStartFailure(final Client client, final String message) {
mParentShell.getDisplay().asyncExec(new Runnable() {
public void run() {
displayError(
- "Unable to create Method Profiling file for application '%1$s'.\n" +
+ "Unable to create Method Profiling file for application '%1$s'\n\n%2$s" +
"Check logcat for more information.",
- client.getClientData().getClientDescription());
+ client.getClientData().getClientDescription(),
+ message != null ? message + "\n\n" : "");
}
});
}
- public void onEndFailure(final Client client) {
+ public void onEndFailure(final Client client, final String message) {
mParentShell.getDisplay().asyncExec(new Runnable() {
public void run() {
displayError(
- "Unable to finish Method Profiling for application '%1$s'.\n" +
+ "Unable to finish Method Profiling for application '%1$s'\n\n%2$s" +
"Check logcat for more information.",
- client.getClientData().getClientDescription());
+ client.getClientData().getClientDescription(),
+ message != null ? message + "\n\n" : "");
}
});
}
@@ -70,10 +72,10 @@ public class MethodProfilingHandler extends BaseFileHandler
public void onEndLocalFailure(final Client client, final String message) {
mParentShell.getDisplay().asyncExec(new Runnable() {
public void run() {
- displayError(String.format(
- "Unable to write trace file locally for application\n\t%1$s\n\n%2$s",
+ displayError(
+ "Unable to write trace file locally for application '%1$s'\n\n%2$s",
client.getClientData().getClientDescription(),
- message));
+ message);
}
});
}