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

Commit a9faa1f1 authored by Chris Tate's avatar Chris Tate Committed by Android (Google) Code Review
Browse files

Merge "Teach FGS notification deferral about service types" into sc-dev

parents b539e01c d4f33bc4
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -191,6 +191,15 @@ public final class ActiveServices {
    // calling startForeground() before we ANR + stop it.
    static final int SERVICE_START_FOREGROUND_TIMEOUT = 10 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;

    // Foreground service types that always get immediate notification display,
    // expressed in the same bitmask format that ServiceRecord.foregroundServiceType
    // uses.
    static final int FGS_IMMEDIATE_DISPLAY_MASK =
            ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK
                    | ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL
                    | ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE
                    | ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION;

    final ActivityManagerService mAm;

    // Maximum number of services that we allow to start in the background
@@ -2020,10 +2029,7 @@ public final class ActiveServices {
                }
                // or is this an type of FGS that always shows immediately?
                if (!showNow) {
                    switch (r.foregroundServiceType) {
                        case ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK:
                        case ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL:
                        case ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION:
                    if ((r.foregroundServiceType & FGS_IMMEDIATE_DISPLAY_MASK) != 0) {
                        if (DEBUG_FOREGROUND_SERVICE) {
                            Slog.d(TAG_SERVICE, "FGS " + r
                                    + " type gets immediate display");