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

Commit 9548b380 authored by Paul Lawrence's avatar Paul Lawrence Committed by Android (Google) Code Review
Browse files

Merge "Add developer option to convert from FDE to FBE"

parents a3761ad7 3806d9c5
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -758,6 +758,22 @@ public interface IMountService extends IInterface {
                return _result;
            }

            public boolean isConvertibleToFBE() throws RemoteException {
                Parcel _data = Parcel.obtain();
                Parcel _reply = Parcel.obtain();
                boolean _result;
                try {
                    _data.writeInterfaceToken(DESCRIPTOR);
                    mRemote.transact(Stub.TRANSACTION_isConvertibleToFBE, _data, _reply, 0);
                    _reply.readException();
                    _result = _reply.readInt() != 0;
                } finally {
                    _reply.recycle();
                    _data.recycle();
                }
                return _result;
            }

            public StorageVolume[] getVolumeList(int uid, String packageName, int flags)
                    throws RemoteException {
                Parcel _data = Parcel.obtain();
@@ -1349,6 +1365,8 @@ public interface IMountService extends IInterface {

        static final int TRANSACTION_isPerUserEncryptionEnabled = IBinder.FIRST_CALL_TRANSACTION + 64;

        static final int TRANSACTION_isConvertibleToFBE = IBinder.FIRST_CALL_TRANSACTION + 64;

        /**
         * Cast an IBinder object into an IMountService interface, generating a
         * proxy if needed.
@@ -1744,6 +1762,13 @@ public interface IMountService extends IInterface {
                    reply.writeString(contents);
                    return true;
                }
                case TRANSACTION_isConvertibleToFBE: {
                    data.enforceInterface(DESCRIPTOR);
                    int resultCode = isConvertibleToFBE() ? 1 : 0;
                    reply.writeNoException();
                    reply.writeInt(resultCode);
                    return true;
                }
                case TRANSACTION_resizeSecureContainer: {
                    data.enforceInterface(DESCRIPTOR);
                    String id;
@@ -2195,6 +2220,8 @@ public interface IMountService extends IInterface {
     */
    public String getField(String field) throws RemoteException;

    public boolean isConvertibleToFBE() throws RemoteException;

    public int resizeSecureContainer(String id, int sizeMb, String key) throws RemoteException;

    /**
+18 −0
Original line number Diff line number Diff line
@@ -2597,6 +2597,24 @@ class MountService extends IMountService.Stub
        }
    }

    /**
     * Is userdata convertible to file based encryption?
     * @return non zero for convertible
     */
    @Override
    public boolean isConvertibleToFBE() throws RemoteException {

        waitForReady();

        final NativeDaemonEvent event;
        try {
            event = mCryptConnector.execute("cryptfs", "isConvertibleToFBE");
            return Integer.parseInt(event.getMessage()) != 0;
        } catch (NativeDaemonConnectorException e) {
            throw e.rethrowAsParcelableException();
        }
    }

    @Override
    public String getPassword() throws RemoteException {
        mContext.enforceCallingOrSelfPermission(Manifest.permission.ACCESS_KEYGUARD_SECURE_STORAGE,