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

Commit 4be8a404 authored by Rhed Jao's avatar Rhed Jao
Browse files

Fix disclosure of package existence info by the createProjection api

Bug: 243792935
Test: Run the PoC app manually
Change-Id: I2a4defab5c6d3de1bdb26eef74ccb139f0a75ce3
parent d491ea05
Loading
Loading
Loading
Loading
+7 −10
Original line number Diff line number Diff line
@@ -287,19 +287,16 @@ public final class MediaProjectionManagerService extends SystemService
            if (packageName == null || packageName.isEmpty()) {
                throw new IllegalArgumentException("package name must not be empty");
            }

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

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

            MediaProjection projection;
            final long callingToken = Binder.clearCallingIdentity();
            try {
                projection = new MediaProjection(type, uid, packageName, ai.targetSdkVersion,
                        ai.isPrivilegedApp());
                if (isPermanentGrant) {