Skip to content

Commit 8ec81af

Browse files
Himanshu Guptahungphan2001
authored andcommitted
Fix getStorageVolumes to return public volumes visible to userIdSharingMedia with.
In ag/16708639, getStorageVolumes was modified to return volumes mounted on the calling user. Clone profile is an exception to this rule, as by definition, it should access the public volumes available to its parent user. To fix this we allow a volume to be returned if: 1. Its a public volume and 2. Its visible to the userId the calling user shares media with. Bug: b/265772860 b/265724297 b/260950918 Test: atest AppCloningHostTest Google: 2423165 Change-Id: I84a57ea13b08a5f1cd0095e944aeacc3434df4de Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
1 parent 4e32594 commit 8ec81af

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

services/core/java/com/android/server/StorageManagerService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3903,8 +3903,12 @@ public StorageVolume[] getVolumeList(int userId, String callingPackage, int flag
39033903
// Return both read only and write only volumes. When includeSharedProfile is
39043904
// true, all the volumes of userIdSharingMedia should be returned when queried
39053905
// from the user it shares media with
3906+
// Public Volumes will be also be returned if visible to the
3907+
// userIdSharingMedia with.
39063908
match = vol.isVisibleForUser(userId)
39073909
|| (!vol.isVisible() && includeInvisible && vol.getPath() != null)
3910+
|| (vol.getType() == VolumeInfo.TYPE_PUBLIC
3911+
&& vol.isVisibleForUser(userIdSharingMedia))
39083912
|| (includeSharedProfile && vol.isVisibleForUser(userIdSharingMedia));
39093913
}
39103914
if (!match) continue;

0 commit comments

Comments
 (0)