summaryrefslogtreecommitdiffstats
path: root/core/java/android/app/ApplicationErrorReport.java
diff options
context:
space:
mode:
authorDan Egnor <egnor@google.com>2009-12-09 16:22:32 -0800
committerDan Egnor <egnor@google.com>2009-12-11 13:27:04 -0800
commitb7f0367cec1c744aa66ef397b0244e25d507491c (patch)
tree7b70d87b9886ea1567647aac00fccb3198accc8c /core/java/android/app/ApplicationErrorReport.java
parentaf1255dab8fa3eab1caf9bae799f80de14a74470 (diff)
downloadframeworks_base-b7f0367cec1c744aa66ef397b0244e25d507491c.zip
frameworks_base-b7f0367cec1c744aa66ef397b0244e25d507491c.tar.gz
frameworks_base-b7f0367cec1c744aa66ef397b0244e25d507491c.tar.bz2
Eliminate CrashData and friends.
(CrashData was a custom-marshalled crash-info class used for a server crash reporting system I am deprecating). Use ApplicationErrorReport.CrashInfo instead to report crash details (mostly the stack trace) from RuntimeInfo to ActivityManagerService, since we're likely to need the crash information in that form anyway. Remove the (long-disabled) flags and support for the "Debug" button in the crash dialog. Further gut the ICheckinService interface by removing the crash-reporting APIs (and everything that calls them), plus the synchronous checkin() method (which has been stubbed out for a while now). A new dropbox-based crash reporting system is in the works, but not part of this change.
Diffstat (limited to 'core/java/android/app/ApplicationErrorReport.java')
-rw-r--r--core/java/android/app/ApplicationErrorReport.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/core/java/android/app/ApplicationErrorReport.java b/core/java/android/app/ApplicationErrorReport.java
index aeae5f9..e89b3ad0 100644
--- a/core/java/android/app/ApplicationErrorReport.java
+++ b/core/java/android/app/ApplicationErrorReport.java
@@ -19,6 +19,8 @@ package android.app;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Printer;
+import java.io.PrintWriter;
+import java.io.StringWriter;
/**
* Describes an application error.
@@ -187,6 +189,31 @@ public class ApplicationErrorReport implements Parcelable {
}
/**
+ * Create an instance of CrashInfo initialized from an exception.
+ */
+ public CrashInfo(Throwable tr) {
+ StringWriter sw = new StringWriter();
+ tr.printStackTrace(new PrintWriter(sw));
+ stackTrace = sw.toString();
+
+ // Populate fields with the "root cause" exception
+ while (tr.getCause() != null) {
+ tr = tr.getCause();
+ String msg = tr.getMessage();
+ if (msg != null && msg.length() > 0) {
+ exceptionMessage = msg;
+ }
+ }
+
+ exceptionClassName = tr.getClass().getName();
+ StackTraceElement trace = tr.getStackTrace()[0];
+ throwFileName = trace.getFileName();
+ throwClassName = trace.getClassName();
+ throwMethodName = trace.getMethodName();
+ throwLineNumber = trace.getLineNumber();
+ }
+
+ /**
* Create an instance of CrashInfo initialized from a Parcel.
*/
public CrashInfo(Parcel in) {