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

Commit 9422a707 authored by Ricky Wai's avatar Ricky Wai
Browse files

Do not enable storage app data isolation on special mount options app

These apps do not need to have storage app data isolation as their
/storage is not mounted to /mnt/user

Bug: 153540919
Test: atest AdoptableHostTest
Test: atest FuseDaemonHostTest
Change-Id: I3398dc75e9b827e7b9b43b70852cb4ca6bd7048e
parent 6699c412
Loading
Loading
Loading
Loading
+12 −2
Original line number Original line Diff line number Diff line
@@ -2181,6 +2181,17 @@ public final class ProcessList {
        return result;
        return result;
    }
    }


    private boolean needsStorageDataIsolation(StorageManagerInternal storageManagerInternal,
            ProcessRecord app) {
        return mVoldAppDataIsolationEnabled && UserHandle.isApp(app.uid)
                && !storageManagerInternal.isExternalStorageService(app.uid)
                // Special mounting mode doesn't need to have data isolation as they won't
                // access /mnt/user anyway.
                && app.mountMode != Zygote.MOUNT_EXTERNAL_ANDROID_WRITABLE
                && app.mountMode != Zygote.MOUNT_EXTERNAL_PASS_THROUGH
                && app.mountMode != Zygote.MOUNT_EXTERNAL_INSTALLER;
    }

    private Process.ProcessStartResult startProcess(HostingRecord hostingRecord, String entryPoint,
    private Process.ProcessStartResult startProcess(HostingRecord hostingRecord, String entryPoint,
            ProcessRecord app, int uid, int[] gids, int runtimeFlags, int zygotePolicyFlags,
            ProcessRecord app, int uid, int[] gids, int runtimeFlags, int zygotePolicyFlags,
            int mountExternal, String seInfo, String requiredAbi, String instructionSet,
            int mountExternal, String seInfo, String requiredAbi, String instructionSet,
@@ -2237,8 +2248,7 @@ public final class ProcessList {
            int userId = UserHandle.getUserId(uid);
            int userId = UserHandle.getUserId(uid);
            StorageManagerInternal storageManagerInternal = LocalServices.getService(
            StorageManagerInternal storageManagerInternal = LocalServices.getService(
                    StorageManagerInternal.class);
                    StorageManagerInternal.class);
            if (mVoldAppDataIsolationEnabled && UserHandle.isApp(app.uid)
            if (needsStorageDataIsolation(storageManagerInternal, app)) {
                    && !storageManagerInternal.isExternalStorageService(uid)) {
                bindMountAppStorageDirs = true;
                bindMountAppStorageDirs = true;
                if (pkgDataInfoMap == null ||
                if (pkgDataInfoMap == null ||
                        !storageManagerInternal.prepareStorageDirs(userId, pkgDataInfoMap.keySet(),
                        !storageManagerInternal.prepareStorageDirs(userId, pkgDataInfoMap.keySet(),