diff options
author | 2016-11-01 00:13:51 -0700 | |
---|---|---|
committer | 2016-11-01 23:29:33 -0700 | |
commit | 34b33887a17a312167666be217a0f521236b393d (patch) | |
tree | ec763f41cd47b1d42c7c2420d14a6b60b58c7580 | |
parent | 12ffdd86e4553700a09b8fac4f6b658a50293edb (diff) |
Fix IMountService transaction ids.
- (IBinder.FIRST_CALL_TRANSACTION=1) is added to the specified
transaction codes during binder generation. Correct the
IMountService transaction ids taking this into account.
- Update interface descriptors in MountService related native code.
- Add proxy implementations for IMountServiceListener and
IMountShutdownObserver.
Bug: 30977067
Test: Verified that calls from native code to IMountService system
service are working and listeners in native code can get the
callbacks correctly.
Change-Id: I9bef9a8113e92d8b36e963bd961ac858acac3f2a
-rw-r--r-- | core/java/android/os/storage/IMountService.aidl | 144 | ||||
-rw-r--r-- | core/java/android/os/storage/IMountServiceListener.aidl | 14 | ||||
-rw-r--r-- | core/java/android/os/storage/IMountShutdownObserver.aidl | 2 | ||||
-rw-r--r-- | core/java/android/os/storage/IObbActionListener.aidl | 2 | ||||
-rw-r--r-- | libs/storage/IMountService.cpp | 2 | ||||
-rw-r--r-- | libs/storage/IMountServiceListener.cpp | 14 | ||||
-rw-r--r-- | libs/storage/IMountShutdownObserver.cpp | 10 | ||||
-rw-r--r-- | libs/storage/IObbActionListener.cpp | 2 |
8 files changed, 107 insertions, 83 deletions
diff --git a/core/java/android/os/storage/IMountService.aidl b/core/java/android/os/storage/IMountService.aidl index af0d7b76749b..390df99c73a9 100644 --- a/core/java/android/os/storage/IMountService.aidl +++ b/core/java/android/os/storage/IMountService.aidl @@ -38,29 +38,29 @@ interface IMountService { /** * Registers an IMountServiceListener for receiving async notifications. */ - void registerListener(IMountServiceListener listener) = 1; + void registerListener(IMountServiceListener listener) = 0; /** * Unregisters an IMountServiceListener */ - void unregisterListener(IMountServiceListener listener) = 2; + void unregisterListener(IMountServiceListener listener) = 1; /** * Returns true if a USB mass storage host is connected */ - boolean isUsbMassStorageConnected() = 3; + boolean isUsbMassStorageConnected() = 2; /** * Enables / disables USB mass storage. The caller should check actual * status of enabling/disabling USB mass storage via StorageEventListener. */ - void setUsbMassStorageEnabled(boolean enable) = 4; + void setUsbMassStorageEnabled(boolean enable) = 3; /** * Returns true if a USB mass storage host is enabled (media is shared) */ - boolean isUsbMassStorageEnabled() = 5; + boolean isUsbMassStorageEnabled() = 4; /** * Mount external storage at given mount point. Returns an int consistent * with MountServiceResultCode */ - int mountVolume(in String mountPoint) = 6; + int mountVolume(in String mountPoint) = 5; /** * Safely unmount external storage at given mount point. The unmount is an * asynchronous operation. Applications should register StorageEventListener @@ -71,75 +71,75 @@ interface IMountService { * @param removeEncryption whether or not encryption mapping should be removed from the volume. * This value implies {@code force}. */ - void unmountVolume(in String mountPoint, boolean force, boolean removeEncryption) = 7; + void unmountVolume(in String mountPoint, boolean force, boolean removeEncryption) = 6; /** * Format external storage given a mount point. Returns an int consistent * with MountServiceResultCode */ - int formatVolume(in String mountPoint) = 8; + int formatVolume(in String mountPoint) = 7; /** * Returns an array of pids with open files on the specified path. */ - int[] getStorageUsers(in String path) = 9; + int[] getStorageUsers(in String path) = 8; /** * Gets the state of a volume via its mountpoint. */ - String getVolumeState(in String mountPoint) = 10; + String getVolumeState(in String mountPoint) = 9; /* * Creates a secure container with the specified parameters. Returns an int * consistent with MountServiceResultCode */ int createSecureContainer(in String id, int sizeMb, in String fstype, in String key, - int ownerUid, boolean external) = 11; + int ownerUid, boolean external) = 10; /* * Finalize a container which has just been created and populated. After * finalization, the container is immutable. Returns an int consistent with * MountServiceResultCode */ - int finalizeSecureContainer(in String id) = 12; + int finalizeSecureContainer(in String id) = 11; /* * Destroy a secure container, and free up all resources associated with it. * NOTE: Ensure all references are released prior to deleting. Returns an * int consistent with MountServiceResultCode */ - int destroySecureContainer(in String id, boolean force) = 13; + int destroySecureContainer(in String id, boolean force) = 12; /* * Mount a secure container with the specified key and owner UID. Returns an * int consistent with MountServiceResultCode */ - int mountSecureContainer(in String id, in String key, int ownerUid, boolean readOnly) = 14; + int mountSecureContainer(in String id, in String key, int ownerUid, boolean readOnly) = 13; /* * Unount a secure container. Returns an int consistent with * MountServiceResultCode */ - int unmountSecureContainer(in String id, boolean force) = 15; + int unmountSecureContainer(in String id, boolean force) = 14; /* * Returns true if the specified container is mounted */ - boolean isSecureContainerMounted(in String id) = 16; + boolean isSecureContainerMounted(in String id) = 15; /* * Rename an unmounted secure container. Returns an int consistent with * MountServiceResultCode */ - int renameSecureContainer(in String oldId, in String newId) = 17; + int renameSecureContainer(in String oldId, in String newId) = 16; /* * Returns the filesystem path of a mounted secure container. */ - String getSecureContainerPath(in String id) = 18; + String getSecureContainerPath(in String id) = 17; /** * Gets an Array of currently known secure container IDs */ - String[] getSecureContainerList() = 19; + String[] getSecureContainerList() = 18; /** * Shuts down the MountService and gracefully unmounts all external media. * Invokes call back once the shutdown is complete. */ - void shutdown(IMountShutdownObserver observer) = 20; + void shutdown(IMountShutdownObserver observer) = 19; /** * Call into MountService by PackageManager to notify that its done * processing the media status update request. */ - void finishMediaUpdate() = 21; + void finishMediaUpdate() = 20; /** * Mounts an Opaque Binary Blob (OBB) with the specified decryption key and * only allows the calling process's UID access to the contents. @@ -147,43 +147,43 @@ interface IMountService { * it of the terminal state of the call. */ void mountObb(in String rawPath, in String canonicalPath, in String key, - IObbActionListener token, int nonce) = 22; + IObbActionListener token, int nonce) = 21; /** * Unmounts an Opaque Binary Blob (OBB). When the force flag is specified, * any program using it will be forcibly killed to unmount the image. * MountService will call back to the supplied IObbActionListener to inform * it of the terminal state of the call. */ - void unmountObb(in String rawPath, boolean force, IObbActionListener token, int nonce) = 23; + void unmountObb(in String rawPath, boolean force, IObbActionListener token, int nonce) = 22; /** * Checks whether the specified Opaque Binary Blob (OBB) is mounted * somewhere. */ - boolean isObbMounted(in String rawPath) = 24; + boolean isObbMounted(in String rawPath) = 23; /** * Gets the path to the mounted Opaque Binary Blob (OBB). */ - String getMountedObbPath(in String rawPath) = 25; + String getMountedObbPath(in String rawPath) = 24; /** * Returns whether or not the external storage is emulated. */ - boolean isExternalStorageEmulated() = 26; + boolean isExternalStorageEmulated() = 25; /** * Decrypts any encrypted volumes. */ - int decryptStorage(in String password) = 27; + int decryptStorage(in String password) = 26; /** * Encrypts storage. */ - int encryptStorage(int type, in String password) = 28; + int encryptStorage(int type, in String password) = 27; /** * Changes the encryption password. */ - int changeEncryptionPassword(int type, in String password) = 29; + int changeEncryptionPassword(int type, in String password) = 28; /** * Returns list of all mountable volumes. */ - StorageVolume[] getVolumeList(int uid, in String packageName, int flags) = 30; + StorageVolume[] getVolumeList(int uid, in String packageName, int flags) = 29; /** * Gets the path on the filesystem for the ASEC container itself. * @@ -191,7 +191,7 @@ interface IMountService { * @return path to filesystem or {@code null} if it's not found * @throws RemoteException */ - String getSecureContainerFilesystemPath(in String cid) = 31; + String getSecureContainerFilesystemPath(in String cid) = 30; /** * Determines the encryption state of the volume. * @return a numerical value. See {@code ENCRYPTION_STATE_*} for possible @@ -201,17 +201,17 @@ interface IMountService { * This is still useful to get the error state when encryption has failed * and CryptKeeper needs to throw up a screen advising the user what to do */ - int getEncryptionState() = 32; + int getEncryptionState() = 31; /** * Verify the encryption password against the stored volume. This method * may only be called by the system process. */ - int verifyEncryptionPassword(in String password) = 33; + int verifyEncryptionPassword(in String password) = 32; /* * Fix permissions in a container which has just been created and populated. * Returns an int consistent with MountServiceResultCode */ - int fixPermissionsSecureContainer(in String id, int gid, in String filename) = 34; + int fixPermissionsSecureContainer(in String id, int gid, in String filename) = 33; /** * Ensure that all directories along given path exist, creating parent * directories as needed. Validates that given path is absolute and that it @@ -219,73 +219,73 @@ interface IMountService { * path belongs to a volume managed by vold, and that path is either * external storage data or OBB directory belonging to calling app. */ - int mkdirs(in String callingPkg, in String path) = 35; + int mkdirs(in String callingPkg, in String path) = 34; /** * Determines the type of the encryption password * @return PasswordType */ - int getPasswordType() = 36; + int getPasswordType() = 35; /** * Get password from vold * @return password or empty string */ - String getPassword() = 37; + String getPassword() = 36; /** * Securely clear password from vold */ - oneway void clearPassword() = 38; + oneway void clearPassword() = 37; /** * Set a field in the crypto header. * @param field field to set * @param contents contents to set in field */ - oneway void setField(in String field, in String contents) = 39; + oneway void setField(in String field, in String contents) = 38; /** * Gets a field from the crypto header. * @param field field to get * @return contents of field */ - String getField(in String field) = 40; - int resizeSecureContainer(in String id, int sizeMb, in String key) = 41; + String getField(in String field) = 39; + int resizeSecureContainer(in String id, int sizeMb, in String key) = 40; /** * Report the time of the last maintenance operation such as fstrim. * @return Timestamp of the last maintenance operation, in the * System.currentTimeMillis() time base * @throws RemoteException */ - long lastMaintenance() = 42; + long lastMaintenance() = 41; /** * Kick off an immediate maintenance operation * @throws RemoteException */ - void runMaintenance() = 43; - void waitForAsecScan() = 44; - DiskInfo[] getDisks() = 45; - VolumeInfo[] getVolumes(int flags) = 46; - VolumeRecord[] getVolumeRecords(int flags) = 47; - void mount(in String volId) = 48; - void unmount(in String volId) = 49; - void format(in String volId) = 50; - void partitionPublic(in String diskId) = 51; - void partitionPrivate(in String diskId) = 52; - void partitionMixed(in String diskId, int ratio) = 53; - void setVolumeNickname(in String fsUuid, in String nickname) = 54; - void setVolumeUserFlags(in String fsUuid, int flags, int mask) = 55; - void forgetVolume(in String fsUuid) = 56; - void forgetAllVolumes() = 57; - String getPrimaryStorageUuid() = 58; - void setPrimaryStorageUuid(in String volumeUuid, IPackageMoveObserver callback) = 59; - long benchmark(in String volId) = 60; - void setDebugFlags(int flags, int mask) = 61; - void createUserKey(int userId, int serialNumber, boolean ephemeral) = 62; - void destroyUserKey(int userId) = 63; - void unlockUserKey(int userId, int serialNumber, in byte[] token, in byte[] secret) = 64; - void lockUserKey(int userId) = 65; - boolean isUserKeyUnlocked(int userId) = 66; - void prepareUserStorage(in String volumeUuid, int userId, int serialNumber, int flags) = 67; - void destroyUserStorage(in String volumeUuid, int userId, int flags) = 68; - boolean isConvertibleToFBE() = 69; - ParcelFileDescriptor mountAppFuse(in String name) = 70; - void addUserKeyAuth(int userId, int serialNumber, in byte[] token, in byte[] secret) = 71; - void fixateNewestUserKeyAuth(int userId) = 72; + void runMaintenance() = 42; + void waitForAsecScan() = 43; + DiskInfo[] getDisks() = 44; + VolumeInfo[] getVolumes(int flags) = 45; + VolumeRecord[] getVolumeRecords(int flags) = 46; + void mount(in String volId) = 47; + void unmount(in String volId) = 48; + void format(in String volId) = 49; + void partitionPublic(in String diskId) = 50; + void partitionPrivate(in String diskId) = 51; + void partitionMixed(in String diskId, int ratio) = 52; + void setVolumeNickname(in String fsUuid, in String nickname) = 53; + void setVolumeUserFlags(in String fsUuid, int flags, int mask) = 54; + void forgetVolume(in String fsUuid) = 55; + void forgetAllVolumes() = 56; + String getPrimaryStorageUuid() = 57; + void setPrimaryStorageUuid(in String volumeUuid, IPackageMoveObserver callback) = 58; + long benchmark(in String volId) = 59; + void setDebugFlags(int flags, int mask) = 60; + void createUserKey(int userId, int serialNumber, boolean ephemeral) = 61; + void destroyUserKey(int userId) = 62; + void unlockUserKey(int userId, int serialNumber, in byte[] token, in byte[] secret) = 63; + void lockUserKey(int userId) = 64; + boolean isUserKeyUnlocked(int userId) = 65; + void prepareUserStorage(in String volumeUuid, int userId, int serialNumber, int flags) = 66; + void destroyUserStorage(in String volumeUuid, int userId, int flags) = 67; + boolean isConvertibleToFBE() = 68; + ParcelFileDescriptor mountAppFuse(in String name) = 69; + void addUserKeyAuth(int userId, int serialNumber, in byte[] token, in byte[] secret) = 70; + void fixateNewestUserKeyAuth(int userId) = 71; }
\ No newline at end of file diff --git a/core/java/android/os/storage/IMountServiceListener.aidl b/core/java/android/os/storage/IMountServiceListener.aidl index e1499781b652..0e20cd326585 100644 --- a/core/java/android/os/storage/IMountServiceListener.aidl +++ b/core/java/android/os/storage/IMountServiceListener.aidl @@ -35,7 +35,7 @@ oneway interface IMountServiceListener { * * @param available true if a UMS host is connected. */ - void onUsbMassStorageConnectionChanged(boolean connected) = 1; + void onUsbMassStorageConnectionChanged(boolean connected) = 0; /** * Storage state has changed. @@ -45,17 +45,17 @@ oneway interface IMountServiceListener { * @param newState The new state of the volume. Note: State is one of the * values returned by Environment.getExternalStorageState() */ - void onStorageStateChanged(in String path, in String oldState, in String newState) = 2; + void onStorageStateChanged(in String path, in String oldState, in String newState) = 1; - void onVolumeStateChanged(in VolumeInfo vol, int oldState, int newState) = 3; + void onVolumeStateChanged(in VolumeInfo vol, int oldState, int newState) = 2; - void onVolumeRecordChanged(in VolumeRecord rec) = 4; + void onVolumeRecordChanged(in VolumeRecord rec) = 3; - void onVolumeForgotten(in String fsUuid) = 5; + void onVolumeForgotten(in String fsUuid) = 4; - void onDiskScanned(in DiskInfo disk, int volumeCount) = 6; + void onDiskScanned(in DiskInfo disk, int volumeCount) = 5; - void onDiskDestroyed(in DiskInfo disk) = 7; + void onDiskDestroyed(in DiskInfo disk) = 6; /** * Don't change the existing transaction Ids as they could be used in the native code. diff --git a/core/java/android/os/storage/IMountShutdownObserver.aidl b/core/java/android/os/storage/IMountShutdownObserver.aidl index 3353bc5cb1c8..f3e1654c4128 100644 --- a/core/java/android/os/storage/IMountShutdownObserver.aidl +++ b/core/java/android/os/storage/IMountShutdownObserver.aidl @@ -30,7 +30,7 @@ interface IMountShutdownObserver { * * @param statusCode indicates success or failure of the shutdown. */ - void onShutDownComplete(int statusCode) = 1; + void onShutDownComplete(int statusCode) = 0; /** * Don't change the existing transaction Ids as they could be used in the native code. diff --git a/core/java/android/os/storage/IObbActionListener.aidl b/core/java/android/os/storage/IObbActionListener.aidl index 71e6aafe1995..61ba4d56e6a3 100644 --- a/core/java/android/os/storage/IObbActionListener.aidl +++ b/core/java/android/os/storage/IObbActionListener.aidl @@ -33,7 +33,7 @@ oneway interface IObbActionListener { * @param nonce identifier that is meaningful to the receiver * @param status status code as defined in {@link OnObbStateChangeListener} */ - void onObbResult(in String filename, int nonce, int status) = 1; + void onObbResult(in String filename, int nonce, int status) = 0; /** * Don't change the existing transaction Ids as they could be used in the native code. diff --git a/libs/storage/IMountService.cpp b/libs/storage/IMountService.cpp index 74638e7eccc3..fe1ee02420c2 100644 --- a/libs/storage/IMountService.cpp +++ b/libs/storage/IMountService.cpp @@ -553,7 +553,7 @@ public: } }; -IMPLEMENT_META_INTERFACE(MountService, "IMountService") +IMPLEMENT_META_INTERFACE(MountService, "android.os.storage.IMountService") // ---------------------------------------------------------------------- diff --git a/libs/storage/IMountServiceListener.cpp b/libs/storage/IMountServiceListener.cpp index 11b53fdc1027..6a093fd94929 100644 --- a/libs/storage/IMountServiceListener.cpp +++ b/libs/storage/IMountServiceListener.cpp @@ -24,6 +24,20 @@ enum { TRANSACTION_onStorageStateChanged, }; +class BpMountServiceListener: public BpInterface<IMountServiceListener> { +public: + explicit BpMountServiceListener(const sp<IBinder>& impl) + : BpInterface<IMountServiceListener>(impl) { } + + virtual void onUsbMassStorageConnectionChanged(const bool /* connected */) { } + virtual void onStorageStateChanged(const String16& /* path */, + const String16& /* oldState */, const String16& /* newState */) { } +}; + +IMPLEMENT_META_INTERFACE(MountServiceListener, "android.os.storage.IMountServiceListener") + +// ---------------------------------------------------------------------- + status_t BnMountServiceListener::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { diff --git a/libs/storage/IMountShutdownObserver.cpp b/libs/storage/IMountShutdownObserver.cpp index a74a768409bc..6114d4ac5978 100644 --- a/libs/storage/IMountShutdownObserver.cpp +++ b/libs/storage/IMountShutdownObserver.cpp @@ -23,6 +23,16 @@ enum { TRANSACTION_onShutDownComplete = IBinder::FIRST_CALL_TRANSACTION, }; +class BpMountShutdownObserver: public BpInterface<IMountShutdownObserver> { +public: + explicit BpMountShutdownObserver(const sp<IBinder>& impl) + : BpInterface<IMountShutdownObserver>(impl) { } + + virtual void onShutDownComplete(const int32_t /* statusCode */) {} +}; + +IMPLEMENT_META_INTERFACE(MountShutdownObserver, "android.os.storage.IMountShutdownObserver") + status_t BnMountShutdownObserver::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { diff --git a/libs/storage/IObbActionListener.cpp b/libs/storage/IObbActionListener.cpp index a71341bc1364..797393ac6f5b 100644 --- a/libs/storage/IObbActionListener.cpp +++ b/libs/storage/IObbActionListener.cpp @@ -34,7 +34,7 @@ public: const int32_t /* state */) { } }; -IMPLEMENT_META_INTERFACE(ObbActionListener, "IObbActionListener") +IMPLEMENT_META_INTERFACE(ObbActionListener, "android.os.storage.IObbActionListener") // ---------------------------------------------------------------------- |