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

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

Merge "Make sure last top time is valid." into main

parents 705a7650 24dad64b
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -3864,10 +3864,12 @@ public final class ActiveServices {
            final long lastTopTime = sr.app.mState.getLastTopTime();
            final long constantTimeLimit = getTimeLimitForFgsType(fgsType);
            final long nowUptime = SystemClock.uptimeMillis();
            if (constantTimeLimit > (nowUptime - lastTopTime)) {
            if (lastTopTime != Long.MIN_VALUE && constantTimeLimit > (nowUptime - lastTopTime)) {
                // Discard any other messages for this service
                mFGSAnrTimer.discard(sr);
                mAm.mHandler.removeMessages(ActivityManagerService.SERVICE_FGS_TIMEOUT_MSG, sr);
                // The app was in the TOP state after the FGS was started so its time allowance
                // should be counted from that time since this is considered a user interaction
                mFGSAnrTimer.discard(sr);
                final Message msg = mAm.mHandler.obtainMessage(
                                        ActivityManagerService.SERVICE_FGS_TIMEOUT_MSG, sr);
                mAm.mHandler.sendMessageAtTime(msg, lastTopTime + constantTimeLimit);