2727import static com.android.internal.util.XmlUtils.writeIntAttribute;
2828import static com.android.internal.util.XmlUtils.writeLongAttribute;
2929import static com.android.server.Watchdog.NATIVE_STACKS_OF_INTEREST;
30- import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
3130import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
3231import static org.xmlpull.v1.XmlPullParser.START_TAG;
3332import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID;
@@ -4958,7 +4957,7 @@ private static void dumpStackTraces(String tracesPath, ArrayList<Integer> firstP
49584957 }
49594958 }
49604959 } catch (InterruptedException e) {
4961- Log .wtf(TAG, e);
4960+ Slog .wtf(TAG, e);
49624961 }
49634962 }
49644963
@@ -4998,7 +4997,7 @@ private static void dumpStackTraces(String tracesPath, ArrayList<Integer> firstP
49984997 observer.wait(200); // Wait for write-close, give up after 200msec
49994998 }
50004999 } catch (InterruptedException e) {
5001- Log .wtf(TAG, e);
5000+ Slog .wtf(TAG, e);
50025001 }
50035002
50045003 }
@@ -7918,9 +7917,9 @@ private void readGrantedUriPermissionsLocked() {
79187917 } catch (FileNotFoundException e) {
79197918 // Missing grants is okay
79207919 } catch (IOException e) {
7921- Log .wtf(TAG, "Failed reading Uri grants", e);
7920+ Slog .wtf(TAG, "Failed reading Uri grants", e);
79227921 } catch (XmlPullParserException e) {
7923- Log .wtf(TAG, "Failed reading Uri grants", e);
7922+ Slog .wtf(TAG, "Failed reading Uri grants", e);
79247923 } finally {
79257924 IoUtils.closeQuietly(fis);
79267925 }
@@ -11713,32 +11712,25 @@ public void run() {
1171311712 * @param crashInfo describing the context of the error
1171411713 * @return true if the process should exit immediately (WTF is fatal)
1171511714 */
11716- public boolean handleApplicationWtf(IBinder app, final String tag, boolean system,
11715+ public boolean handleApplicationWtf(final IBinder app, final String tag, boolean system,
1171711716 final ApplicationErrorReport.CrashInfo crashInfo) {
11718- final ProcessRecord r = findAppProcess(app, "WTF");
11719- final String processName = app == null ? "system_server"
11720- : (r == null ? "unknown" : r.processName);
11721-
11722- EventLog.writeEvent(EventLogTags.AM_WTF,
11723- UserHandle.getUserId(Binder.getCallingUid()), Binder.getCallingPid(),
11724- processName,
11725- r == null ? -1 : r.info.flags,
11726- tag, crashInfo.exceptionMessage);
11717+ final int callingUid = Binder.getCallingUid();
11718+ final int callingPid = Binder.getCallingPid();
1172711719
1172811720 if (system) {
1172911721 // If this is coming from the system, we could very well have low-level
1173011722 // system locks held, so we want to do this all asynchronously. And we
1173111723 // never want this to become fatal, so there is that too.
1173211724 mHandler.post(new Runnable() {
1173311725 @Override public void run() {
11734- addErrorToDropBox("wtf", r, processName, null, null, tag, null, null,
11735- crashInfo);
11726+ handleApplicationWtfInner(callingUid, callingPid, app, tag, crashInfo);
1173611727 }
1173711728 });
1173811729 return false;
1173911730 }
1174011731
11741- addErrorToDropBox("wtf", r, processName, null, null, tag, null, null, crashInfo);
11732+ final ProcessRecord r = handleApplicationWtfInner(callingUid, callingPid, app, tag,
11733+ crashInfo);
1174211734
1174311735 if (r != null && r.pid != Process.myPid() &&
1174411736 Settings.Global.getInt(mContext.getContentResolver(),
@@ -11750,6 +11742,20 @@ public boolean handleApplicationWtf(IBinder app, final String tag, boolean syste
1175011742 }
1175111743 }
1175211744
11745+ ProcessRecord handleApplicationWtfInner(int callingUid, int callingPid, IBinder app, String tag,
11746+ final ApplicationErrorReport.CrashInfo crashInfo) {
11747+ final ProcessRecord r = findAppProcess(app, "WTF");
11748+ final String processName = app == null ? "system_server"
11749+ : (r == null ? "unknown" : r.processName);
11750+
11751+ EventLog.writeEvent(EventLogTags.AM_WTF, UserHandle.getUserId(callingUid), callingPid,
11752+ processName, r == null ? -1 : r.info.flags, tag, crashInfo.exceptionMessage);
11753+
11754+ addErrorToDropBox("wtf", r, processName, null, null, tag, null, null, crashInfo);
11755+
11756+ return r;
11757+ }
11758+
1175311759 /**
1175411760 * @param app object of some object (as stored in {@link com.android.internal.os.RuntimeInit})
1175511761 * @return the corresponding {@link ProcessRecord} object, or null if none could be found
0 commit comments