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

Commit 67b6e925 authored by Chris Tate's avatar Chris Tate Committed by Automerger Merge Worker
Browse files

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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13496823

Change-Id: I95f3dd400652238d34a1ea2a414faa9af56e6763
parents 3d722a09 a9faa1f1
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");