summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Varun Shah <varunshah@google.com> 2024-02-17 19:14:13 +0000
committer Varun Shah <varunshah@google.com> 2024-02-17 19:14:13 +0000
commitff624a1aa14acd7055a166ce189a218aabe0e5cd (patch)
treeebd980a32954c13f3dc6454cb57293517fe715a8
parentc20dce1feca043f4441471d6c413eb65d0b1b4ae (diff)
Update onTimeout api with ForegroundServiceType annotation.
Fixes: 325635747 Test: builds/flashes Change-Id: I577f9516649b1f9f5919453356f9e40f65b38286
-rw-r--r--core/java/android/app/ActivityThread.java6
-rw-r--r--core/java/android/app/Service.java9
2 files changed, 9 insertions, 6 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index b25d5ebf61a0..f19a2b1306f4 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -1234,7 +1234,8 @@ public final class ActivityThread extends ClientTransactionHandler
}
@Override
- public final void scheduleTimeoutServiceForType(IBinder token, int startId, int fgsType) {
+ public final void scheduleTimeoutServiceForType(IBinder token, int startId,
+ @ServiceInfo.ForegroundServiceType int fgsType) {
if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) {
Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER,
"scheduleTimeoutServiceForType. token=" + token);
@@ -5159,7 +5160,8 @@ public final class ActivityThread extends ClientTransactionHandler
}
}
- private void handleTimeoutServiceForType(IBinder token, int startId, int fgsType) {
+ private void handleTimeoutServiceForType(IBinder token, int startId,
+ @ServiceInfo.ForegroundServiceType int fgsType) {
Service s = mServices.get(token);
if (s != null) {
try {
diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java
index d4702998ce3e..fe8655c13562 100644
--- a/core/java/android/app/Service.java
+++ b/core/java/android/app/Service.java
@@ -1164,7 +1164,7 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac
}
/** @hide */
- public final void callOnTimeLimitExceeded(int startId, int fgsType) {
+ public final void callOnTimeLimitExceeded(int startId, @ForegroundServiceType int fgsType) {
// Note, because all the service callbacks (and other similar callbacks, e.g. activity
// callbacks) are delivered using the main handler, it's possible the service is already
// stopped when before this method is called, so we do a double check here.
@@ -1189,10 +1189,11 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac
* Callback called when a particular foreground service type has timed out.
*
* @param startId the startId passed to {@link #onStartCommand(Intent, int, int)} when
- * the service started.
- * @param fgsType the foreground service type which caused the timeout.
+ * the service started.
+ * @param fgsType the {@link ServiceInfo.ForegroundServiceType foreground service type} which
+ * caused the timeout.
*/
@FlaggedApi(Flags.FLAG_INTRODUCE_NEW_SERVICE_ONTIMEOUT_CALLBACK)
- public void onTimeout(int startId, int fgsType) {
+ public void onTimeout(int startId, @ForegroundServiceType int fgsType) {
}
}