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

Commit 5f6e9460 authored by Zim's avatar Zim
Browse files

Remove FUSE restriction blocking apps from making their dirs

Earlier implementation of FUSE had Android/ on the FUSE mount,
this resulted in vold hanging when apps called any of the
Context#getExternalFilesDir methods. With FUSE mounts,
we ensured in the FUSE handling that apps could always create their
dirs so they never needed the fallback to call into vold.

Now, Android/ will become an sdcardfs mount again and will have the
'default' bind mount view. We need to allow them call into vold when
they need to create their app dirs and don't have the right
permissions on the filesystem

Cleanup some unused code

Test: while true; do atest AdoptableHostTest; done
Bug: 135341433
Change-Id: Ic63de4f6d96e3d1012aa8bcfd2de09774362cfbc
parent 44cf6950
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -3097,14 +3097,6 @@ class StorageManagerService extends IStorageManager.Stub

    @Override
    public void mkdirs(String callingPkg, String appPath) {
        if (mIsFuseEnabled) {
            // TODO(b/144332951): Calling into Vold is risky because the FUSE daemon can go down
            // anytime and Vold will hang forever. We should either remove this call
            // or at least call into the FUSE daemon to mkdir instead
            Slog.w(TAG, "Not making dir for package " + callingPkg + " with path " + appPath);
            return;
        }

        final int callingUid = Binder.getCallingUid();
        final int userId = UserHandle.getUserId(callingUid);
        final UserEnvironment userEnv = new UserEnvironment(userId);
+0 −28
Original line number Diff line number Diff line
@@ -307,34 +307,6 @@ public final class StorageSessionController {
        }
    }

    /**
     * Throws an {@link IllegalStateException} if {@code path} is not ready to be accessed by
     * {@code userId}.
     */
    // TODO(b/144332951): This is not used because it is racy. Right after checking a path
    // we can call into vold with that path and the FUSE daemon can go down. Improve or remove
    public void checkPathReadyForUser(int userId, String path) {
        if (!mIsFuseEnabled) {
            return;
        }

        if (mIsResetting) {
            throw new IllegalStateException("Connection resetting for user " + userId
                    + " with path " + path);
        }

        StorageUserConnection connection = null;
        synchronized (mLock) {
            connection = mConnections.get(userId);
        }

        if (connection == null) {
            throw new IllegalStateException("Connection not ready for user " + userId
                    + " with path " + path);
        }
        connection.checkPathReady(path);
    }

    /**
     * Returns {@code true} if {@code vol} is an emulated or public volume,
     * {@code false} otherwise
+0 −14
Original line number Diff line number Diff line
@@ -163,20 +163,6 @@ public final class StorageUserConnection {
        mActiveConnection.close();
    }

    /** Throws an {@link IllegalArgumentException} if {@code path} is not ready for access */
    public void checkPathReady(String path) {
        synchronized (mLock) {
            for (Session session : mSessions.values()) {
                if (session.upperPath != null && path.startsWith(session.upperPath)) {
                    if (mActiveConnection.isActiveLocked(session)) {
                        return;
                    }
                }
            }
            throw new IllegalStateException("Path not ready " + path);
        }
    }

    /** Returns all created sessions. */
    public Set<String> getAllSessionIds() {
        synchronized (mLock) {