diff options
| author | 2021-06-03 09:30:03 -0700 | |
|---|---|---|
| committer | 2021-06-03 09:30:03 -0700 | |
| commit | 97a609b82c7ee97cad0cdce853a8408a36b6ba78 (patch) | |
| tree | aac93cec12b30a5580a35852f4f4aa2a3883229c | |
| parent | 10de71a3807af1d36b9b1f47a31363a71e1db2f5 (diff) | |
Fix false-positive matching of notification to FGS
A combination of "uninitialized == 0 which is a valid and commonly used
notification ID" with an incomplete check for "FGS with this
notification."
Bug: 189990824
Test: atest CtsAppTestCases:android.app.cts.ServiceTest
Test: atest CtsAppTestCases:android.app.cts.NotificationManagerTest
Change-Id: I845600325c4098e6b6af2f038de4c7aac9899694
| -rw-r--r-- | services/core/java/com/android/server/am/ActiveServices.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java index 9e4290098843..e16a68d2167b 100644 --- a/services/core/java/com/android/server/am/ActiveServices.java +++ b/services/core/java/com/android/server/am/ActiveServices.java @@ -2002,7 +2002,9 @@ public final class ActiveServices { for (int i = 0; i < smap.mServicesByInstanceName.size(); i++) { final ServiceRecord sr = smap.mServicesByInstanceName.valueAt(i); - if (id != sr.foregroundId || !pkg.equals(sr.appInfo.packageName)) { + if (!sr.isForeground + || id != sr.foregroundId + || !pkg.equals(sr.appInfo.packageName)) { // Not this one; keep looking continue; } |