Loading core/java/android/app/ActivityManager.java +10 −11 Original line number Original line Diff line number Diff line Loading @@ -621,9 +621,15 @@ public class ActivityManager { public String longMsg; 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() { public ProcessErrorStateInfo() { } } Loading @@ -640,8 +646,7 @@ public class ActivityManager { dest.writeString(tag); dest.writeString(tag); dest.writeString(shortMsg); dest.writeString(shortMsg); dest.writeString(longMsg); dest.writeString(longMsg); dest.writeInt(crashData == null ? -1 : crashData.length); dest.writeString(stackTrace); dest.writeByteArray(crashData); } } public void readFromParcel(Parcel source) { public void readFromParcel(Parcel source) { Loading @@ -652,13 +657,7 @@ public class ActivityManager { tag = source.readString(); tag = source.readString(); shortMsg = source.readString(); shortMsg = source.readString(); longMsg = source.readString(); longMsg = source.readString(); int cdLen = source.readInt(); stackTrace = source.readString(); if (cdLen == -1) { crashData = null; } else { crashData = new byte[cdLen]; source.readByteArray(crashData); } } } public static final Creator<ProcessErrorStateInfo> CREATOR = public static final Creator<ProcessErrorStateInfo> CREATOR = Loading core/java/android/app/ActivityManagerNative.java +7 −18 Original line number Original line Diff line number Diff line Loading @@ -982,15 +982,10 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM case HANDLE_APPLICATION_ERROR_TRANSACTION: { case HANDLE_APPLICATION_ERROR_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); data.enforceInterface(IActivityManager.descriptor); IBinder app = data.readStrongBinder(); IBinder app = data.readStrongBinder(); int fl = data.readInt(); String tag = data.readString(); String tag = data.readString(); String shortMsg = data.readString(); ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data); String longMsg = data.readString(); handleApplicationError(app, tag, ci); byte[] crashData = data.createByteArray(); int res = handleApplicationError(app, fl, tag, shortMsg, longMsg, crashData); reply.writeNoException(); reply.writeNoException(); reply.writeInt(res); return true; return true; } } Loading Loading @@ -2342,25 +2337,19 @@ class ActivityManagerProxy implements IActivityManager /* this base class version is never called */ /* this base class version is never called */ return true; return true; } } public int handleApplicationError(IBinder app, int flags, public void handleApplicationError(IBinder app, String tag, String tag, String shortMsg, String longMsg, ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException byte[] crashData) throws RemoteException { { Parcel data = Parcel.obtain(); Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(app); data.writeStrongBinder(app); data.writeInt(flags); data.writeString(tag); data.writeString(tag); data.writeString(shortMsg); crashInfo.writeToParcel(data, 0); data.writeString(longMsg); data.writeByteArray(crashData); mRemote.transact(HANDLE_APPLICATION_ERROR_TRANSACTION, data, reply, 0); mRemote.transact(HANDLE_APPLICATION_ERROR_TRANSACTION, data, reply, 0); reply.readException(); reply.readException(); int res = reply.readInt(); reply.recycle(); reply.recycle(); data.recycle(); data.recycle(); return res; } } public void signalPersistentProcesses(int sig) throws RemoteException { public void signalPersistentProcesses(int sig) throws RemoteException { Loading core/java/android/app/ApplicationErrorReport.java +27 −0 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,8 @@ package android.app; import android.os.Parcel; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable; import android.util.Printer; import android.util.Printer; import java.io.PrintWriter; import java.io.StringWriter; /** /** * Describes an application error. * Describes an application error. Loading Loading @@ -186,6 +188,31 @@ public class ApplicationErrorReport implements Parcelable { public CrashInfo() { 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. * Create an instance of CrashInfo initialized from a Parcel. */ */ Loading core/java/android/app/IActivityController.aidl +3 −2 Original line number Original line Diff line number Diff line Loading @@ -43,8 +43,9 @@ interface IActivityController * normal error recovery (app crash dialog) to occur, false to kill * normal error recovery (app crash dialog) to occur, false to kill * it immediately. * it immediately. */ */ boolean appCrashed(String processName, int pid, String shortMsg, boolean appCrashed(String processName, int pid, String longMsg, in byte[] crashData); String tag, String shortMsg, String longMsg, long timeMillis, String stackTrace); /** /** * An application process is not responding. Return 0 to show the "app * An application process is not responding. Return 0 to show the "app Loading core/java/android/app/IActivityManager.java +3 −5 Original line number Original line Diff line number Diff line Loading @@ -242,11 +242,9 @@ public interface IActivityManager extends IInterface { // Special low-level communication with activity manager. // Special low-level communication with activity manager. public void startRunning(String pkg, String cls, String action, public void startRunning(String pkg, String cls, String action, String data) throws RemoteException; String data) throws RemoteException; // Returns 1 if the user wants to debug. public int handleApplicationError(IBinder app, public void handleApplicationError(IBinder app, String tag, int flags, /* 1 == can debug */ ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException; String tag, String shortMsg, String longMsg, byte[] crashData) throws RemoteException; /* /* * This will deliver the specified signal to all the persistent processes. Currently only * 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 Original line Diff line number Diff line Loading @@ -621,9 +621,15 @@ public class ActivityManager { public String longMsg; 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() { public ProcessErrorStateInfo() { } } Loading @@ -640,8 +646,7 @@ public class ActivityManager { dest.writeString(tag); dest.writeString(tag); dest.writeString(shortMsg); dest.writeString(shortMsg); dest.writeString(longMsg); dest.writeString(longMsg); dest.writeInt(crashData == null ? -1 : crashData.length); dest.writeString(stackTrace); dest.writeByteArray(crashData); } } public void readFromParcel(Parcel source) { public void readFromParcel(Parcel source) { Loading @@ -652,13 +657,7 @@ public class ActivityManager { tag = source.readString(); tag = source.readString(); shortMsg = source.readString(); shortMsg = source.readString(); longMsg = source.readString(); longMsg = source.readString(); int cdLen = source.readInt(); stackTrace = source.readString(); if (cdLen == -1) { crashData = null; } else { crashData = new byte[cdLen]; source.readByteArray(crashData); } } } public static final Creator<ProcessErrorStateInfo> CREATOR = public static final Creator<ProcessErrorStateInfo> CREATOR = Loading
core/java/android/app/ActivityManagerNative.java +7 −18 Original line number Original line Diff line number Diff line Loading @@ -982,15 +982,10 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM case HANDLE_APPLICATION_ERROR_TRANSACTION: { case HANDLE_APPLICATION_ERROR_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); data.enforceInterface(IActivityManager.descriptor); IBinder app = data.readStrongBinder(); IBinder app = data.readStrongBinder(); int fl = data.readInt(); String tag = data.readString(); String tag = data.readString(); String shortMsg = data.readString(); ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data); String longMsg = data.readString(); handleApplicationError(app, tag, ci); byte[] crashData = data.createByteArray(); int res = handleApplicationError(app, fl, tag, shortMsg, longMsg, crashData); reply.writeNoException(); reply.writeNoException(); reply.writeInt(res); return true; return true; } } Loading Loading @@ -2342,25 +2337,19 @@ class ActivityManagerProxy implements IActivityManager /* this base class version is never called */ /* this base class version is never called */ return true; return true; } } public int handleApplicationError(IBinder app, int flags, public void handleApplicationError(IBinder app, String tag, String tag, String shortMsg, String longMsg, ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException byte[] crashData) throws RemoteException { { Parcel data = Parcel.obtain(); Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(app); data.writeStrongBinder(app); data.writeInt(flags); data.writeString(tag); data.writeString(tag); data.writeString(shortMsg); crashInfo.writeToParcel(data, 0); data.writeString(longMsg); data.writeByteArray(crashData); mRemote.transact(HANDLE_APPLICATION_ERROR_TRANSACTION, data, reply, 0); mRemote.transact(HANDLE_APPLICATION_ERROR_TRANSACTION, data, reply, 0); reply.readException(); reply.readException(); int res = reply.readInt(); reply.recycle(); reply.recycle(); data.recycle(); data.recycle(); return res; } } public void signalPersistentProcesses(int sig) throws RemoteException { public void signalPersistentProcesses(int sig) throws RemoteException { Loading
core/java/android/app/ApplicationErrorReport.java +27 −0 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,8 @@ package android.app; import android.os.Parcel; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable; import android.util.Printer; import android.util.Printer; import java.io.PrintWriter; import java.io.StringWriter; /** /** * Describes an application error. * Describes an application error. Loading Loading @@ -186,6 +188,31 @@ public class ApplicationErrorReport implements Parcelable { public CrashInfo() { 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. * Create an instance of CrashInfo initialized from a Parcel. */ */ Loading
core/java/android/app/IActivityController.aidl +3 −2 Original line number Original line Diff line number Diff line Loading @@ -43,8 +43,9 @@ interface IActivityController * normal error recovery (app crash dialog) to occur, false to kill * normal error recovery (app crash dialog) to occur, false to kill * it immediately. * it immediately. */ */ boolean appCrashed(String processName, int pid, String shortMsg, boolean appCrashed(String processName, int pid, String longMsg, in byte[] crashData); String tag, String shortMsg, String longMsg, long timeMillis, String stackTrace); /** /** * An application process is not responding. Return 0 to show the "app * An application process is not responding. Return 0 to show the "app Loading
core/java/android/app/IActivityManager.java +3 −5 Original line number Original line Diff line number Diff line Loading @@ -242,11 +242,9 @@ public interface IActivityManager extends IInterface { // Special low-level communication with activity manager. // Special low-level communication with activity manager. public void startRunning(String pkg, String cls, String action, public void startRunning(String pkg, String cls, String action, String data) throws RemoteException; String data) throws RemoteException; // Returns 1 if the user wants to debug. public int handleApplicationError(IBinder app, public void handleApplicationError(IBinder app, String tag, int flags, /* 1 == can debug */ ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException; String tag, String shortMsg, String longMsg, byte[] crashData) throws RemoteException; /* /* * This will deliver the specified signal to all the persistent processes. Currently only * This will deliver the specified signal to all the persistent processes. Currently only Loading