Merge "[AM] Fix system server may killed when monkey crash."
am: 21ed56daac
Change-Id: I0a556d253099eab172ac297cb3e799b9095ef853
This commit is contained in:
@@ -300,15 +300,19 @@ class AppErrors {
|
|||||||
* @param crashInfo describing the failure
|
* @param crashInfo describing the failure
|
||||||
*/
|
*/
|
||||||
void crashApplication(ProcessRecord r, ApplicationErrorReport.CrashInfo crashInfo) {
|
void crashApplication(ProcessRecord r, ApplicationErrorReport.CrashInfo crashInfo) {
|
||||||
|
final int callingPid = Binder.getCallingPid();
|
||||||
|
final int callingUid = Binder.getCallingUid();
|
||||||
|
|
||||||
final long origId = Binder.clearCallingIdentity();
|
final long origId = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
crashApplicationInner(r, crashInfo);
|
crashApplicationInner(r, crashInfo, callingPid, callingUid);
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(origId);
|
Binder.restoreCallingIdentity(origId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void crashApplicationInner(ProcessRecord r, ApplicationErrorReport.CrashInfo crashInfo) {
|
void crashApplicationInner(ProcessRecord r, ApplicationErrorReport.CrashInfo crashInfo,
|
||||||
|
int callingPid, int callingUid) {
|
||||||
long timeMillis = System.currentTimeMillis();
|
long timeMillis = System.currentTimeMillis();
|
||||||
String shortMsg = crashInfo.exceptionClassName;
|
String shortMsg = crashInfo.exceptionClassName;
|
||||||
String longMsg = crashInfo.exceptionMessage;
|
String longMsg = crashInfo.exceptionMessage;
|
||||||
@@ -327,7 +331,7 @@ class AppErrors {
|
|||||||
* finish now and don't show the app error dialog.
|
* finish now and don't show the app error dialog.
|
||||||
*/
|
*/
|
||||||
if (handleAppCrashInActivityController(r, crashInfo, shortMsg, longMsg, stackTrace,
|
if (handleAppCrashInActivityController(r, crashInfo, shortMsg, longMsg, stackTrace,
|
||||||
timeMillis)) {
|
timeMillis, callingPid, callingUid)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,15 +433,16 @@ class AppErrors {
|
|||||||
private boolean handleAppCrashInActivityController(ProcessRecord r,
|
private boolean handleAppCrashInActivityController(ProcessRecord r,
|
||||||
ApplicationErrorReport.CrashInfo crashInfo,
|
ApplicationErrorReport.CrashInfo crashInfo,
|
||||||
String shortMsg, String longMsg,
|
String shortMsg, String longMsg,
|
||||||
String stackTrace, long timeMillis) {
|
String stackTrace, long timeMillis,
|
||||||
|
int callingPid, int callingUid) {
|
||||||
if (mService.mController == null) {
|
if (mService.mController == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String name = r != null ? r.processName : null;
|
String name = r != null ? r.processName : null;
|
||||||
int pid = r != null ? r.pid : Binder.getCallingPid();
|
int pid = r != null ? r.pid : callingPid;
|
||||||
int uid = r != null ? r.info.uid : Binder.getCallingUid();
|
int uid = r != null ? r.info.uid : callingUid;
|
||||||
if (!mService.mController.appCrashed(name, pid,
|
if (!mService.mController.appCrashed(name, pid,
|
||||||
shortMsg, longMsg, timeMillis, crashInfo.stackTrace)) {
|
shortMsg, longMsg, timeMillis, crashInfo.stackTrace)) {
|
||||||
if ("1".equals(SystemProperties.get(SYSTEM_DEBUGGABLE, "0"))
|
if ("1".equals(SystemProperties.get(SYSTEM_DEBUGGABLE, "0"))
|
||||||
|
|||||||
Reference in New Issue
Block a user