Loading core/java/android/app/activity_manager.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -50,3 +50,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { namespace: "backstage_power" name: "gate_fgs_timeout_anr_behavior" description: "Gate the new behavior where an ANR is thrown once an FGS times out." bug: "339315145" metadata { purpose: PURPOSE_BUGFIX } } services/core/java/com/android/server/am/ActiveServices.java +18 −3 Original line number Diff line number Diff line Loading @@ -2454,10 +2454,19 @@ public final class ActiveServices { } else if (lastTimeOutAt > 0) { // Time limit was exhausted within the past 24 hours and the app // has not been in the TOP state since then, throw an exception. throw new ForegroundServiceStartNotAllowedException("Time limit" + " already exhausted for foreground service type " final String exceptionMsg = "Time limit already exhausted for" + " foreground service type " + ServiceInfo.foregroundServiceTypeToLabel( foregroundServiceType)); foregroundServiceType); if (!android.app.Flags.gateFgsTimeoutAnrBehavior()) { throw new ForegroundServiceStartNotAllowedException( exceptionMsg); } else { // Only throw an exception above while the new ANR behavior // is not gated, otherwise, reset the limit temporarily. Slog.wtf(TAG, exceptionMsg); fgsTypeInfo.reset(); } } } } else { Loading Loading @@ -3943,6 +3952,12 @@ public final class ActiveServices { + ServiceInfo.foregroundServiceTypeToLabel(fgsType) + " did not stop within its timeout: " + sr.getComponentName(); if (android.app.Flags.gateFgsTimeoutAnrBehavior()) { // Log a WTF instead of throwing an ANR while the new behavior is gated. Slog.wtf(TAG, reason); return; } final TimeoutRecord tr = TimeoutRecord.forFgsTimeout(reason); tr.mLatencyTracker.waitingOnAMSLockStarted(); synchronized (mAm) { Loading Loading
core/java/android/app/activity_manager.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -50,3 +50,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { namespace: "backstage_power" name: "gate_fgs_timeout_anr_behavior" description: "Gate the new behavior where an ANR is thrown once an FGS times out." bug: "339315145" metadata { purpose: PURPOSE_BUGFIX } }
services/core/java/com/android/server/am/ActiveServices.java +18 −3 Original line number Diff line number Diff line Loading @@ -2454,10 +2454,19 @@ public final class ActiveServices { } else if (lastTimeOutAt > 0) { // Time limit was exhausted within the past 24 hours and the app // has not been in the TOP state since then, throw an exception. throw new ForegroundServiceStartNotAllowedException("Time limit" + " already exhausted for foreground service type " final String exceptionMsg = "Time limit already exhausted for" + " foreground service type " + ServiceInfo.foregroundServiceTypeToLabel( foregroundServiceType)); foregroundServiceType); if (!android.app.Flags.gateFgsTimeoutAnrBehavior()) { throw new ForegroundServiceStartNotAllowedException( exceptionMsg); } else { // Only throw an exception above while the new ANR behavior // is not gated, otherwise, reset the limit temporarily. Slog.wtf(TAG, exceptionMsg); fgsTypeInfo.reset(); } } } } else { Loading Loading @@ -3943,6 +3952,12 @@ public final class ActiveServices { + ServiceInfo.foregroundServiceTypeToLabel(fgsType) + " did not stop within its timeout: " + sr.getComponentName(); if (android.app.Flags.gateFgsTimeoutAnrBehavior()) { // Log a WTF instead of throwing an ANR while the new behavior is gated. Slog.wtf(TAG, reason); return; } final TimeoutRecord tr = TimeoutRecord.forFgsTimeout(reason); tr.mLatencyTracker.waitingOnAMSLockStarted(); synchronized (mAm) { Loading