Only invoke for callbacks watching the given package

If a watcher is registered with a packageName, it shouldn't get
callbacks for changes to a different package in a different uid.

Bug: 272358877
Test: atest CtsAppOpsTestCases
Change-Id: I1a00e6019ab20d6b0688707e00c6bcd20be3c409
This commit is contained in:
Evan Severson
2023-03-23 14:43:18 -07:00
parent 58c02458cd
commit 42d533d317

View File

@@ -1856,6 +1856,10 @@ public class AppOpsService extends IAppOpsService.Stub {
for (int i = 0; i < callbackCount; i++) {
OnOpModeChangedListener callback = callbacks.valueAt(i);
if (!callback.isWatchingUid(uid)) {
continue;
}
if (onlyForeground && (callback.getFlags()
& WATCH_FOREGROUND_CHANGES) == 0) {
continue;