diff options
| -rw-r--r-- | core/java/android/os/storage/IMountService.java | 27 | ||||
| -rw-r--r-- | services/core/java/com/android/server/MountService.java | 18 |
2 files changed, 45 insertions, 0 deletions
diff --git a/core/java/android/os/storage/IMountService.java b/core/java/android/os/storage/IMountService.java index c4337cb565b7..bc013eb8910a 100644 --- a/core/java/android/os/storage/IMountService.java +++ b/core/java/android/os/storage/IMountService.java @@ -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; /** diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java index 50afa3c302c4..6e4f2388f478 100644 --- a/services/core/java/com/android/server/MountService.java +++ b/services/core/java/com/android/server/MountService.java @@ -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, |