summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-04-30 20:42:48 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-04-30 20:42:48 +0000
commitc8615ba43c0abcf364b39431d8137fa8c23563c3 (patch)
tree3cb28b8b4e6823341a5437bcbff84eda24acd73a
parent705a7650f2e90a689d434d15c7d53d55d6ca55dc (diff)
parent24dad64b89fcb4c5fbb553b7523c527309dc30fc (diff)
Merge "Make sure last top time is valid." into main
-rw-r--r--services/core/java/com/android/server/am/ActiveServices.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index 23891d23cf4f..ec0d8974603e 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -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);