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

Commit 854b2a85 authored by Makoto Onuki's avatar Makoto Onuki Committed by Android (Google) Code Review
Browse files

Merge "Update the javadoc on SHORT_SERVICE fgs type"

parents b0199cdb c93d310d
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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.
     */
+14 −2
Original line number Diff line number Diff line
@@ -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;