Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66524247 authored by Brian Carlstrom's avatar Brian Carlstrom
Browse files

Dump native stack for background ANR if process is of interest

Bug: 30112521
Bug: 36043456
Bug: 35241370
Test: make -j32 -k && flashall
Change-Id: I25b134ec24c534f3cfeb5a7c43195da3a6285d57
parent c1b59ed7
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
@@ -857,17 +857,26 @@ class AppErrors {

        ProcessCpuTracker processCpuTracker = new ProcessCpuTracker(true);

        String[] nativeProcs = NATIVE_STACKS_OF_INTEREST;
        // don't dump native PIDs for background ANRs
        File tracesFile = null;
        // don't dump native PIDs for background ANRs unless it is the process of interest
        String[] nativeProcs = null;
        if (isSilentANR) {
            tracesFile = mService.dumpStackTraces(true, firstPids, null, lastPids,
                null);
            for (int i = 0; i < NATIVE_STACKS_OF_INTEREST.length; i++) {
                if (NATIVE_STACKS_OF_INTEREST[i].equals(app.processName)) {
                    nativeProcs = new String[] { app.processName };
                    break;
                }
            }
        } else {
            tracesFile = mService.dumpStackTraces(true, firstPids, processCpuTracker, lastPids,
                nativeProcs);
            nativeProcs = NATIVE_STACKS_OF_INTEREST;
        }

        // For background ANRs, don't pass the ProcessCpuTracker to
        // avoid spending 1/2 second collecting stats to rank lastPids.
        File tracesFile = mService.dumpStackTraces(true, firstPids,
                                                   (isSilentANR) ? null : processCpuTracker,
                                                   (isSilentANR) ? null : lastPids,
                                                   nativeProcs);

        String cpuInfo = null;
        if (ActivityManagerService.MONITOR_CPU_USAGE) {
            mService.updateCpuStatsNow();