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

Commit 0d1b245f authored by Atneya Nair's avatar Atneya Nair
Browse files

[am] Add logging for FGS type change

We don't event log when an already foreground service changes its FGS
type.

Add explicit warning logging, since this could result in difficult to
detect permission issues when capabilities change.

Test: atest CtsMediaAudioPermissionTestCases
Bug: 392905501
Flag: EXEMPT logging
Change-Id: I584159016f8df77d2f833892a94f96993e2c68c3
parent 878817ab
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2616,6 +2616,13 @@ public final class ActiveServices {
                    }
                    notification.flags |= Notification.FLAG_FOREGROUND_SERVICE;
                    r.foregroundNoti = notification;
                    if (r.isForeground && foregroundServiceType != previousFgsType) {
                        // An already foreground service is being started with a different fgs type
                        // which results in the type changing without typical startForeground
                        // logging.
                        Slog.w(TAG_SERVICE, "FGS type change for " + r.shortInstanceName
                                + " from " + previousFgsType + " to " + foregroundServiceType);
                    }
                    mAm.mProcessStateController.setForegroundServiceType(r, foregroundServiceType);
                    if (!r.isForeground) {
                        final ServiceMap smap = getServiceMapLocked(r.userId);