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

Commit 516f5731 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix race in short FGS timeout"

parents 98652d25 fbc26072
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2981,6 +2981,9 @@ public final class ActiveServices {
    void onShortFgsTimeout(ServiceRecord sr) {
        synchronized (mAm) {
            if (!sr.shouldTriggerShortFgsTimeout()) {
                if (DEBUG_SHORT_SERVICE) {
                    Slog.d(TAG_SERVICE, "[STALE] Short FGS timed out: " + sr);
                }
                return;
            }
            Slog.e(TAG_SERVICE, "Short FGS timed out: " + sr);
@@ -3021,6 +3024,9 @@ public final class ActiveServices {
            tr.mLatencyTracker.waitingOnAMSLockEnded();

            if (!sr.shouldTriggerShortFgsAnr()) {
                if (DEBUG_SHORT_SERVICE) {
                    Slog.d(TAG_SERVICE, "[STALE] Short FGS ANR'ed: " + sr);
                }
                return;
            }

+2 −2
Original line number Diff line number Diff line
@@ -1416,7 +1416,7 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN
                || !mShortFgsInfo.isCurrent()) {
            return false;
        }
        return mShortFgsInfo.getTimeoutTime() < SystemClock.uptimeMillis();
        return mShortFgsInfo.getTimeoutTime() <= SystemClock.uptimeMillis();
    }

    /**
@@ -1431,7 +1431,7 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN
                || !mShortFgsInfo.isCurrent()) {
            return false;
        }
        return mShortFgsInfo.getAnrTime() < SystemClock.uptimeMillis();
        return mShortFgsInfo.getAnrTime() <= SystemClock.uptimeMillis();
    }

    private boolean isAppAlive() {