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

Commit ff624a1a authored by Varun Shah's avatar Varun Shah
Browse files

Update onTimeout api with ForegroundServiceType annotation.

Fixes: 325635747
Test: builds/flashes
Change-Id: I577f9516649b1f9f5919453356f9e40f65b38286
parent c20dce1f
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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 {
+5 −4
Original line number Diff line number Diff line
@@ -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.
@@ -1190,9 +1190,10 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac
     *
     * @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.
     * @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) {
    }
}