Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8186552 authored by Alberto Gonzalez's avatar Alberto Gonzalez
Browse files

Record the current default unhandled exception handler in DropBox.

Test: manual

Change-Id: If92d8bdfc8e5f1345010130c51925e98fc97ed6d
parent c9f75fda
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -298,6 +298,12 @@ public class ApplicationErrorReport implements Parcelable {
     * Describes an application crash.
     */
    public static class CrashInfo {
        /**
         * The name of the exception handler that is installed.
         * @hide
         */
        public String exceptionHandlerClassName;

        /**
         * Class name of the exception that caused the crash.
         */
@@ -369,6 +375,14 @@ public class ApplicationErrorReport implements Parcelable {
                }
            }

            // Populate the currently installed exception handler.
            Thread.UncaughtExceptionHandler handler = Thread.getDefaultUncaughtExceptionHandler();
            if (handler != null) {
                exceptionHandlerClassName = handler.getClass().getName();
            } else {
                exceptionHandlerClassName = "unknown";
            }

            exceptionClassName = rootTr.getClass().getName();
            if (rootTr.getStackTrace().length > 0) {
                StackTraceElement trace = rootTr.getStackTrace()[0];
@@ -416,6 +430,7 @@ public class ApplicationErrorReport implements Parcelable {
         * Create an instance of CrashInfo initialized from a Parcel.
         */
        public CrashInfo(Parcel in) {
            exceptionHandlerClassName = in.readString();
            exceptionClassName = in.readString();
            exceptionMessage = in.readString();
            throwFileName = in.readString();
@@ -431,6 +446,7 @@ public class ApplicationErrorReport implements Parcelable {
         */
        public void writeToParcel(Parcel dest, int flags) {
            int start = dest.dataPosition();
            dest.writeString(exceptionHandlerClassName);
            dest.writeString(exceptionClassName);
            dest.writeString(exceptionMessage);
            dest.writeString(throwFileName);
@@ -441,6 +457,7 @@ public class ApplicationErrorReport implements Parcelable {
            dest.writeString(crashTag);
            int total = dest.dataPosition()-start;
            if (Binder.CHECK_PARCEL_SIZE && total > 20*1024) {
                Slog.d("Error", "ERR: exHandler=" + exceptionHandlerClassName);
                Slog.d("Error", "ERR: exClass=" + exceptionClassName);
                Slog.d("Error", "ERR: exMsg=" + exceptionMessage);
                Slog.d("Error", "ERR: file=" + throwFileName);
@@ -455,6 +472,7 @@ public class ApplicationErrorReport implements Parcelable {
         * Dump a CrashInfo instance to a Printer.
         */
        public void dump(Printer pw, String prefix) {
            pw.println(prefix + "exceptionHandlerClassName: " + exceptionHandlerClassName);
            pw.println(prefix + "exceptionClassName: " + exceptionClassName);
            pw.println(prefix + "exceptionMessage: " + exceptionMessage);
            pw.println(prefix + "throwFileName: " + throwFileName);
+4 −0
Original line number Diff line number Diff line
@@ -9159,6 +9159,10 @@ public class ActivityManagerService extends IActivityManager.Stub
        if (Debug.isDebuggerConnected()) {
            sb.append("Debugger: Connected\n");
        }
        if (crashInfo != null && crashInfo.exceptionHandlerClassName != null
                && !crashInfo.exceptionHandlerClassName.isEmpty()) {
            sb.append("Crash-Handler: ").append(crashInfo.exceptionHandlerClassName).append("\n");
        }
        if (crashInfo != null && crashInfo.crashTag != null && !crashInfo.crashTag.isEmpty()) {
            sb.append("Crash-Tag: ").append(crashInfo.crashTag).append("\n");
        }