@@ -2978,7 +2978,8 @@ final void appNotResponding(ProcessRecord app, ActivityRecord activity,
29782978 Process.sendSignal(app.pid, Process.SIGNAL_QUIT);
29792979 }
29802980
2981- addErrorToDropBox("anr", app, activity, parent, annotation, cpuInfo, tracesFile, null);
2981+ addErrorToDropBox("anr", app, app.processName, activity, parent, annotation,
2982+ cpuInfo, tracesFile, null);
29822983
29832984 if (mController != null) {
29842985 try {
@@ -7082,16 +7083,18 @@ void skipCurrentReceiverLocked(ProcessRecord app) {
70827083 */
70837084 public void handleApplicationCrash(IBinder app, ApplicationErrorReport.CrashInfo crashInfo) {
70847085 ProcessRecord r = findAppProcess(app, "Crash");
7086+ final String processName = app == null ? "system_server"
7087+ : (r == null ? "unknown" : r.processName);
70857088
70867089 EventLog.writeEvent(EventLogTags.AM_CRASH, Binder.getCallingPid(),
7087- app == null ? "system" : (r == null ? "unknown" : r. processName) ,
7090+ processName,
70887091 r == null ? -1 : r.info.flags,
70897092 crashInfo.exceptionClassName,
70907093 crashInfo.exceptionMessage,
70917094 crashInfo.throwFileName,
70927095 crashInfo.throwLineNumber);
70937096
7094- addErrorToDropBox("crash", r, null, null, null, null, null, crashInfo);
7097+ addErrorToDropBox("crash", r, processName, null, null, null, null, null, crashInfo);
70957098
70967099 crashApplication(r, crashInfo);
70977100 }
@@ -7164,6 +7167,7 @@ private void logStrictModeViolationToDropBox(
71647167 final boolean isSystemApp = process == null ||
71657168 (process.info.flags & (ApplicationInfo.FLAG_SYSTEM |
71667169 ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) != 0;
7170+ final String processName = process == null ? "unknown" : process.processName;
71677171 final String dropboxTag = isSystemApp ? "system_app_strictmode" : "data_app_strictmode";
71687172 final DropBoxManager dbox = (DropBoxManager)
71697173 mContext.getSystemService(Context.DROPBOX_SERVICE);
@@ -7176,7 +7180,7 @@ private void logStrictModeViolationToDropBox(
71767180 final StringBuilder sb = isSystemApp ? mStrictModeBuffer : new StringBuilder(1024);
71777181 synchronized (sb) {
71787182 bufferWasEmpty = sb.length() == 0;
7179- appendDropBoxProcessHeaders(process, sb);
7183+ appendDropBoxProcessHeaders(process, processName, sb);
71807184 sb.append("Build: ").append(Build.FINGERPRINT).append("\n");
71817185 sb.append("System-App: ").append(isSystemApp).append("\n");
71827186 sb.append("Uptime-Millis: ").append(info.violationUptimeMillis).append("\n");
@@ -7278,13 +7282,15 @@ public void run() {
72787282 public boolean handleApplicationWtf(IBinder app, String tag,
72797283 ApplicationErrorReport.CrashInfo crashInfo) {
72807284 ProcessRecord r = findAppProcess(app, "WTF");
7285+ final String processName = app == null ? "system_server"
7286+ : (r == null ? "unknown" : r.processName);
72817287
72827288 EventLog.writeEvent(EventLogTags.AM_WTF, Binder.getCallingPid(),
7283- app == null ? "system" : (r == null ? "unknown" : r. processName) ,
7289+ processName,
72847290 r == null ? -1 : r.info.flags,
72857291 tag, crashInfo.exceptionMessage);
72867292
7287- addErrorToDropBox("wtf", r, null, null, tag, null, null, crashInfo);
7293+ addErrorToDropBox("wtf", r, processName, null, null, tag, null, null, crashInfo);
72887294
72897295 if (r != null && r.pid != Process.myPid() &&
72907296 Settings.Secure.getInt(mContext.getContentResolver(),
@@ -7327,26 +7333,23 @@ private ProcessRecord findAppProcess(IBinder app, String reason) {
73277333 * Utility function for addErrorToDropBox and handleStrictModeViolation's logging
73287334 * to append various headers to the dropbox log text.
73297335 */
7330- private void appendDropBoxProcessHeaders(ProcessRecord process, StringBuilder sb) {
7336+ private void appendDropBoxProcessHeaders(ProcessRecord process, String processName,
7337+ StringBuilder sb) {
73317338 // Watchdog thread ends up invoking this function (with
73327339 // a null ProcessRecord) to add the stack file to dropbox.
73337340 // Do not acquire a lock on this (am) in such cases, as it
73347341 // could cause a potential deadlock, if and when watchdog
73357342 // is invoked due to unavailability of lock on am and it
73367343 // would prevent watchdog from killing system_server.
73377344 if (process == null) {
7338- sb.append("Process: system_server \n");
7345+ sb.append("Process: ").append(processName).append(" \n");
73397346 return;
73407347 }
73417348 // Note: ProcessRecord 'process' is guarded by the service
73427349 // instance. (notably process.pkgList, which could otherwise change
73437350 // concurrently during execution of this method)
73447351 synchronized (this) {
7345- if (process.pid == MY_PID) {
7346- sb.append("Process: system_server\n");
7347- } else {
7348- sb.append("Process: ").append(process.processName).append("\n");
7349- }
7352+ sb.append("Process: ").append(processName).append("\n");
73507353 int flags = process.info.flags;
73517354 IPackageManager pm = AppGlobals.getPackageManager();
73527355 sb.append("Flags: 0x").append(Integer.toString(flags, 16)).append("\n");
@@ -7390,7 +7393,8 @@ private static String processClass(ProcessRecord process) {
73907393 * @param crashInfo giving an application stack trace, null if absent
73917394 */
73927395 public void addErrorToDropBox(String eventType,
7393- ProcessRecord process, ActivityRecord activity, ActivityRecord parent, String subject,
7396+ ProcessRecord process, String processName, ActivityRecord activity,
7397+ ActivityRecord parent, String subject,
73947398 final String report, final File logFile,
73957399 final ApplicationErrorReport.CrashInfo crashInfo) {
73967400 // NOTE -- this must never acquire the ActivityManagerService lock,
@@ -7404,7 +7408,7 @@ public void addErrorToDropBox(String eventType,
74047408 if (dbox == null || !dbox.isTagEnabled(dropboxTag)) return;
74057409
74067410 final StringBuilder sb = new StringBuilder(1024);
7407- appendDropBoxProcessHeaders(process, sb);
7411+ appendDropBoxProcessHeaders(process, processName, sb);
74087412 if (activity != null) {
74097413 sb.append("Activity: ").append(activity.shortComponentName).append("\n");
74107414 }
0 commit comments