Don't return non-instant permissions as granted in PackageInfo for instant apps.
Bug: 140256621 Test: atest EphemeralTest Change-Id: I778f9311211232bc5e785229505e5b509e8d4aa8
This commit is contained in:
@@ -2464,7 +2464,28 @@ public class PermissionManagerService extends IPermissionManager.Stub {
|
||||
return null;
|
||||
}
|
||||
final PermissionsState permissionsState = ps.getPermissionsState();
|
||||
return permissionsState.getPermissions(userId);
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user