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

Commit c4426c81 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Filter proxy FD open modes to those supported."

parents 7198156c 39466322
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.server;

import static android.os.ParcelFileDescriptor.MODE_READ_ONLY;
import static android.os.ParcelFileDescriptor.MODE_READ_WRITE;
import static android.os.storage.OnObbStateChangeListener.ERROR_ALREADY_MOUNTED;
import static android.os.storage.OnObbStateChangeListener.ERROR_COULD_NOT_MOUNT;
import static android.os.storage.OnObbStateChangeListener.ERROR_COULD_NOT_UNMOUNT;
@@ -2758,6 +2760,14 @@ class StorageManagerService extends IStorageManager.Stub
    public @Nullable ParcelFileDescriptor openProxyFileDescriptor(
            int mountId, int fileId, int mode) {
        Slog.v(TAG, "mountProxyFileDescriptor");

        // We only support a narrow set of incoming mode flags
        if ((mode & MODE_READ_WRITE) == MODE_READ_WRITE) {
            mode = MODE_READ_WRITE;
        } else {
            mode = MODE_READ_ONLY;
        }

        try {
            synchronized (mAppFuseLock) {
                if (mAppFuseBridge == null) {