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

Commit a349ddac authored by Christopher Tate's avatar Christopher Tate Committed by android-build-team Robot
Browse files

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
(cherry picked from commit 97a609b8)
parent c8e2d916
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;
            }