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

Commit f7cc6b28 authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

Ignore user portion when checking for system uid

In UsageStatsService, the calling uid is considered
from the system regardeless of the curret user id

Change-Id: I5c33db37c585ac918a09ad9014bb819b1e24d7f8
Fixes: 110527624
Test: manual
parent 038f1a19
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -712,13 +712,13 @@ public class UsageStatsService extends SystemService implements

            if (mPackageManagerInternal.getPackageUid(pkg, /*flags=*/ 0,
                    callingUserId) != callingUid) {
                throw new SecurityException("Calling uid " + pkg + " cannot query events"
                throw new SecurityException("Calling uid " + callingUid + " cannot query events"
                        + "for package " + pkg);
            }
        }

        private boolean isCallingUidSystem() {
            final int uid = Binder.getCallingUid();
            final int uid = UserHandle.getAppId(Binder.getCallingUid()); // ignores user
            return uid == Process.SYSTEM_UID;
        }