As requested, expand ANR event log entry (and crash/WTF too) to include
process flags (including FLAG_SYSTEM, etc).
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index b7e55d5..44b6624 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -4610,7 +4610,8 @@
         }
 
         // Log the ANR to the event log.
-        EventLog.writeEvent(EventLogTags.ANR, app.pid, app.processName, annotation);
+        EventLog.writeEvent(EventLogTags.AM_ANR, app.pid, app.processName, app.info.flags,
+                annotation);
 
         // Dump thread traces as quickly as we can, starting with "interesting" processes.
         ArrayList<Integer> pids = new ArrayList<Integer>(20);
@@ -8750,6 +8751,7 @@
 
         EventLog.writeEvent(EventLogTags.AM_CRASH, Binder.getCallingPid(),
                 app == null ? "system" : (r == null ? "unknown" : r.processName),
+                r == null ? -1 : r.info.flags,
                 crashInfo.exceptionClassName,
                 crashInfo.exceptionMessage,
                 crashInfo.throwFileName,
@@ -8773,6 +8775,7 @@
 
         EventLog.writeEvent(EventLogTags.AM_WTF, Binder.getCallingPid(),
                 app == null ? "system" : (r == null ? "unknown" : r.processName),
+                r == null ? -1 : r.info.flags,
                 tag, crashInfo.exceptionMessage);
 
         addErrorToDropBox("wtf", r, null, null, tag, null, null, crashInfo);
@@ -8842,6 +8845,7 @@
                 sb.append("Process: system_server\n");
             } else {
                 sb.append("Process: ").append(process.processName).append("\n");
+                sb.append("Flags: 0x").append(Integer.toString(process.info.flags, 16)).append("\n");
             }
             if (activity != null) {
                 sb.append("Activity: ").append(activity.shortComponentName).append("\n");
diff --git a/services/java/com/android/server/am/EventLogTags.logtags b/services/java/com/android/server/am/EventLogTags.logtags
index 952555b..0ddcc247 100644
--- a/services/java/com/android/server/am/EventLogTags.logtags
+++ b/services/java/com/android/server/am/EventLogTags.logtags
@@ -28,7 +28,7 @@
 # An activity has been resumed and is now in the foreground:
 30007 am_resume_activity (Token|1|5),(Task ID|1|5),(Component Name|3)
 # Application Not Responding
-30008 anr (pid|1|5),(Package Name|3),(reason|3)
+30008 am_anr (pid|1|5),(Package Name|3),(Flags|1|5),(reason|3)
 # Activity launch time
 30009 activity_launch_time (Token|1|5),(Component Name|3),(time|2|3)
 # Application process bound to work
@@ -80,6 +80,6 @@
 30037 am_process_start_timeout (PID|1|5),(UID|1|5),(Process Name|3)
 
 # Unhandled exception
-30039 am_crash (PID|1|5),(Process Name|3),(Exception|3),(Message|3),(File|3),(Line|1|5)
+30039 am_crash (PID|1|5),(Process Name|3),(Flags|1|5),(Exception|3),(Message|3),(File|3),(Line|1|5)
 # Log.wtf() called
-30040 am_wtf (PID|1|5),(Process Name|3),(Tag|3),(Message|3)
+30040 am_wtf (PID|1|5),(Process Name|3),(Flags|1|5),(Tag|3),(Message|3)