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

Commit 0fe13b1f authored by Daichi Hirono's avatar Daichi Hirono Committed by Android (Google) Code Review
Browse files

Merge "Add a mehtod definition to StorageManager for appfuse."

parents 1653ac43 9e8d9e25
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -21,8 +21,12 @@ import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
import android.os.Parcelable;
import android.os.RemoteException;

import java.io.FileDescriptor;

/**
 * WARNING! Update IMountService.h and IMountService.cpp if you change this
 * file. In particular, the ordering of the methods below must match the
@@ -1312,6 +1316,25 @@ public interface IMountService extends IInterface {
                }
                return _result;
            }

            @Override
            public ParcelFileDescriptor mountAppFuse(String name) throws RemoteException {
                Parcel _data = Parcel.obtain();
                Parcel _reply = Parcel.obtain();
                ParcelFileDescriptor _result = null;
                try {
                    _data.writeInterfaceToken(DESCRIPTOR);
                    _data.writeString(name);
                    mRemote.transact(Stub.TRANSACTION_mountAppFuse, _data, _reply, 0);
                    _reply.readException();
                    _result = _reply.<ParcelFileDescriptor>readParcelable(
                            ClassLoader.getSystemClassLoader());
                } finally {
                    _reply.recycle();
                    _data.recycle();
                }
                return _result;
            }
        }

        private static final String DESCRIPTOR = "IMountService";
@@ -1439,6 +1462,8 @@ public interface IMountService extends IInterface {
        static final int TRANSACTION_isPerUserEncryptionEnabled = IBinder.FIRST_CALL_TRANSACTION + 67;
        static final int TRANSACTION_isConvertibleToFBE = IBinder.FIRST_CALL_TRANSACTION + 68;

        static final int TRANSACTION_mountAppFuse = IBinder.FIRST_CALL_TRANSACTION + 69;

        /**
         * Cast an IBinder object into an IMountService interface, generating a
         * proxy if needed.
@@ -2056,6 +2081,14 @@ public interface IMountService extends IInterface {
                    reply.writeInt(result ? 1 : 0);
                    return true;
                }
                case TRANSACTION_mountAppFuse: {
                    data.enforceInterface(DESCRIPTOR);
                    String name = data.readString();
                    ParcelFileDescriptor fd = mountAppFuse(name);
                    reply.writeNoException();
                    reply.writeParcelable(fd, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
                    return true;
                }
            }
            return super.onTransact(code, data, reply, flags);
        }
@@ -2379,4 +2412,6 @@ public interface IMountService extends IInterface {
            throws RemoteException;

    public boolean isPerUserEncryptionEnabled() throws RemoteException;

    public ParcelFileDescriptor mountAppFuse(String name) throws RemoteException;
}
+15 −5
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.os.FileUtils;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings;
@@ -1049,6 +1050,15 @@ public class StorageManager {
        return path;
    }

    /** {@hide} */
    public ParcelFileDescriptor mountAppFuse(String name) {
        try {
            return mMountService.mountAppFuse(name);
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

    /// Consts to match the password types in cryptfs.h
    /** @hide */
    public static final int CRYPT_TYPE_PASSWORD = 0;
+7 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
@@ -2767,6 +2768,12 @@ class MountService extends IMountService.Stub
                || SystemProperties.getBoolean(StorageManager.PROP_HAS_FBE, false);
    }

    @Override
    public ParcelFileDescriptor mountAppFuse(String name) throws RemoteException {
        // TODO: Invoke vold to mount app fuse.
        throw new UnsupportedOperationException();
    }

    @Override
    public int mkdirs(String callingPkg, String appPath) {
        final int userId = UserHandle.getUserId(Binder.getCallingUid());