From 5031c3a4f63a4a843eefdb49fe5e06ea25a4e482 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Fri, 6 Aug 2021 14:10:29 -0700 Subject: Clarify how FGS restriction won't apply STICKY FGS restarts Fix: 195780554 Test: build Change-Id: Ic627a89ac863729d36554070d04c22254747f014 --- core/java/android/app/Service.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java index 7cb1d89aa954..336387204410 100644 --- a/core/java/android/app/Service.java +++ b/core/java/android/app/Service.java @@ -387,6 +387,13 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac *

This mode makes sense for things that will be explicitly started * and stopped to run for arbitrary periods of time, such as a service * performing background music playback. + * + *

Since Android version {@link Build.VERSION_CODES#S}, apps + * targeting {@link Build.VERSION_CODES#S} or above are disallowed + * to start a foreground service from the background, but the restriction + * doesn't impact restarts of a sticky foreground service. However, + * when apps start a sticky foreground service from the background, + * the same restriction still applies. */ public static final int START_STICKY = 1; -- cgit v1.2.3-59-g8ed1b