From 86f98cefe7e7621e890526c117f79f5a4b4dfcbb Mon Sep 17 00:00:00 2001 From: Zim Date: Fri, 24 Jan 2020 17:37:20 +0000 Subject: [PATCH] Remove ExternalStorageProvider special case for having media_rw ExternalStorageProvider needs to access unreliable USB OTG volumes. It will have the MANAGE_EXTERNAL_STORAGE permission which will give it the external_storage gid which will in turn give it access to /mnt/media_rw/ paths where 'volume' is a volume mount that is not visible to other apps, so does not have a FUSE volume stacked ontop. Test: ExternalStorageProvider has the external_storage gid Bug: 144914977 Change-Id: Ie68d3a5afcb137b034779137cdfbf4d8b6d60c47 --- .../core/java/com/android/server/am/ProcessList.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index 7c73ebd365ffd..03d5038574f86 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -1551,8 +1551,7 @@ public final class ProcessList { } } - private int[] computeGidsForProcess(int mountExternal, int uid, int[] permGids, - String packageName) { + private int[] computeGidsForProcess(int mountExternal, int uid, int[] permGids) { ArrayList gidList = new ArrayList<>(permGids.length + 5); final int sharedAppGid = UserHandle.getSharedAppGid(UserHandle.getAppId(uid)); @@ -1583,10 +1582,6 @@ public final class ProcessList { // 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); - } int[] gidArray = new int[gidList.size()]; for (int i = 0; i < gidArray.length; i++) { @@ -1669,7 +1664,7 @@ public final class ProcessList { } } - gids = computeGidsForProcess(mountExternal, uid, permGids, app.info.packageName); + gids = computeGidsForProcess(mountExternal, uid, permGids); } app.mountMode = mountExternal; checkSlow(startTime, "startProcess: building args");