Loading core/java/android/app/Service.java +12 −0 Original line number Diff line number Diff line Loading @@ -1106,4 +1106,16 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac return sStartForegroundServiceStackTraces.get(className); } } /** * Callback called on timeout for {@link ServiceInfo#FOREGROUND_SERVICE_TYPE_SHORT_SERVICE}. * * TODO Implement it * TODO Javadoc * * @param startId * @hide */ public void onTimeout(int startId) { } } core/java/android/content/pm/ServiceInfo.java +25 −0 Original line number Diff line number Diff line Loading @@ -363,6 +363,28 @@ 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. * * TODO Implement it * * TODO Expand the javadoc * * This type is not associated with specific use cases unlike other types, but this has * unique restrictions. * <ul> * <li>Has a timeout * <li>Cannot start other foreground services from this * <li> * </ul> * * @see Service#onTimeout * * @hide */ public static final int FOREGROUND_SERVICE_TYPE_SHORT_SERVICE = 1 << 11; /** * Constant corresponding to {@code specialUse} in * the {@link android.R.attr#foregroundServiceType} attribute. Loading Loading @@ -446,6 +468,7 @@ public class ServiceInfo extends ComponentInfo FOREGROUND_SERVICE_TYPE_HEALTH, FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING, FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED, FOREGROUND_SERVICE_TYPE_SHORT_SERVICE, FOREGROUND_SERVICE_TYPE_SPECIAL_USE }) @Retention(RetentionPolicy.SOURCE) Loading Loading @@ -528,6 +551,8 @@ public class ServiceInfo extends ComponentInfo return "remoteMessaging"; case FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED: return "systemExempted"; case FOREGROUND_SERVICE_TYPE_SHORT_SERVICE: return "shortService"; case FOREGROUND_SERVICE_TYPE_SPECIAL_USE: return "specialUse"; default: Loading core/res/res/values/attrs_manifest.xml +6 −0 Original line number Diff line number Diff line Loading @@ -1704,6 +1704,12 @@ {@link android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED}. --> <flag name="systemExempted" value="0x400" /> <!-- "Short service" foreground service type. See TODO: Change it to a real link {@code android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_SHORT_SERVICE}. for more details. --> <flag name="shortService" value="0x800" /> <!-- Use cases that can't be categorized into any other foreground service types, but also can't use @link android.app.job.JobInfo.Builder} APIs. See {@link android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_SPECIAL_USE} for the Loading Loading
core/java/android/app/Service.java +12 −0 Original line number Diff line number Diff line Loading @@ -1106,4 +1106,16 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac return sStartForegroundServiceStackTraces.get(className); } } /** * Callback called on timeout for {@link ServiceInfo#FOREGROUND_SERVICE_TYPE_SHORT_SERVICE}. * * TODO Implement it * TODO Javadoc * * @param startId * @hide */ public void onTimeout(int startId) { } }
core/java/android/content/pm/ServiceInfo.java +25 −0 Original line number Diff line number Diff line Loading @@ -363,6 +363,28 @@ 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. * * TODO Implement it * * TODO Expand the javadoc * * This type is not associated with specific use cases unlike other types, but this has * unique restrictions. * <ul> * <li>Has a timeout * <li>Cannot start other foreground services from this * <li> * </ul> * * @see Service#onTimeout * * @hide */ public static final int FOREGROUND_SERVICE_TYPE_SHORT_SERVICE = 1 << 11; /** * Constant corresponding to {@code specialUse} in * the {@link android.R.attr#foregroundServiceType} attribute. Loading Loading @@ -446,6 +468,7 @@ public class ServiceInfo extends ComponentInfo FOREGROUND_SERVICE_TYPE_HEALTH, FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING, FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED, FOREGROUND_SERVICE_TYPE_SHORT_SERVICE, FOREGROUND_SERVICE_TYPE_SPECIAL_USE }) @Retention(RetentionPolicy.SOURCE) Loading Loading @@ -528,6 +551,8 @@ public class ServiceInfo extends ComponentInfo return "remoteMessaging"; case FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED: return "systemExempted"; case FOREGROUND_SERVICE_TYPE_SHORT_SERVICE: return "shortService"; case FOREGROUND_SERVICE_TYPE_SPECIAL_USE: return "specialUse"; default: Loading
core/res/res/values/attrs_manifest.xml +6 −0 Original line number Diff line number Diff line Loading @@ -1704,6 +1704,12 @@ {@link android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED}. --> <flag name="systemExempted" value="0x400" /> <!-- "Short service" foreground service type. See TODO: Change it to a real link {@code android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_SHORT_SERVICE}. for more details. --> <flag name="shortService" value="0x800" /> <!-- Use cases that can't be categorized into any other foreground service types, but also can't use @link android.app.job.JobInfo.Builder} APIs. See {@link android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_SPECIAL_USE} for the Loading