From ba82ea3c5d628f5039fa615de42cb92b3752400b Mon Sep 17 00:00:00 2001 From: Varun Shah <varunshah@google.com> Date: Fri, 19 Apr 2024 17:33:24 +0000 Subject: [PATCH] Don't throw ANR if onTimeout flag is disabled. Bug: 327566365 Test: atest CtsFgsTimeoutTestCases (cherry picked from commit 21492dcd91c86fa06c423fbe60876a219421892f) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:78f268a3bbbba1233aba5ba675563b2b62d90f76) Merged-In: I6601fd1af8cd617bae5e3c3deb1019d65c5e3908 Change-Id: I6601fd1af8cd617bae5e3c3deb1019d65c5e3908 --- services/core/java/com/android/server/am/ActiveServices.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java index b8e09cce93b9..24eba4acb6a5 100644 --- a/services/core/java/com/android/server/am/ActiveServices.java +++ b/services/core/java/com/android/server/am/ActiveServices.java @@ -3696,7 +3696,9 @@ public final class ActiveServices { // is not "now". Compute the time from "now" when starting the anr timer. final long anrTime = sr.getEarliestStopTypeAndTime().second + mAm.mConstants.mFgsAnrExtraWaitDuration - SystemClock.uptimeMillis(); - mFGSAnrTimer.start(sr, anrTime); + if (android.app.Flags.introduceNewServiceOntimeoutCallback()) { + mFGSAnrTimer.start(sr, anrTime); + } } } -- GitLab