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 | dc549d60f98d809f626c99de614960409a847054 (patch) | |
tree | bb40a8371811f1c591cc22afa331e57b3d091c9e /drm/drmserver/DrmManagerService.cpp | |
parent | 7d9c73fb6f6f79f7f92b77482a0edbd7b89f2564 (diff) |
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/drmserver/DrmManagerService.cpp')
-rw-r--r-- | drm/drmserver/DrmManagerService.cpp | 69 |
1 files changed, 40 insertions, 29 deletions
diff --git a/drm/drmserver/DrmManagerService.cpp b/drm/drmserver/DrmManagerService.cpp index 9d000e9de28a..843dddb8aa18 100644 --- a/drm/drmserver/DrmManagerService.cpp +++ b/drm/drmserver/DrmManagerService.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define LOG_NDEBUG 0 +//#define LOG_NDEBUG 0 #define LOG_TAG "DrmManagerService(Native)" #include <utils/Log.h> @@ -29,20 +29,23 @@ using namespace android; #define SUCCESS 0 #define DRM_DIRECTORY_PERMISSION 0700 +#define DRM_PLUGINS_ROOT "/data/drm/plugins" +#define DRM_PLUGINS_NATIVE "/data/drm/plugins/native" +#define DRM_PLUGINS_NATIVE_DATABASES "/data/drm/plugins/native/databases" void DrmManagerService::instantiate() { LOGV("instantiate"); - int res = mkdir("/data/drm/plugins", DRM_DIRECTORY_PERMISSION);
- if (SUCCESS == res || EEXIST == errno) {
- res = mkdir("/data/drm/plugins/native", DRM_DIRECTORY_PERMISSION);
- if (SUCCESS == res || EEXIST == errno) {
- res = mkdir("/data/drm/plugins/native/databases", DRM_DIRECTORY_PERMISSION);
- if (SUCCESS == res || EEXIST == errno) {
- defaultServiceManager()
- ->addService(String16("drm.drmManager"), new DrmManagerService());
- }
- }
+ int res = mkdir(DRM_PLUGINS_ROOT, DRM_DIRECTORY_PERMISSION); + if (SUCCESS == res || EEXIST == errno) { + res = mkdir(DRM_PLUGINS_NATIVE, DRM_DIRECTORY_PERMISSION); + if (SUCCESS == res || EEXIST == errno) { + res = mkdir(DRM_PLUGINS_NATIVE_DATABASES, DRM_DIRECTORY_PERMISSION); + if (SUCCESS == res || EEXIST == errno) { + defaultServiceManager() + ->addService(String16("drm.drmManager"), new DrmManagerService()); + } + } } } @@ -57,6 +60,14 @@ DrmManagerService::~DrmManagerService() { delete mDrmManager; mDrmManager = NULL; } +int DrmManagerService::addUniqueId(int uniqueId) { + return mDrmManager->addUniqueId(uniqueId); +} + +void DrmManagerService::removeUniqueId(int uniqueId) { + mDrmManager->removeUniqueId(uniqueId); +} + status_t DrmManagerService::loadPlugIns(int uniqueId) { LOGV("Entering load plugins"); return mDrmManager->loadPlugIns(uniqueId); @@ -105,7 +116,7 @@ DrmInfo* DrmManagerService::acquireDrmInfo(int uniqueId, const DrmInfoRequest* d return mDrmManager->acquireDrmInfo(uniqueId, drmInfoRequest); } -void DrmManagerService::saveRights( +status_t DrmManagerService::saveRights( int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath) { LOGV("Entering saveRights"); @@ -129,16 +140,16 @@ int DrmManagerService::checkRightsStatus( return mDrmManager->checkRightsStatus(uniqueId, path, action); } -void DrmManagerService::consumeRights( +status_t DrmManagerService::consumeRights( int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) { LOGV("Entering consumeRights"); - mDrmManager->consumeRights(uniqueId, decryptHandle, action, reserve); + return mDrmManager->consumeRights(uniqueId, decryptHandle, action, reserve); } -void DrmManagerService::setPlaybackStatus( +status_t DrmManagerService::setPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) { LOGV("Entering setPlaybackStatus"); - mDrmManager->setPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position); + return mDrmManager->setPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position); } bool DrmManagerService::validateAction( @@ -148,14 +159,14 @@ bool DrmManagerService::validateAction( return mDrmManager->validateAction(uniqueId, path, action, description); } -void DrmManagerService::removeRights(int uniqueId, const String8& path) { +status_t DrmManagerService::removeRights(int uniqueId, const String8& path) { LOGV("Entering removeRights"); - mDrmManager->removeRights(uniqueId, path); + return mDrmManager->removeRights(uniqueId, path); } -void DrmManagerService::removeAllRights(int uniqueId) { +status_t DrmManagerService::removeAllRights(int uniqueId) { LOGV("Entering removeAllRights"); - mDrmManager->removeAllRights(uniqueId); + return mDrmManager->removeAllRights(uniqueId); } int DrmManagerService::openConvertSession(int uniqueId, const String8& mimeType) { @@ -186,28 +197,28 @@ DecryptHandle* DrmManagerService::openDecryptSession( return mDrmManager->openDecryptSession(uniqueId, fd, offset, length); } -void DrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { +status_t DrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { LOGV("Entering closeDecryptSession"); - mDrmManager->closeDecryptSession(uniqueId, decryptHandle); + return mDrmManager->closeDecryptSession(uniqueId, decryptHandle); } -void DrmManagerService::initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, +status_t DrmManagerService::initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) { LOGV("Entering initializeDecryptUnit"); - mDrmManager->initializeDecryptUnit(uniqueId,decryptHandle, decryptUnitId, headerInfo); + return mDrmManager->initializeDecryptUnit(uniqueId,decryptHandle, decryptUnitId, headerInfo); } status_t DrmManagerService::decrypt( - int uniqueId, DecryptHandle* decryptHandle, - int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer) { + int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, + const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) { LOGV("Entering decrypt"); - return mDrmManager->decrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer); + return mDrmManager->decrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV); } -void DrmManagerService::finalizeDecryptUnit( +status_t DrmManagerService::finalizeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) { LOGV("Entering finalizeDecryptUnit"); - mDrmManager->finalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId); + return mDrmManager->finalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId); } ssize_t DrmManagerService::pread(int uniqueId, DecryptHandle* decryptHandle, |