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

Commit 65403b12 authored by Olivier Gaillard's avatar Olivier Gaillard Committed by Android (Google) Code Review
Browse files

Merge "Only take the dump of the process that triggered the ANR around boot...

Merge "Only take the dump of the process that triggered the ANR around boot time to avoid expensive work." into main
parents bd193df7 d11c097c
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -62,6 +62,11 @@ class AnrHelper {
     */
    private static final long CONSECUTIVE_ANR_TIME_MS = TimeUnit.MINUTES.toMillis(2);

    /**
     * Time to wait before taking dumps for other processes to reduce load at boot time.
     */
    private static final long SELF_ONLY_AFTER_BOOT_MS = TimeUnit.MINUTES.toMillis(10);

    /**
     * The keep alive time for the threads in the helper threadpool executor
    */
@@ -231,7 +236,8 @@ class AnrHelper {
                // If there are many ANR at the same time, the latency may be larger.
                // If the latency is too large, the stack trace might not be meaningful.
                final long reportLatency = startTime - r.mTimestamp;
                final boolean onlyDumpSelf = reportLatency > EXPIRED_REPORT_TIME_MS;
                final boolean onlyDumpSelf = reportLatency > EXPIRED_REPORT_TIME_MS
                        || startTime < SELF_ONLY_AFTER_BOOT_MS;
                r.appNotResponding(onlyDumpSelf);
                final long endTime = SystemClock.uptimeMillis();
                Slog.d(TAG, "Completed ANR of " + r.mApp.processName + " in "
+2 −1
Original line number Diff line number Diff line
@@ -133,7 +133,8 @@ public class AnrHelperTest {
        verify(mAnrApp.mErrorState, timeout(TIMEOUT_MS)).appNotResponding(
                eq(activityShortComponentName), eq(appInfo), eq(parentShortComponentName),
                eq(parentProcess), eq(aboveSystem), eq(timeoutRecord), eq(mAuxExecutorService),
                eq(false) /* onlyDumpSelf */, eq(false) /*isContinuousAnr*/, eq(mEarlyDumpFuture));
                anyBoolean() /* onlyDumpSelf */, eq(false) /*isContinuousAnr*/,
                eq(mEarlyDumpFuture));
    }

    @Test