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

Commit 65a3bef1 authored by Varun Shah's avatar Varun Shah
Browse files

Remove flag usages of service ontimeout callback.

The feature was rolled out in A15.

Fixes: 428944450
Test: atest FgsTimeoutConfigsTest
Test: atest FgsTimeoutTest
Flag: EXEMPT removing android.app.introduce_new_service_ontimeout_callback
FCRS_CODE : mcmypcvp8tujyu

Change-Id: I065aa87884575d58d582bc37ed7f9c13972dbc3e
parent 3759739a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7765,7 +7765,7 @@ package android.app {
    method public int onStartCommand(android.content.Intent, int, int);
    method public void onTaskRemoved(android.content.Intent);
    method public void onTimeout(int);
    method @FlaggedApi("android.app.introduce_new_service_ontimeout_callback") public void onTimeout(int, int);
    method public void onTimeout(int, int);
    method public void onTrimMemory(int);
    method public boolean onUnbind(android.content.Intent);
    method public final void startForeground(int, android.app.Notification);
+2 −8
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST;
import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER;
import static android.text.TextUtils.formatSimple;

import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -1135,10 +1134,8 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac
        } catch (RemoteException ex) {
        }
        onTimeout(startId);
        if (Flags.introduceNewServiceOntimeoutCallback()) {
        onTimeout(startId, ServiceInfo.FOREGROUND_SERVICE_TYPE_SHORT_SERVICE);
    }
    }

    /**
     * Callback called on timeout for {@link ServiceInfo#FOREGROUND_SERVICE_TYPE_SHORT_SERVICE}.
@@ -1189,10 +1186,8 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac
            }
        } catch (RemoteException ex) {
        }
        if (Flags.introduceNewServiceOntimeoutCallback()) {
        onTimeout(startId, fgsType);
    }
    }

    /**
     * Callback called when a particular foreground service type has timed out.
@@ -1220,7 +1215,6 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac
     * @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, @ForegroundServiceType int fgsType) {
    }
}
+1 −3
Original line number Diff line number Diff line
@@ -2420,7 +2420,6 @@ public final class ActiveServices {
                        }
                    } else if (CompatChanges.isChangeEnabled(
                                    FGS_INTRODUCE_TIME_LIMITS, r.appInfo.uid)
                                && android.app.Flags.introduceNewServiceOntimeoutCallback()
                                && getTimeLimitedFgsType(foregroundServiceType)
                                        != ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE) {
                        // Calling startForeground on a FGS type which has a time limit will only be
@@ -2723,8 +2722,7 @@ public final class ActiveServices {
                    mAm.notifyPackageUse(r.serviceInfo.packageName,
                            PackageManager.NOTIFY_PACKAGE_USE_FOREGROUND_SERVICE);

                    if (CompatChanges.isChangeEnabled(FGS_INTRODUCE_TIME_LIMITS, r.appInfo.uid)
                            && android.app.Flags.introduceNewServiceOntimeoutCallback()) {
                    if (CompatChanges.isChangeEnabled(FGS_INTRODUCE_TIME_LIMITS, r.appInfo.uid)) {
                        maybeUpdateFgsTrackingLocked(r, previousFgsType);
                    }
                } else {