diff --git a/core/api/current.txt b/core/api/current.txt index dab32d25deab4..1e7bcb28904ab 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -6968,6 +6968,7 @@ package android.app { method @Deprecated public void onStart(android.content.Intent, int); method public int onStartCommand(android.content.Intent, int, int); method public void onTaskRemoved(android.content.Intent); + method public void onTimeout(int); method public void onTrimMemory(int); method public boolean onUnbind(android.content.Intent); method public final void startForeground(int, android.app.Notification); @@ -12441,6 +12442,7 @@ package android.content.pm { field @Deprecated public static final int FOREGROUND_SERVICE_TYPE_NONE = 0; // 0x0 field @RequiresPermission(allOf={android.Manifest.permission.FOREGROUND_SERVICE_PHONE_CALL}, anyOf={android.Manifest.permission.MANAGE_OWN_CALLS}, conditional=true) public static final int FOREGROUND_SERVICE_TYPE_PHONE_CALL = 4; // 0x4 field @RequiresPermission(value=android.Manifest.permission.FOREGROUND_SERVICE_REMOTE_MESSAGING, conditional=true) public static final int FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING = 512; // 0x200 + field public static final int FOREGROUND_SERVICE_TYPE_SHORT_SERVICE = 2048; // 0x800 field @RequiresPermission(value=android.Manifest.permission.FOREGROUND_SERVICE_SPECIAL_USE, conditional=true) public static final int FOREGROUND_SERVICE_TYPE_SPECIAL_USE = 1073741824; // 0x40000000 field @RequiresPermission(value=android.Manifest.permission.FOREGROUND_SERVICE_SYSTEM_EXEMPTED, conditional=true) public static final int FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED = 1024; // 0x400 field public int flags; diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java index 6d7a161d16874..3a7d483c69c31 100644 --- a/core/java/android/app/Service.java +++ b/core/java/android/app/Service.java @@ -1128,12 +1128,10 @@ 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. * - * TODO Implement it - * TODO Javadoc - * - * @param startId - * @hide + * @param startId the startId passed to {@link #onStartCommand(Intent, int, int)} when + * the service started. */ public void onTimeout(int startId) { } diff --git a/core/java/android/content/pm/ServiceInfo.java b/core/java/android/content/pm/ServiceInfo.java index 9e6cf62f2397b..7ea6733fa2ff6 100644 --- a/core/java/android/content/pm/ServiceInfo.java +++ b/core/java/android/content/pm/ServiceInfo.java @@ -366,24 +366,48 @@ public class ServiceInfo extends ComponentInfo public static final int FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED = 1 << 10; /** - * Foreground service type corresponding to {@code shortService} in - * the {@link android.R.attr#foregroundServiceType} attribute. + * A foreground service type for "short-lived" services, which corresponds to + * {@code shortService} in the {@link android.R.attr#foregroundServiceType} attribute in the + * manifest. * - * TODO Implement it + *

Unlike other foreground service types, this type is not associated with a specific use + * case, and it will not require any special permissions + * (besides {@link Manifest.permission#FOREGROUND_SERVICE}). * - * TODO Expand the javadoc + * However, this type has the following restrictions. * - * This type is not associated with specific use cases unlike other types, but this has - * unique restrictions. *