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

Commit e6d63d72 authored by Narayan Kamath's avatar Narayan Kamath
Browse files

MediaProjectionManagerService: Use the right user for app lookups.

We should always use the calling user to lookup the app, since that's
whom the projection grant has been authorized to.

Test: manual
Bug: 130574635
Change-Id: I74b626a41d77f1a1d4868ed0b8333c612ba31af3
parent 87d2f6c9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -282,13 +282,14 @@ public final class MediaProjectionManagerService extends SystemService
                throw new IllegalArgumentException("package name must not be empty");
            }

            final UserHandle callingUser = Binder.getCallingUserHandle();
            long callingToken = Binder.clearCallingIdentity();

            MediaProjection projection;
            try {
                ApplicationInfo ai;
                try {
                    ai = mPackageManager.getApplicationInfo(packageName, 0);
                    ai = mPackageManager.getApplicationInfoAsUser(packageName, 0, callingUser);
                } catch (NameNotFoundException e) {
                    throw new IllegalArgumentException("No package matching :" + packageName);
                }