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

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

Merge "Remove flag guarding FGS timeout crash behavior." into main

parents 362599f1 b64344f4
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -51,16 +51,6 @@ flag {
     }
}

flag {
     namespace: "backstage_power"
     name: "enable_fgs_timeout_crash_behavior"
     description: "Enable the new behavior where the app is crashed once an FGS times out."
     bug: "339526947"
     metadata {
         purpose: PURPOSE_BUGFIX
     }
}

flag {
     namespace: "backstage_power"
     name: "skip_bg_mem_trim_on_fg_app"
+14 −27
Original line number Diff line number Diff line
@@ -2460,19 +2460,11 @@ 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.
                                    final String exceptionMsg = "Time limit already exhausted for"
                                    throw new ForegroundServiceStartNotAllowedException(
                                            "Time limit already exhausted for "
                                                    + "foreground service type "
                                                    + ServiceInfo.foregroundServiceTypeToLabel(
                                                    foregroundServiceType);
                                    // Only throw an exception if the new crashing logic gate
                                    // is enabled; otherwise, reset the limit temporarily.
                                    if (android.app.Flags.enableFgsTimeoutCrashBehavior()) {
                                        throw new ForegroundServiceStartNotAllowedException(
                                                    exceptionMsg);
                                    } else {
                                        Slog.wtf(TAG, exceptionMsg);
                                        fgsTypeInfo.reset();
                                    }
                                                            foregroundServiceType));
                                }
                            }
                        } else {
@@ -3979,7 +3971,6 @@ public final class ActiveServices {
            final String reason = "A foreground service of type "
                    + ServiceInfo.foregroundServiceTypeToLabel(fgsType)
                    + " did not stop within its timeout: " + sr.getComponentName();
            if (android.app.Flags.enableFgsTimeoutCrashBehavior()) {
            // Crash the app
            Slog.e(TAG_SERVICE, "FGS Crashed: " + sr);
            traceInstant("FGS Crash: ", sr);
@@ -3990,10 +3981,6 @@ public final class ActiveServices {
                        ForegroundServiceDidNotStopInTimeException
                                .createExtrasForService(sr.getComponentName()));
            }
            } else {
                // Log a WTF instead of crashing the app while the new behavior is gated.
                Slog.wtf(TAG, reason);
            }
        }
    }