diff options
| author | 2025-02-24 14:26:29 -0800 | |
|---|---|---|
| committer | 2025-02-24 15:55:25 -0800 | |
| commit | 0d1b245f750677319bdf1bb5a661ee65786b054e (patch) | |
| tree | 46f7347db200d4c05804ade70c0da87a628839dd | |
| parent | 878817ab6767fa16dedeb254c0ae3e609b92ec59 (diff) | |
[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
| -rw-r--r-- | services/core/java/com/android/server/am/ActiveServices.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java index cce29592d912..efbe5ca946d7 100644 --- a/services/core/java/com/android/server/am/ActiveServices.java +++ b/services/core/java/com/android/server/am/ActiveServices.java @@ -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); |