am b7f0367c: Eliminate CrashData and friends.
Merge commit 'b7f0367cec1c744aa66ef397b0244e25d507491c' into eclair-mr2-plus-aosp * commit 'b7f0367cec1c744aa66ef397b0244e25d507491c': Eliminate CrashData and friends.
This commit is contained in:
@@ -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 =
|
||||
|
||||
@@ -982,18 +982,13 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
|
||||
data.enforceInterface(IActivityManager.descriptor);
|
||||
int sig = data.readInt();
|
||||
@@ -2342,27 +2337,21 @@ 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 {
|
||||
Parcel data = Parcel.obtain();
|
||||
Parcel reply = Parcel.obtain();
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user