Loading core/java/android/app/ActivityManager.java +10 −11 Original line number Diff line number Diff line Loading @@ -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() { } Loading @@ -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) { Loading @@ -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 = Loading core/java/android/app/ActivityManagerNative.java +7 −18 Original line number Diff line number Diff line Loading @@ -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; } Loading Loading @@ -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 { Loading core/java/android/app/ApplicationErrorReport.java +27 −0 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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. */ Loading core/java/android/app/IActivityController.aidl +3 −2 Original line number Diff line number Diff line Loading @@ -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 Loading core/java/android/app/IActivityManager.java +3 −5 Original line number Diff line number Diff line Loading @@ -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 Loading
core/java/android/app/ActivityManager.java +10 −11 Original line number Diff line number Diff line Loading @@ -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() { } Loading @@ -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) { Loading @@ -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 = Loading
core/java/android/app/ActivityManagerNative.java +7 −18 Original line number Diff line number Diff line Loading @@ -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; } Loading Loading @@ -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 { Loading
core/java/android/app/ApplicationErrorReport.java +27 −0 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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. */ Loading
core/java/android/app/IActivityController.aidl +3 −2 Original line number Diff line number Diff line Loading @@ -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 Loading
core/java/android/app/IActivityManager.java +3 −5 Original line number Diff line number Diff line Loading @@ -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