Loading core/java/android/app/Service.java +16 −0 Original line number Diff line number Diff line Loading @@ -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. */ Loading core/java/android/content/pm/ServiceInfo.java +14 −2 Original line number Diff line number Diff line Loading @@ -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" Loading @@ -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; Loading Loading
core/java/android/app/Service.java +16 −0 Original line number Diff line number Diff line Loading @@ -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. */ Loading
core/java/android/content/pm/ServiceInfo.java +14 −2 Original line number Diff line number Diff line Loading @@ -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" Loading @@ -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; Loading