summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mark Lu <Mark_Lu@htc.com> 2016-11-29 14:47:46 +0000
committer android-build-merger <android-build-merger@google.com> 2016-11-29 14:47:46 +0000
commitfe9e70db6f45d148658cc847029d6ef19e2c1803 (patch)
treef3e270fb1a610f29079449339e1cebac921e9910
parent2d4183ffa58df5b14698eb7bb4ed8fc4a65f81bb (diff)
parente2ccdd9d93f45d371ef57e2c232c425c88f1e952 (diff)
Merge "[AM] Fix system server may killed when monkey crash." am: 21ed56daac am: ef4267e53a
am: e2ccdd9d93 Change-Id: I4b4194468b08a568963c8dd223d5192ae3041806
-rw-r--r--services/core/java/com/android/server/am/AppErrors.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/am/AppErrors.java b/services/core/java/com/android/server/am/AppErrors.java
index c19a5710666b..dfcb15d40669 100644
--- a/services/core/java/com/android/server/am/AppErrors.java
+++ b/services/core/java/com/android/server/am/AppErrors.java
@@ -300,15 +300,19 @@ class AppErrors {
* @param crashInfo describing the failure
*/
void crashApplication(ProcessRecord r, ApplicationErrorReport.CrashInfo crashInfo) {
+ final int callingPid = Binder.getCallingPid();
+ final int callingUid = Binder.getCallingUid();
+
final long origId = Binder.clearCallingIdentity();
try {
- crashApplicationInner(r, crashInfo);
+ crashApplicationInner(r, crashInfo, callingPid, callingUid);
} finally {
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();
String shortMsg = crashInfo.exceptionClassName;
String longMsg = crashInfo.exceptionMessage;
@@ -327,7 +331,7 @@ class AppErrors {
* finish now and don't show the app error dialog.
*/
if (handleAppCrashInActivityController(r, crashInfo, shortMsg, longMsg, stackTrace,
- timeMillis)) {
+ timeMillis, callingPid, callingUid)) {
return;
}
@@ -429,15 +433,16 @@ class AppErrors {
private boolean handleAppCrashInActivityController(ProcessRecord r,
ApplicationErrorReport.CrashInfo crashInfo,
String shortMsg, String longMsg,
- String stackTrace, long timeMillis) {
+ String stackTrace, long timeMillis,
+ int callingPid, int callingUid) {
if (mService.mController == null) {
return false;
}
try {
String name = r != null ? r.processName : null;
- int pid = r != null ? r.pid : Binder.getCallingPid();
- int uid = r != null ? r.info.uid : Binder.getCallingUid();
+ int pid = r != null ? r.pid : callingPid;
+ int uid = r != null ? r.info.uid : callingUid;
if (!mService.mController.appCrashed(name, pid,
shortMsg, longMsg, timeMillis, crashInfo.stackTrace)) {
if ("1".equals(SystemProperties.get(SYSTEM_DEBUGGABLE, "0"))