Fix bug in getStorageVolumesIncludingSharedProfiles

The API currently doesn't return clone profile volumes correctly because
it only looks for volumes visible to the clone for read. Changed it to
include writable volumes as well

Test: atest
AppCloningHostTest#testGetStorageVolumesIncludingSharedProfiles
Bug: 230828743

Change-Id: I4db128027e622ab807c1fbee664dfa7d9a3a26aa
This commit is contained in:
Saumya Pathak
2022-04-29 17:44:01 +00:00
parent 7ee5bcf827
commit 5b341d8532

View File

@@ -3880,9 +3880,12 @@ class StorageManagerService extends IStorageManager.Stub
match = vol.isVisibleForWrite(userId)
|| (includeSharedProfile && vol.isVisibleForWrite(userIdSharingMedia));
} else {
// Return both read only and write only volumes. When includeSharedProfile is
// true, all the volumes of userIdSharingMedia should be returned when queried
// from the user it shares media with
match = vol.isVisibleForUser(userId)
|| (!vol.isVisible() && includeInvisible && vol.getPath() != null)
|| (includeSharedProfile && vol.isVisibleForRead(userIdSharingMedia));
|| (includeSharedProfile && vol.isVisibleForUser(userIdSharingMedia));
}
if (!match) continue;