Loading services/core/java/com/android/server/am/AppErrors.java +41 −27 Original line number Diff line number Diff line Loading @@ -742,6 +742,12 @@ class AppErrors { mService.updateCpuStatsNow(); } // Unless configured otherwise, swallow ANRs in background processes & kill the process. boolean showBackground = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0; boolean isSilentANR; synchronized (mService) { // PowerManager.reboot() can block for a long time, so ignore ANRs while shutting down. if (mService.mShuttingDown) { Loading @@ -766,6 +772,9 @@ class AppErrors { // Dump thread traces as quickly as we can, starting with "interesting" processes. firstPids.add(app.pid); // Don't dump other PIDs if it's a background ANR isSilentANR = !showBackground && !app.isInterestingToUserLocked() && app.pid != MY_PID; if (!isSilentANR) { int parentPid = app.pid; if (parent != null && parent.app != null && parent.app.pid > 0) { parentPid = parent.app.pid; Loading @@ -790,6 +799,7 @@ class AppErrors { } } } } // Log the ANR to the main log. StringBuilder info = new StringBuilder(); Loading @@ -807,10 +817,18 @@ class AppErrors { info.append("Parent: ").append(parent.shortComponentName).append("\n"); } final ProcessCpuTracker processCpuTracker = new ProcessCpuTracker(true); ProcessCpuTracker processCpuTracker = new ProcessCpuTracker(true); File tracesFile = mService.dumpStackTraces(true, firstPids, processCpuTracker, lastPids, NATIVE_STACKS_OF_INTEREST); String[] nativeProcs = NATIVE_STACKS_OF_INTEREST; // don't dump native PIDs for background ANRs File tracesFile = null; if (isSilentANR) { tracesFile = mService.dumpStackTraces(true, firstPids, null, lastPids, null); } else { tracesFile = mService.dumpStackTraces(true, firstPids, processCpuTracker, lastPids, nativeProcs); } String cpuInfo = null; if (ActivityManagerService.MONITOR_CPU_USAGE) { Loading Loading @@ -854,14 +872,10 @@ class AppErrors { } } // Unless configured otherwise, swallow ANRs in background processes & kill the process. boolean showBackground = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0; synchronized (mService) { mService.mBatteryStatsService.noteProcessAnr(app.processName, app.uid); if (!showBackground && !app.isInterestingToUserLocked() && app.pid != MY_PID) { if (isSilentANR) { app.kill("bg anr", true); return; } Loading Loading
services/core/java/com/android/server/am/AppErrors.java +41 −27 Original line number Diff line number Diff line Loading @@ -742,6 +742,12 @@ class AppErrors { mService.updateCpuStatsNow(); } // Unless configured otherwise, swallow ANRs in background processes & kill the process. boolean showBackground = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0; boolean isSilentANR; synchronized (mService) { // PowerManager.reboot() can block for a long time, so ignore ANRs while shutting down. if (mService.mShuttingDown) { Loading @@ -766,6 +772,9 @@ class AppErrors { // Dump thread traces as quickly as we can, starting with "interesting" processes. firstPids.add(app.pid); // Don't dump other PIDs if it's a background ANR isSilentANR = !showBackground && !app.isInterestingToUserLocked() && app.pid != MY_PID; if (!isSilentANR) { int parentPid = app.pid; if (parent != null && parent.app != null && parent.app.pid > 0) { parentPid = parent.app.pid; Loading @@ -790,6 +799,7 @@ class AppErrors { } } } } // Log the ANR to the main log. StringBuilder info = new StringBuilder(); Loading @@ -807,10 +817,18 @@ class AppErrors { info.append("Parent: ").append(parent.shortComponentName).append("\n"); } final ProcessCpuTracker processCpuTracker = new ProcessCpuTracker(true); ProcessCpuTracker processCpuTracker = new ProcessCpuTracker(true); File tracesFile = mService.dumpStackTraces(true, firstPids, processCpuTracker, lastPids, NATIVE_STACKS_OF_INTEREST); String[] nativeProcs = NATIVE_STACKS_OF_INTEREST; // don't dump native PIDs for background ANRs File tracesFile = null; if (isSilentANR) { tracesFile = mService.dumpStackTraces(true, firstPids, null, lastPids, null); } else { tracesFile = mService.dumpStackTraces(true, firstPids, processCpuTracker, lastPids, nativeProcs); } String cpuInfo = null; if (ActivityManagerService.MONITOR_CPU_USAGE) { Loading Loading @@ -854,14 +872,10 @@ class AppErrors { } } // Unless configured otherwise, swallow ANRs in background processes & kill the process. boolean showBackground = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0; synchronized (mService) { mService.mBatteryStatsService.noteProcessAnr(app.processName, app.uid); if (!showBackground && !app.isInterestingToUserLocked() && app.pid != MY_PID) { if (isSilentANR) { app.kill("bg anr", true); return; } Loading