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

Commit b7f0367c authored by Dan Egnor's avatar Dan Egnor
Browse files

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.
parent af1255da
Loading
Loading
Loading
Loading
+10 −11
Original line number Diff line number Diff line
@@ -621,9 +621,15 @@ public class ActivityManager {
        public String longMsg;

        /**
         * Raw data about the crash (typically a stack trace).
         * The stack trace where the error originated.  May be null.
         * @pending
         */
        public byte[] crashData;
        public String stackTrace;

        /**
         * to be deprecated: This value will always be null.
         */
        public byte[] crashData = null;

        public ProcessErrorStateInfo() {
        }
@@ -640,8 +646,7 @@ public class ActivityManager {
            dest.writeString(tag);
            dest.writeString(shortMsg);
            dest.writeString(longMsg);
            dest.writeInt(crashData == null ? -1 : crashData.length);
            dest.writeByteArray(crashData);
            dest.writeString(stackTrace);
        }
        
        public void readFromParcel(Parcel source) {
@@ -652,13 +657,7 @@ public class ActivityManager {
            tag = source.readString();
            shortMsg = source.readString();
            longMsg = source.readString();
            int cdLen = source.readInt();
            if (cdLen == -1) {
                crashData = null;
            } else {
                crashData = new byte[cdLen];
                source.readByteArray(crashData);
            }
            stackTrace = source.readString();
        }
        
        public static final Creator<ProcessErrorStateInfo> CREATOR = 
+7 −18
Original line number Diff line number Diff line
@@ -982,15 +982,10 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
        case HANDLE_APPLICATION_ERROR_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            IBinder app = data.readStrongBinder();
            int fl = data.readInt();
            String tag = data.readString();
            String shortMsg = data.readString();
            String longMsg = data.readString();
            byte[] crashData = data.createByteArray();
            int res = handleApplicationError(app, fl, tag, shortMsg, longMsg,
                    crashData);
            ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
            handleApplicationError(app, tag, ci);
            reply.writeNoException();
            reply.writeInt(res);
            return true;
        }

@@ -2342,25 +2337,19 @@ class ActivityManagerProxy implements IActivityManager
        /* this base class version is never called */
        return true;
    }
    public int handleApplicationError(IBinder app, int flags,
            String tag, String shortMsg, String longMsg,
            byte[] crashData) throws RemoteException
    public void handleApplicationError(IBinder app, String tag,
            ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
    {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeStrongBinder(app);
        data.writeInt(flags);
        data.writeString(tag);
        data.writeString(shortMsg);
        data.writeString(longMsg);
        data.writeByteArray(crashData);
        crashInfo.writeToParcel(data, 0);
        mRemote.transact(HANDLE_APPLICATION_ERROR_TRANSACTION, data, reply, 0);
        reply.readException();
        int res = reply.readInt();
        reply.recycle();
        data.recycle();
        return res;
    }

    public void signalPersistentProcesses(int sig) throws RemoteException {
+27 −0
Original line number Diff line number Diff line
@@ -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.
@@ -186,6 +188,31 @@ public class ApplicationErrorReport implements Parcelable {
        public CrashInfo() {
        }

        /**
         * 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.
         */
+3 −2
Original line number Diff line number Diff line
@@ -43,8 +43,9 @@ interface IActivityController
     * normal error recovery (app crash dialog) to occur, false to kill
     * it immediately.
     */
    boolean appCrashed(String processName, int pid, String shortMsg,
            String longMsg, in byte[] crashData);
    boolean appCrashed(String processName, int pid,
            String tag, String shortMsg, String longMsg,
            long timeMillis, String stackTrace);
    
    /**
     * An application process is not responding.  Return 0 to show the "app
+3 −5
Original line number Diff line number Diff line
@@ -242,11 +242,9 @@ public interface IActivityManager extends IInterface {
    // Special low-level communication with activity manager.
    public void startRunning(String pkg, String cls, String action,
            String data) throws RemoteException;
    // Returns 1 if the user wants to debug.
    public int handleApplicationError(IBinder app,
            int flags,    /* 1 == can debug */
            String tag, String shortMsg, String longMsg,
            byte[] crashData) throws RemoteException;

    public void handleApplicationError(IBinder app, String tag,
            ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException;
    
    /*
     * This will deliver the specified signal to all the persistent processes. Currently only 
Loading