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

Commit 7d7e1994 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Don't return non-instant permissions as granted in PackageInfo for instant apps."

parents 8ebba349 a2747c93
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -2464,7 +2464,28 @@ public class PermissionManagerService extends IPermissionManager.Stub {
            return null;
        }
        final PermissionsState permissionsState = ps.getPermissionsState();
        if (!ps.getInstantApp(userId)) {
            return permissionsState.getPermissions(userId);
        } else {
            // Install permission state is shared among all users, but instant app state is
            // per-user, so we can only filter it here unless we make install permission state
            // per-user as well.
            final Set<String> instantPermissions = new ArraySet<>(permissionsState.getPermissions(
                    userId));
            instantPermissions.removeIf(permissionName -> {
                BasePermission permission = mSettings.getPermission(permissionName);
                if (permission == null) {
                    return true;
                }
                if (!permission.isInstant()) {
                    EventLog.writeEvent(0x534e4554, "140256621", UserHandle.getUid(userId,
                            ps.getAppId()), permissionName);
                    return true;
                }
                return false;
            });
            return instantPermissions;
        }
    }

    @Nullable