diff options
author | Takeshi Aimi <aimitakeshi@gmail.com> | 2010-09-20 23:40:41 +0900 |
---|---|---|
committer | Takeshi Aimi <aimitakeshi@gmail.com> | 2010-10-04 22:14:53 +0900 |
commit | 2272ee27d9022d173b6eab45c409b3c3f57f30ec (patch) | |
tree | 42fd86597781bdf6b3795907ec1d086b0b549a5c /drm/libdrmframework/include | |
parent | 0335b70c6cdbe96650d4bed817f9233cd8db1c6d (diff) | |
download | frameworks_av-2272ee27d9022d173b6eab45c409b3c3f57f30ec.zip frameworks_av-2272ee27d9022d173b6eab45c409b3c3f57f30ec.tar.gz frameworks_av-2272ee27d9022d173b6eab45c409b3c3f57f30ec.tar.bz2 |
Update of DRM framework.
- Change "void" type of return value to "int" for returning status.
- Add some of overloaded Java APIs which accept database Uri as input.
- Add asynchronous APIs
- Add OnEventListener and OnErrorListener for asynchronous APIs
- Disable debug log
- Change decrypt() API to accept an optional buffer needed by some of DRM schemes
Changes are incorporated by Sony Corporation.
Change-Id: I414a165e22cc79be6ea7cd28041788aa2b6b8f7c
Diffstat (limited to 'drm/libdrmframework/include')
-rw-r--r-- | drm/libdrmframework/include/DrmManager.h | 24 | ||||
-rw-r--r-- | drm/libdrmframework/include/DrmManagerClientImpl.h | 38 | ||||
-rw-r--r-- | drm/libdrmframework/include/DrmManagerService.h | 24 | ||||
-rw-r--r-- | drm/libdrmframework/include/IDrmManagerService.h | 52 | ||||
-rw-r--r-- | drm/libdrmframework/include/ReadWriteUtils.h | 8 |
5 files changed, 94 insertions, 52 deletions
diff --git a/drm/libdrmframework/include/DrmManager.h b/drm/libdrmframework/include/DrmManager.h index 2ba9e99..dc3e460 100644 --- a/drm/libdrmframework/include/DrmManager.h +++ b/drm/libdrmframework/include/DrmManager.h @@ -53,6 +53,9 @@ public: virtual ~DrmManager(); public: + int addUniqueId(int uniqueId); + + void removeUniqueId(int uniqueId); status_t loadPlugIns(int uniqueId); @@ -73,7 +76,7 @@ public: DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest); - void saveRights(int uniqueId, const DrmRights& drmRights, + status_t saveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath); String8 getOriginalMimeType(int uniqueId, const String8& path); @@ -82,17 +85,17 @@ public: int checkRightsStatus(int uniqueId, const String8& path, int action); - void consumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve); + status_t consumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve); - void setPlaybackStatus( + status_t setPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position); bool validateAction( int uniqueId, const String8& path, int action, const ActionDescription& description); - void removeRights(int uniqueId, const String8& path); + status_t removeRights(int uniqueId, const String8& path); - void removeAllRights(int uniqueId); + status_t removeAllRights(int uniqueId); int openConvertSession(int uniqueId, const String8& mimeType); @@ -104,15 +107,15 @@ public: DecryptHandle* openDecryptSession(int uniqueId, int fd, int offset, int length); - void closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); + status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); - void initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, + status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); - status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, - int decryptUnitId, const DrmBuffer* encBuffer,DrmBuffer** decBuffer); + status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, + const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV); - void finalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId); + status_t finalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId); ssize_t pread(int uniqueId, DecryptHandle* decryptHandle, void* buffer, ssize_t numBytes, off_t offset); @@ -133,6 +136,7 @@ private: void initializePlugIns(int uniqueId); private: + static Vector<int> mUniqueIdVector; static const String8 EMPTY_STRING; int mDecryptSessionId; diff --git a/drm/libdrmframework/include/DrmManagerClientImpl.h b/drm/libdrmframework/include/DrmManagerClientImpl.h index e70e6e1..492c7f5 100644 --- a/drm/libdrmframework/include/DrmManagerClientImpl.h +++ b/drm/libdrmframework/include/DrmManagerClientImpl.h @@ -132,8 +132,10 @@ public: * @param[in] drmRights DrmRights to be saved * @param[in] rightsPath File path where rights to be saved * @param[in] contentPath File path where content was saved + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - void saveRights(int uniqueId, const DrmRights& drmRights, + status_t saveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath); /** @@ -179,8 +181,10 @@ public: * @param[in] decryptHandle Handle for the decryption session * @param[in] action Action to perform. (Action::DEFAULT, Action::PLAY, etc) * @param[in] reserve True if the rights should be reserved. + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - void consumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve); + status_t consumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve); /** * Informs the DRM engine about the playback actions performed on the DRM files. @@ -190,8 +194,10 @@ public: * @param[in] playbackStatus Playback action (Playback::START, Playback::STOP, Playback::PAUSE) * @param[in] position Position in the file (in milliseconds) where the start occurs. * Only valid together with Playback::START. + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - void setPlaybackStatus( + status_t setPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position); /** @@ -211,16 +217,20 @@ public: * * @param[in] uniqueId Unique identifier for a session * @param[in] path Path of the protected content + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - void removeRights(int uniqueId, const String8& path); + status_t removeRights(int uniqueId, const String8& path); /** * Removes all the rights information of each plug-in associated with * DRM framework. Will be used in master reset * * @param[in] uniqueId Unique identifier for a session + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - void removeAllRights(int uniqueId); + status_t removeAllRights(int uniqueId); /** * This API is for Forward Lock based DRM scheme. @@ -295,8 +305,10 @@ public: * * @param[in] uniqueId Unique identifier for a session * @param[in] decryptHandle Handle for the decryption session + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - void closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); + status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); /** * Initialize decryption for the given unit of the protected content @@ -305,8 +317,10 @@ public: * @param[in] decryptHandle Handle for the decryption session * @param[in] decryptUnitId ID which specifies decryption unit, such as track ID * @param[in] headerInfo Information for initializing decryption of this decrypUnit + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - void initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, + status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); /** @@ -319,14 +333,15 @@ public: * @param[in] decryptUnitId ID which specifies decryption unit, such as track ID * @param[in] encBuffer Encrypted data block * @param[out] decBuffer Decrypted data block + * @param[in] IV Optional buffer * @return status_t * Returns the error code for this API * DRM_NO_ERROR for success, and one of DRM_ERROR_UNKNOWN, DRM_ERROR_LICENSE_EXPIRED * DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED, * DRM_ERROR_DECRYPT for failure. */ - status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, - int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer); + status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, + const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV); /** * Finalize decryption for the given unit of the protected content @@ -334,8 +349,10 @@ public: * @param[in] uniqueId Unique identifier for a session * @param[in] decryptHandle Handle for the decryption session * @param[in] decryptUnitId ID which specifies decryption unit, such as track ID + * @return status_t + * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ - void finalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId); + status_t finalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId); /** * Reads the specified number of bytes from an open DRM file. @@ -388,7 +405,6 @@ private: private: static Mutex mMutex; - static Vector<int> mUniqueIdVector; static sp<IDrmManagerService> mDrmManagerService; static const sp<IDrmManagerService>& getDrmManagerService(); static const String8 EMPTY_STRING; diff --git a/drm/libdrmframework/include/DrmManagerService.h b/drm/libdrmframework/include/DrmManagerService.h index fef121c..f455e15 100644 --- a/drm/libdrmframework/include/DrmManagerService.h +++ b/drm/libdrmframework/include/DrmManagerService.h @@ -46,6 +46,10 @@ private: virtual ~DrmManagerService(); public: + int addUniqueId(int uniqueId); + + void removeUniqueId(int uniqueId); + status_t loadPlugIns(int uniqueId); status_t loadPlugIns(int uniqueId, const String8& plugInDirPath); @@ -65,7 +69,7 @@ public: DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInforequest); - void saveRights(int uniqueId, const DrmRights& drmRights, + status_t saveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath); String8 getOriginalMimeType(int uniqueId, const String8& path); @@ -74,17 +78,17 @@ public: int checkRightsStatus(int uniqueId, const String8& path,int action); - void consumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve); + status_t consumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve); - void setPlaybackStatus( + status_t setPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position); bool validateAction(int uniqueId, const String8& path, int action, const ActionDescription& description); - void removeRights(int uniqueId, const String8& path); + status_t removeRights(int uniqueId, const String8& path); - void removeAllRights(int uniqueId); + status_t removeAllRights(int uniqueId); int openConvertSession(int uniqueId, const String8& mimeType); @@ -96,15 +100,15 @@ public: DecryptHandle* openDecryptSession(int uniqueId, int fd, int offset, int length); - void closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); + status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); - void initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, + status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); - status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, - int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer); + status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, + const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV); - void finalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId); + status_t finalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId); ssize_t pread(int uniqueId, DecryptHandle* decryptHandle, void* buffer, ssize_t numBytes, off_t offset); diff --git a/drm/libdrmframework/include/IDrmManagerService.h b/drm/libdrmframework/include/IDrmManagerService.h index a4d128a..5c668ed 100644 --- a/drm/libdrmframework/include/IDrmManagerService.h +++ b/drm/libdrmframework/include/IDrmManagerService.h @@ -44,7 +44,9 @@ class IDrmManagerService : public IInterface { public: enum { - LOAD_PLUGINS = IBinder::FIRST_CALL_TRANSACTION, + ADD_UNIQUEID = IBinder::FIRST_CALL_TRANSACTION, + REMOVE_UNIQUEID, + LOAD_PLUGINS, LOAD_PLUGINS_FROM_PATH, SET_DRM_SERVICE_LISTENER, UNLOAD_PLUGINS, @@ -78,6 +80,10 @@ public: DECLARE_META_INTERFACE(DrmManagerService); public: + virtual int addUniqueId(int uniqueId) = 0; + + virtual void removeUniqueId(int uniqueId) = 0; + virtual status_t loadPlugIns(int uniqueId) = 0; virtual status_t loadPlugIns(int uniqueId, const String8& plugInDirPath) = 0; @@ -98,7 +104,7 @@ public: virtual DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInforequest) = 0; - virtual void saveRights(int uniqueId, const DrmRights& drmRights, + virtual status_t saveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath) = 0; virtual String8 getOriginalMimeType(int uniqueId, const String8& path) = 0; @@ -108,19 +114,19 @@ public: virtual int checkRightsStatus(int uniqueId, const String8& path, int action) = 0; - virtual void consumeRights( + virtual status_t consumeRights( int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) = 0; - virtual void setPlaybackStatus( + virtual status_t setPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) = 0; virtual bool validateAction( int uniqueId, const String8& path, int action, const ActionDescription& description) = 0; - virtual void removeRights(int uniqueId, const String8& path) = 0; + virtual status_t removeRights(int uniqueId, const String8& path) = 0; - virtual void removeAllRights(int uniqueId) = 0; + virtual status_t removeAllRights(int uniqueId) = 0; virtual int openConvertSession(int uniqueId, const String8& mimeType) = 0; @@ -134,15 +140,15 @@ public: virtual DecryptHandle* openDecryptSession(int uniqueId, int fd, int offset, int length) = 0; - virtual void closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0; + virtual status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0; - virtual void initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, + virtual status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) = 0; - virtual status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, - int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer) = 0; + virtual status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, + const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) = 0; - virtual void finalizeDecryptUnit( + virtual status_t finalizeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) = 0; virtual ssize_t pread(int uniqueId, DecryptHandle* decryptHandle, @@ -158,6 +164,10 @@ public: BpDrmManagerService(const sp<IBinder>& impl) : BpInterface<IDrmManagerService>(impl) {} + virtual int addUniqueId(int uniqueId); + + virtual void removeUniqueId(int uniqueId); + virtual status_t loadPlugIns(int uniqueId); virtual status_t loadPlugIns(int uniqueId, const String8& plugInDirPath); @@ -177,7 +187,7 @@ public: virtual DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInforequest); - virtual void saveRights(int uniqueId, const DrmRights& drmRights, + virtual status_t saveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath); virtual String8 getOriginalMimeType(int uniqueId, const String8& path); @@ -186,18 +196,18 @@ public: virtual int checkRightsStatus(int uniqueId, const String8& path, int action); - virtual void consumeRights( + virtual status_t consumeRights( int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve); - virtual void setPlaybackStatus( + virtual status_t setPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position); virtual bool validateAction( int uniqueId, const String8& path, int action, const ActionDescription& description); - virtual void removeRights(int uniqueId, const String8& path); + virtual status_t removeRights(int uniqueId, const String8& path); - virtual void removeAllRights(int uniqueId); + virtual status_t removeAllRights(int uniqueId); virtual int openConvertSession(int uniqueId, const String8& mimeType); @@ -211,15 +221,15 @@ public: virtual DecryptHandle* openDecryptSession(int uniqueId, int fd, int offset, int length); - virtual void closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); + virtual status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); - virtual void initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, + virtual status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); - virtual status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, - int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer); + virtual status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, + const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV); - virtual void finalizeDecryptUnit( + virtual status_t finalizeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId); virtual ssize_t pread(int uniqueId, DecryptHandle* decryptHandle, diff --git a/drm/libdrmframework/include/ReadWriteUtils.h b/drm/libdrmframework/include/ReadWriteUtils.h index 022149e..529b342 100644 --- a/drm/libdrmframework/include/ReadWriteUtils.h +++ b/drm/libdrmframework/include/ReadWriteUtils.h @@ -47,6 +47,14 @@ public: */ static String8 readBytes(const String8& filePath); /** + * Reads the data into the given buffer from the file path provided + * + * @param[in] filePath Path of the file + * @param[out] buffer Data read from the file + * @return Length of the data read from the file + */ + static int readBytes(const String8& filePath, char** buffer); + /** * Writes the data into the file path provided * * @param[in] filePath Path of the file |