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

Commit 3806d9c5 authored by Paul Lawrence's avatar Paul Lawrence
Browse files

Add developer option to convert from FDE to FBE

This set of changes adds the screen that offers this conversion,
and the plumbing so the option is only available on suitable
devices.

It does not implement the conversion mechanism.Add conversion from FDE to FBE

Change-Id: Idf7bc834f30b3d1b0473e0a53c985ef01dd0ad18
parent 3034538c
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();
@@ -1330,6 +1346,8 @@ public interface IMountService extends IInterface {

        static final int TRANSACTION_deleteUserKey = IBinder.FIRST_CALL_TRANSACTION + 63;

        static final int TRANSACTION_isConvertibleToFBE = IBinder.FIRST_CALL_TRANSACTION + 64;

        /**
         * Cast an IBinder object into an IMountService interface, generating a
         * proxy if needed.
@@ -1725,6 +1743,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;
@@ -2169,6 +2194,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,