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

Commit 78f23391 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove FUSE restriction blocking apps from making their dirs"

parents c343a5e0 5f6e9460
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) {