From da8df986348bfd369d27bca8ce1ce845a899f0dd Mon Sep 17 00:00:00 2001 From: Zim Date: Fri, 24 Jan 2020 16:44:10 +0000 Subject: [PATCH] Grant apps with pass_through mount mode media_rw gid This is necessary to allow the FUSE daemon access to the lower filesystem on devices without sdcardfs Test: FUSE daemon has media_rw gid Bug: 144914977 Change-Id: I2ed3ab00fa1a4293703e1d066283334cadd1cd49 --- services/core/java/com/android/server/am/ProcessList.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index 62e703bb0836b..7c73ebd365ffd 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -1574,8 +1574,15 @@ public final class ProcessList { gidList.add(userGid); } if (mountExternal == Zygote.MOUNT_EXTERNAL_ANDROID_WRITABLE) { + // For DownloadProviders and MTP: To grant access to /sdcard/Android/ gidList.add(Process.SDCARD_RW_GID); } + if (mountExternal == Zygote.MOUNT_EXTERNAL_PASS_THROUGH) { + // For the FUSE daemon: To grant access to the lower filesystem. + // EmulatedVolumes: /data/media and /mnt/expand//data/media + // PublicVolumes: /mnt/media_rw/ + gidList.add(Process.MEDIA_RW_GID); + } if (packageName.equals("com.android.externalstorage")) { // Allows access to 'unreliable' (USB OTG) volumes via SAF gidList.add(Process.MEDIA_RW_GID);