diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/os/storage/IMountService.java | 64 | ||||
| -rw-r--r-- | core/java/android/os/storage/StorageManager.java | 18 |
2 files changed, 82 insertions, 0 deletions
diff --git a/core/java/android/os/storage/IMountService.java b/core/java/android/os/storage/IMountService.java index 84a879c..bce5f17 100644 --- a/core/java/android/os/storage/IMountService.java +++ b/core/java/android/os/storage/IMountService.java @@ -1192,6 +1192,37 @@ public interface IMountService extends IInterface { _data.recycle(); } } + + @Override + public void createNewUserDir(int userHandle, String path) throws RemoteException { + Parcel _data = Parcel.obtain(); + Parcel _reply = Parcel.obtain(); + try { + _data.writeInterfaceToken(DESCRIPTOR); + _data.writeInt(userHandle); + _data.writeString(path); + mRemote.transact(Stub.TRANSACTION_createNewUserDir, _data, _reply, 0); + _reply.readException(); + } finally { + _reply.recycle(); + _data.recycle(); + } + } + + @Override + public void deleteUserKey(int userHandle) throws RemoteException { + Parcel _data = Parcel.obtain(); + Parcel _reply = Parcel.obtain(); + try { + _data.writeInterfaceToken(DESCRIPTOR); + _data.writeInt(userHandle); + mRemote.transact(Stub.TRANSACTION_deleteUserKey, _data, _reply, 0); + _reply.readException(); + } finally { + _reply.recycle(); + _data.recycle(); + } + } } private static final String DESCRIPTOR = "IMountService"; @@ -1309,6 +1340,9 @@ public interface IMountService extends IInterface { static final int TRANSACTION_remountUid = IBinder.FIRST_CALL_TRANSACTION + 61; + static final int TRANSACTION_createNewUserDir = IBinder.FIRST_CALL_TRANSACTION + 62; + static final int TRANSACTION_deleteUserKey = IBinder.FIRST_CALL_TRANSACTION + 63; + /** * Cast an IBinder object into an IMountService interface, generating a * proxy if needed. @@ -1869,6 +1903,21 @@ public interface IMountService extends IInterface { reply.writeNoException(); return true; } + case TRANSACTION_createNewUserDir: { + data.enforceInterface(DESCRIPTOR); + int userHandle = data.readInt(); + String path = data.readString(); + createNewUserDir(userHandle, path); + reply.writeNoException(); + return true; + } + case TRANSACTION_deleteUserKey: { + data.enforceInterface(DESCRIPTOR); + int userHandle = data.readInt(); + deleteUserKey(userHandle); + reply.writeNoException(); + return true; + } } return super.onTransact(code, data, reply, flags); } @@ -2180,4 +2229,19 @@ public interface IMountService extends IInterface { throws RemoteException; public void remountUid(int uid) throws RemoteException; + + /** + * Creates the user data directory, possibly encrypted + * @param userHandle Handle of the user whose directory we are creating + * @param path Path at which to create the directory. + */ + public void createNewUserDir(int userHandle, String path) + throws RemoteException; + + /** + * Securely delete the user's encryption key + * @param userHandle Handle of the user whose key we are deleting + */ + public void deleteUserKey(int userHandle) + throws RemoteException; } diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java index f03e04e..f58ae00 100644 --- a/core/java/android/os/storage/StorageManager.java +++ b/core/java/android/os/storage/StorageManager.java @@ -946,6 +946,24 @@ public class StorageManager { } /** {@hide} */ + public void createNewUserDir(int userHandle, File path) { + try { + mMountService.createNewUserDir(userHandle, path.getAbsolutePath()); + } catch (RemoteException e) { + throw e.rethrowAsRuntimeException(); + } + } + + /** {@hide} */ + public void deleteUserKey(int userHandle) { + try { + mMountService.deleteUserKey(userHandle); + } catch (RemoteException e) { + throw e.rethrowAsRuntimeException(); + } + } + + /** {@hide} */ public static File maybeTranslateEmulatedPathToInternal(File path) { final IMountService mountService = IMountService.Stub.asInterface( ServiceManager.getService("mount")); |
