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

Commit 73886b41 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Correct AnrTimer use in ActiveServices" into main

parents 8c220744 47dbfaeb
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -3598,11 +3598,9 @@ public final class ActiveServices {
                    Slog.d(TAG_SERVICE, "[STALE] Short FGS timed out: " + sr
                    Slog.d(TAG_SERVICE, "[STALE] Short FGS timed out: " + sr
                            + " " + sr.getShortFgsTimedEventDescription(nowUptime));
                            + " " + sr.getShortFgsTimedEventDescription(nowUptime));
                }
                }
                mShortFGSAnrTimer.discard(sr);
                return;
                return;
            }
            }
            Slog.e(TAG_SERVICE, "Short FGS timed out: " + sr);
            Slog.e(TAG_SERVICE, "Short FGS timed out: " + sr);
            mShortFGSAnrTimer.accept(sr);
            traceInstant("short FGS timeout: ", sr);
            traceInstant("short FGS timeout: ", sr);


            logFGSStateChangeLocked(sr,
            logFGSStateChangeLocked(sr,
@@ -3682,8 +3680,10 @@ public final class ActiveServices {
                    Slog.d(TAG_SERVICE, "[STALE] Short FGS ANR'ed: " + sr
                    Slog.d(TAG_SERVICE, "[STALE] Short FGS ANR'ed: " + sr
                            + " " + sr.getShortFgsTimedEventDescription(nowUptime));
                            + " " + sr.getShortFgsTimedEventDescription(nowUptime));
                }
                }
                mShortFGSAnrTimer.discard(sr);
                return;
                return;
            }
            }
            mShortFGSAnrTimer.accept(sr);


            final String message = "Short FGS ANR'ed: " + sr;
            final String message = "Short FGS ANR'ed: " + sr;
            if (DEBUG_SHORT_SERVICE) {
            if (DEBUG_SHORT_SERVICE) {
@@ -7426,7 +7426,6 @@ public final class ActiveServices {
                    mActiveServiceAnrTimer.discard(proc);
                    mActiveServiceAnrTimer.discard(proc);
                    return;
                    return;
                }
                }
                mActiveServiceAnrTimer.accept(proc);
                final long now = SystemClock.uptimeMillis();
                final long now = SystemClock.uptimeMillis();
                final long maxTime =  now
                final long maxTime =  now
                        - (psr.shouldExecServicesFg()
                        - (psr.shouldExecServicesFg()
@@ -7445,6 +7444,7 @@ public final class ActiveServices {
                    }
                    }
                }
                }
                if (timeout != null && mAm.mProcessList.isInLruListLOSP(proc)) {
                if (timeout != null && mAm.mProcessList.isInLruListLOSP(proc)) {
                    mActiveServiceAnrTimer.accept(proc);
                    Slog.w(TAG, "Timeout executing service: " + timeout);
                    Slog.w(TAG, "Timeout executing service: " + timeout);
                    StringWriter sw = new StringWriter();
                    StringWriter sw = new StringWriter();
                    PrintWriter pw = new FastPrintWriter(sw, false, 1024);
                    PrintWriter pw = new FastPrintWriter(sw, false, 1024);
@@ -7459,6 +7459,7 @@ public final class ActiveServices {
                    timeoutRecord = TimeoutRecord.forServiceExec(timeout.shortInstanceName,
                    timeoutRecord = TimeoutRecord.forServiceExec(timeout.shortInstanceName,
                            waitedMillis);
                            waitedMillis);
                } else {
                } else {
                    mActiveServiceAnrTimer.discard(proc);
                    final long delay = psr.shouldExecServicesFg()
                    final long delay = psr.shouldExecServicesFg()
                                       ? (nextTime + mAm.mConstants.SERVICE_TIMEOUT) :
                                       ? (nextTime + mAm.mConstants.SERVICE_TIMEOUT) :
                                       (nextTime + mAm.mConstants.SERVICE_BACKGROUND_TIMEOUT)
                                       (nextTime + mAm.mConstants.SERVICE_BACKGROUND_TIMEOUT)
@@ -7493,7 +7494,6 @@ public final class ActiveServices {
                    return;
                    return;
                }
                }


                mServiceFGAnrTimer.accept(r);
                app = r.app;
                app = r.app;
                if (app != null && app.isDebugging()) {
                if (app != null && app.isDebugging()) {
                    // The app's being debugged; let it ride
                    // The app's being debugged; let it ride
@@ -7501,6 +7501,8 @@ public final class ActiveServices {
                    return;
                    return;
                }
                }


                mServiceFGAnrTimer.accept(r);

                if (DEBUG_BACKGROUND_CHECK) {
                if (DEBUG_BACKGROUND_CHECK) {
                    Slog.i(TAG, "Service foreground-required timeout for " + r);
                    Slog.i(TAG, "Service foreground-required timeout for " + r);
                }
                }