Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86f98cef authored by Zim's avatar Zim
Browse files

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/<volume> 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
parent da8df986
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -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<Integer> 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/<volume>
            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");