Update the javadoc on SHORT_SERVICE fgs type

Test: presubmit (javadoc change only)
Fix: 261607168
Change-Id: I1651a175fb40ce1477ef74b487b696db7effa501
This commit is contained in:
Makoto Onuki
2023-01-31 16:34:06 -08:00
parent b69c202024
commit c93d310dc9
2 changed files with 30 additions and 2 deletions

View File

@@ -1140,6 +1140,22 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac
* Callback called on timeout for {@link ServiceInfo#FOREGROUND_SERVICE_TYPE_SHORT_SERVICE}.
* See {@link ServiceInfo#FOREGROUND_SERVICE_TYPE_SHORT_SERVICE} for more details.
*
* <p>If the foreground service of type
* {@link ServiceInfo#FOREGROUND_SERVICE_TYPE_SHORT_SERVICE}
* doesn't finish even after it's timed out,
* the app will be declared an ANR after a short grace period of several seconds.
*
* <p>Note, even though
* {@link ServiceInfo#FOREGROUND_SERVICE_TYPE_SHORT_SERVICE}
* was added
* on Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
* it can be also used on
* on prior android versions (just like other new foreground service types can be used).
* However, because {@link android.app.Service#onTimeout(int)} did not exist on prior versions,
* it will never called on such versions.
* Because of this, developers must make sure to stop the foreground service even if
* {@link android.app.Service#onTimeout(int)} is not called on such versions.
*
* @param startId the startId passed to {@link #onStartCommand(Intent, int, int)} when
* the service started.
*/

View File

@@ -401,8 +401,9 @@ public class ServiceInfo extends ComponentInfo
*
* <p>If the service isn't stopped within the timeout,
* {@link android.app.Service#onTimeout(int)} will be called.
* If the service is still not stopped after the callback,
* the app will be declared an ANR.
*
* <p>If the service is still not stopped after the callback,
* the app will be declared an ANR after a short grace period of several seconds.
*
* <li>
* A foreground service of this type cannot be made "sticky"
@@ -419,6 +420,17 @@ public class ServiceInfo extends ComponentInfo
* </a>
* </ul>
*
* <p>Note, even though
* {@link ServiceInfo#FOREGROUND_SERVICE_TYPE_SHORT_SERVICE}
* was added
* on Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
* it can be also used on
* on prior android versions (just like other new foreground service types can be used).
* However, because {@link android.app.Service#onTimeout(int)} did not exist on prior versions,
* it will never called on such versions.
* Because of this, developers must make sure to stop the foreground service even if
* {@link android.app.Service#onTimeout(int)} is not called on such versions.
*
* @see android.app.Service#onTimeout(int)
*/
public static final int FOREGROUND_SERVICE_TYPE_SHORT_SERVICE = 1 << 11;