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

Commit 0397e74f authored by Varun Shah's avatar Varun Shah
Browse files

Don't call FGS onTimeout if app is currently in TOP state.

Bug: n/a
Test: atest CtsFgsTimeoutTestCases
Change-Id: I773fe95fd885f3ed1dd8043d0fdedde46c1a90af
parent af52873b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -3892,9 +3892,10 @@ public final class ActiveServices {
                return;
            }

            final long lastTopTime = sr.app.mState.getLastTopTime();
            final long constantTimeLimit = getTimeLimitForFgsType(fgsType);
            final boolean currentlyTop = sr.app.mState.getCurProcState() <= PROCESS_STATE_TOP;
            final long nowUptime = SystemClock.uptimeMillis();
            final long lastTopTime = currentlyTop ? nowUptime : sr.app.mState.getLastTopTime();
            final long constantTimeLimit = getTimeLimitForFgsType(fgsType);
            if (lastTopTime != Long.MIN_VALUE && constantTimeLimit > (nowUptime - lastTopTime)) {
                // Discard any other messages for this service
                mAm.mHandler.removeMessages(ActivityManagerService.SERVICE_FGS_TIMEOUT_MSG, sr);