summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Saumya Pathak <saumyap@google.com> 2022-04-29 17:44:01 +0000
committer Saumya Pathak <saumyap@google.com> 2022-05-06 15:33:41 +0000
commit5b341d8532ddf9f9ffa88032bdbee0602aca83fa (patch)
treee3302b323aae3cde30883be774632034e0866a6d
parent7ee5bcf82723a339eae7acac738823e294e4e1d6 (diff)
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
-rw-r--r--services/core/java/com/android/server/StorageManagerService.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index bc40170d39b7..5eec6e58e925 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -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;