diff options
author | Gloria Wang <gwang@google.com> | 2010-11-03 11:39:04 -0700 |
---|---|---|
committer | Gloria Wang <gwang@google.com> | 2010-11-03 11:39:04 -0700 |
commit | b251f75d5ca3fa19cfe8a284717e00dec31f18ea (patch) | |
tree | edb48bc69001ca3ef96bf072d71441bc8a60d547 /drm/common | |
parent | bf3122eed31cd24acdf5cfd25541db0beb77e6f0 (diff) | |
parent | 3041096d137144d9d1ebdd6df88ebe8e85133c05 (diff) | |
download | frameworks_av-b251f75d5ca3fa19cfe8a284717e00dec31f18ea.zip frameworks_av-b251f75d5ca3fa19cfe8a284717e00dec31f18ea.tar.gz frameworks_av-b251f75d5ca3fa19cfe8a284717e00dec31f18ea.tar.bz2 |
resolved conflicts for merge of a8d7b747 to master
Change-Id: I8a4b72c9f9a10de8bbc285e00e2dd5cb9f498349
Diffstat (limited to 'drm/common')
-rw-r--r-- | drm/common/DrmEngineBase.cpp | 5 | ||||
-rw-r--r-- | drm/common/DrmInfoStatus.cpp | 3 | ||||
-rw-r--r-- | drm/common/IDrmManagerService.cpp | 119 |
3 files changed, 75 insertions, 52 deletions
diff --git a/drm/common/DrmEngineBase.cpp b/drm/common/DrmEngineBase.cpp index 17cdf54..10c64ee 100644 --- a/drm/common/DrmEngineBase.cpp +++ b/drm/common/DrmEngineBase.cpp @@ -120,6 +120,11 @@ status_t DrmEngineBase::openDecryptSession( return onOpenDecryptSession(uniqueId, decryptHandle, fd, offset, length); } +status_t DrmEngineBase::openDecryptSession( + int uniqueId, DecryptHandle* decryptHandle, const char* uri) { + return onOpenDecryptSession(uniqueId, decryptHandle, uri); +} + status_t DrmEngineBase::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { return onCloseDecryptSession(uniqueId, decryptHandle); } diff --git a/drm/common/DrmInfoStatus.cpp b/drm/common/DrmInfoStatus.cpp index f3a1516..8ec7311 100644 --- a/drm/common/DrmInfoStatus.cpp +++ b/drm/common/DrmInfoStatus.cpp @@ -19,8 +19,9 @@ using namespace android; DrmInfoStatus::DrmInfoStatus( - int _statusCode, const DrmBuffer* _drmBuffer, const String8& _mimeType) : + int _statusCode, int _infoType, const DrmBuffer* _drmBuffer, const String8& _mimeType) : statusCode(_statusCode), + infoType(_infoType), drmBuffer(_drmBuffer), mimeType(_mimeType) { diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp index e46451d..c3d12f0 100644 --- a/drm/common/IDrmManagerService.cpp +++ b/drm/common/IDrmManagerService.cpp @@ -53,27 +53,18 @@ void BpDrmManagerService::removeUniqueId(int uniqueId) { remote()->transact(REMOVE_UNIQUEID, data, &reply); } -status_t BpDrmManagerService::loadPlugIns(int uniqueId) { - LOGV("load plugins"); +void BpDrmManagerService::addClient(int uniqueId) { Parcel data, reply; - data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor()); data.writeInt32(uniqueId); - - remote()->transact(LOAD_PLUGINS, data, &reply); - return reply.readInt32(); + remote()->transact(ADD_CLIENT, data, &reply); } -status_t BpDrmManagerService::loadPlugIns(int uniqueId, const String8& plugInDirPath) { - LOGV("load plugins from path"); +void BpDrmManagerService::removeClient(int uniqueId) { Parcel data, reply; - data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor()); data.writeInt32(uniqueId); - data.writeString8(plugInDirPath); - - remote()->transact(LOAD_PLUGINS_FROM_PATH, data, &reply); - return reply.readInt32(); + remote()->transact(REMOVE_CLIENT, data, &reply); } status_t BpDrmManagerService::setDrmServiceListener( @@ -88,17 +79,6 @@ status_t BpDrmManagerService::setDrmServiceListener( return reply.readInt32(); } -status_t BpDrmManagerService::unloadPlugIns(int uniqueId) { - LOGV("unload plugins"); - Parcel data, reply; - - data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor()); - data.writeInt32(uniqueId); - - remote()->transact(UNLOAD_PLUGINS, data, &reply); - return reply.readInt32(); -} - status_t BpDrmManagerService::installDrmEngine(int uniqueId, const String8& drmEngineFile) { LOGV("Install DRM Engine"); Parcel data, reply; @@ -191,6 +171,7 @@ DrmInfoStatus* BpDrmManagerService::processDrmInfo(int uniqueId, const DrmInfo* if (0 != reply.dataAvail()) { //Filling DRM Info Status const int statusCode = reply.readInt32(); + const int infoType = reply.readInt32(); const String8 mimeType = reply.readString8(); DrmBuffer* drmBuffer = NULL; @@ -203,7 +184,7 @@ DrmInfoStatus* BpDrmManagerService::processDrmInfo(int uniqueId, const DrmInfo* } drmBuffer = new DrmBuffer(data, bufferSize); } - drmInfoStatus = new DrmInfoStatus(statusCode, drmBuffer, mimeType); + drmInfoStatus = new DrmInfoStatus(statusCode, infoType, drmBuffer, mimeType); } return drmInfoStatus; } @@ -538,8 +519,7 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( LOGV("Entering BpDrmManagerService::openDecryptSession"); Parcel data, reply; - const String16 interfaceDescriptor = IDrmManagerService::getInterfaceDescriptor(); - data.writeInterfaceToken(interfaceDescriptor); + data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor()); data.writeInt32(uniqueId); data.writeFileDescriptor(fd); data.writeInt32(offset); @@ -563,6 +543,34 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( return handle; } +DecryptHandle* BpDrmManagerService::openDecryptSession(int uniqueId, const char* uri) { + LOGV("Entering BpDrmManagerService::openDecryptSession"); + Parcel data, reply; + + data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor()); + data.writeInt32(uniqueId); + data.writeString8(String8(uri)); + + remote()->transact(OPEN_DECRYPT_SESSION_FROM_URI, data, &reply); + + DecryptHandle* handle = NULL; + if (0 != reply.dataAvail()) { + handle = new DecryptHandle(); + handle->decryptId = reply.readInt32(); + handle->mimeType = reply.readString8(); + handle->decryptApiType = reply.readInt32(); + handle->status = reply.readInt32(); + handle->decryptInfo = NULL; + if (0 != reply.dataAvail()) { + handle->decryptInfo = new DecryptInfo(); + handle->decryptInfo->decryptBufferLength = reply.readInt32(); + } + } else { + LOGE("no decryptHandle is generated in service side"); + } + return handle; +} + status_t BpDrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { LOGV("closeDecryptSession"); Parcel data, reply; @@ -744,25 +752,19 @@ status_t BnDrmManagerService::onTransact( return DRM_NO_ERROR; } - case LOAD_PLUGINS: + case ADD_CLIENT: { - LOGV("BnDrmManagerService::onTransact :LOAD_PLUGINS"); + LOGV("BnDrmManagerService::onTransact :ADD_CLIENT"); CHECK_INTERFACE(IDrmManagerService, data, reply); - - status_t status = loadPlugIns(data.readInt32()); - - reply->writeInt32(status); + addClient(data.readInt32()); return DRM_NO_ERROR; } - case LOAD_PLUGINS_FROM_PATH: + case REMOVE_CLIENT: { - LOGV("BnDrmManagerService::onTransact :LOAD_PLUGINS_FROM_PATH"); + LOGV("BnDrmManagerService::onTransact :REMOVE_CLIENT"); CHECK_INTERFACE(IDrmManagerService, data, reply); - - status_t status = loadPlugIns(data.readInt32(), data.readString8()); - - reply->writeInt32(status); + removeClient(data.readInt32()); return DRM_NO_ERROR; } @@ -781,18 +783,6 @@ status_t BnDrmManagerService::onTransact( return DRM_NO_ERROR; } - case UNLOAD_PLUGINS: - { - LOGV("BnDrmManagerService::onTransact :UNLOAD_PLUGINS"); - CHECK_INTERFACE(IDrmManagerService, data, reply); - - const int uniqueId = data.readInt32(); - status_t status = unloadPlugIns(uniqueId); - - reply->writeInt32(status); - return DRM_NO_ERROR; - } - case INSTALL_DRM_ENGINE: { LOGV("BnDrmManagerService::onTransact :INSTALL_DRM_ENGINE"); @@ -879,6 +869,7 @@ status_t BnDrmManagerService::onTransact( if (NULL != drmInfoStatus) { //Filling DRM Info Status contents reply->writeInt32(drmInfoStatus->statusCode); + reply->writeInt32(drmInfoStatus->infoType); reply->writeString8(drmInfoStatus->mimeType); if (NULL != drmInfoStatus->drmBuffer) { @@ -1235,6 +1226,32 @@ status_t BnDrmManagerService::onTransact( return DRM_NO_ERROR; } + case OPEN_DECRYPT_SESSION_FROM_URI: + { + LOGV("BnDrmManagerService::onTransact :OPEN_DECRYPT_SESSION_FROM_URI"); + CHECK_INTERFACE(IDrmManagerService, data, reply); + + const int uniqueId = data.readInt32(); + const String8 uri = data.readString8(); + + DecryptHandle* handle = openDecryptSession(uniqueId, uri.string()); + + if (NULL != handle) { + reply->writeInt32(handle->decryptId); + reply->writeString8(handle->mimeType); + reply->writeInt32(handle->decryptApiType); + reply->writeInt32(handle->status); + if (NULL != handle->decryptInfo) { + reply->writeInt32(handle->decryptInfo->decryptBufferLength); + delete handle->decryptInfo; handle->decryptInfo = NULL; + } + } else { + LOGE("NULL decryptHandle is returned"); + } + delete handle; handle = NULL; + return DRM_NO_ERROR; + } + case CLOSE_DECRYPT_SESSION: { LOGV("BnDrmManagerService::onTransact :CLOSE_DECRYPT_SESSION"); |