Have getVolumeList() take a userId instead of a UID.
getVolumeList() previously accepted a uid and a packagename. This approach has a few issues: 1) The uid wasn't actually checked in the implementation to match the calling UID, nor was the package name checked against the UID in all cases. 2) The implementation assumed that the UID also specificies the userId that we want to get the volumes for. This was historically true, but with the new app cloning implementation, MediaProvider running in user 0 might ask for volumes in the clone user. To fix this, explicitly pass in the userId that we're requesting volumes for, and verify that the calling UID and the passed in package name match. Bug: 206624903 Test: atest packages/providers/MediaProvider Change-Id: Idffbb4ae7740c1b9725af0974948dc55bf1f1fde
Loading
Please register or sign in to comment