Loading drm/common/DrmEngineBase.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -79,12 +79,12 @@ int DrmEngineBase::checkRightsStatus(int uniqueId, const String8& path, int acti } status_t DrmEngineBase::consumeRights( int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) { int uniqueId, sp<DecryptHandle>& decryptHandle, int action, bool reserve) { return onConsumeRights(uniqueId, decryptHandle, action, reserve); } status_t DrmEngineBase::setPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) { int uniqueId, sp<DecryptHandle>& decryptHandle, int playbackStatus, int64_t position) { return onSetPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position); } Loading Loading @@ -120,7 +120,7 @@ DrmSupportInfo* DrmEngineBase::getSupportInfo(int uniqueId) { } status_t DrmEngineBase::openDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, int fd, off64_t offset, off64_t length, const char* mime) { if (!mime || mime[0] == '\0') { Loading @@ -131,7 +131,7 @@ status_t DrmEngineBase::openDecryptSession( } status_t DrmEngineBase::openDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, const char* uri, const char* mime) { if (!mime || mime[0] == '\0') { return onOpenDecryptSession(uniqueId, decryptHandle, uri); Loading @@ -139,33 +139,33 @@ status_t DrmEngineBase::openDecryptSession( return onOpenDecryptSession(uniqueId, decryptHandle, uri, mime); } status_t DrmEngineBase::openDecryptSession(int uniqueId, DecryptHandle* decryptHandle, status_t DrmEngineBase::openDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle, const DrmBuffer& buf, const String8& mimeType) { return onOpenDecryptSession(uniqueId, decryptHandle, buf, mimeType); } status_t DrmEngineBase::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { status_t DrmEngineBase::closeDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle) { return onCloseDecryptSession(uniqueId, decryptHandle); } status_t DrmEngineBase::initializeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) { int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) { return onInitializeDecryptUnit(uniqueId, decryptHandle, decryptUnitId, headerInfo); } status_t DrmEngineBase::decrypt( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) { return onDecrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV); } status_t DrmEngineBase::finalizeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) { int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId) { return onFinalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId); } ssize_t DrmEngineBase::pread( int uniqueId, DecryptHandle* decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) { int uniqueId, sp<DecryptHandle>& decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) { return onPread(uniqueId, decryptHandle, buffer, numBytes, offset); } drm/common/IDrmManagerService.cpp +53 −54 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ using namespace android; static void writeDecryptHandleToParcelData( const DecryptHandle* handle, Parcel* data) { const sp<DecryptHandle>& handle, Parcel* data) { data->writeInt32(handle->decryptId); data->writeString8(handle->mimeType); data->writeInt32(handle->decryptApiType); Loading Loading @@ -67,7 +67,7 @@ static void writeDecryptHandleToParcelData( } static void readDecryptHandleFromParcelData( DecryptHandle* handle, const Parcel& data) { sp<DecryptHandle>& handle, const Parcel& data) { if (0 == data.dataAvail()) { return; } Loading Loading @@ -99,7 +99,7 @@ static void readDecryptHandleFromParcelData( } } static void clearDecryptHandle(DecryptHandle* handle) { static void clearDecryptHandle(sp<DecryptHandle> &handle) { if (handle == NULL) { return; } Loading Loading @@ -414,7 +414,7 @@ int BpDrmManagerService::checkRightsStatus(int uniqueId, const String8& path, in } status_t BpDrmManagerService::consumeRights( int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) { int uniqueId, sp<DecryptHandle>& decryptHandle, int action, bool reserve) { ALOGV("consumeRights"); Parcel data, reply; Loading @@ -431,7 +431,7 @@ status_t BpDrmManagerService::consumeRights( } status_t BpDrmManagerService::setPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) { int uniqueId, sp<DecryptHandle>& decryptHandle, int playbackStatus, int64_t position) { ALOGV("setPlaybackStatus"); Parcel data, reply; Loading Loading @@ -603,7 +603,7 @@ status_t BpDrmManagerService::getAllSupportInfo( return reply.readInt32(); } DecryptHandle* BpDrmManagerService::openDecryptSession( sp<DecryptHandle> BpDrmManagerService::openDecryptSession( int uniqueId, int fd, off64_t offset, off64_t length, const char* mime) { ALOGV("Entering BpDrmManagerService::openDecryptSession"); Parcel data, reply; Loading @@ -621,7 +621,7 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( remote()->transact(OPEN_DECRYPT_SESSION, data, &reply); DecryptHandle* handle = NULL; sp<DecryptHandle> handle; if (0 != reply.dataAvail()) { handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, reply); Loading @@ -629,7 +629,7 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( return handle; } DecryptHandle* BpDrmManagerService::openDecryptSession( sp<DecryptHandle> BpDrmManagerService::openDecryptSession( int uniqueId, const char* uri, const char* mime) { ALOGV("Entering BpDrmManagerService::openDecryptSession: mime=%s", mime? mime: "NULL"); Loading @@ -646,7 +646,7 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( remote()->transact(OPEN_DECRYPT_SESSION_FROM_URI, data, &reply); DecryptHandle* handle = NULL; sp<DecryptHandle> handle; if (0 != reply.dataAvail()) { handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, reply); Loading @@ -656,7 +656,7 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( return handle; } DecryptHandle* BpDrmManagerService::openDecryptSession( sp<DecryptHandle> BpDrmManagerService::openDecryptSession( int uniqueId, const DrmBuffer& buf, const String8& mimeType) { ALOGV("Entering BpDrmManagerService::openDecryptSession"); Parcel data, reply; Loading @@ -673,7 +673,7 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( remote()->transact(OPEN_DECRYPT_SESSION_FOR_STREAMING, data, &reply); DecryptHandle* handle = NULL; sp<DecryptHandle> handle; if (0 != reply.dataAvail()) { handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, reply); Loading @@ -683,7 +683,7 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( return handle; } status_t BpDrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { status_t BpDrmManagerService::closeDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle) { ALOGV("closeDecryptSession"); Parcel data, reply; Loading @@ -698,7 +698,7 @@ status_t BpDrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* d } status_t BpDrmManagerService::initializeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) { ALOGV("initializeDecryptUnit"); Parcel data, reply; Loading @@ -718,7 +718,7 @@ status_t BpDrmManagerService::initializeDecryptUnit( } status_t BpDrmManagerService::decrypt( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) { ALOGV("decrypt"); Parcel data, reply; Loading Loading @@ -754,7 +754,7 @@ status_t BpDrmManagerService::decrypt( } status_t BpDrmManagerService::finalizeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) { int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId) { ALOGV("finalizeDecryptUnit"); Parcel data, reply; Loading @@ -770,7 +770,7 @@ status_t BpDrmManagerService::finalizeDecryptUnit( } ssize_t BpDrmManagerService::pread( int uniqueId, DecryptHandle* decryptHandle, void* buffer, int uniqueId, sp<DecryptHandle>& decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) { ALOGV("read"); Parcel data, reply; Loading Loading @@ -1128,16 +1128,16 @@ status_t BnDrmManagerService::onTransact( const int uniqueId = data.readInt32(); DecryptHandle handle; readDecryptHandleFromParcelData(&handle, data); sp<DecryptHandle> handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, data); const int action = data.readInt32(); const bool reserve = static_cast<bool>(data.readInt32()); const status_t status = consumeRights(uniqueId, &handle, action, reserve); = consumeRights(uniqueId, handle, action, reserve); reply->writeInt32(status); clearDecryptHandle(&handle); clearDecryptHandle(handle); return DRM_NO_ERROR; } Loading @@ -1148,16 +1148,16 @@ status_t BnDrmManagerService::onTransact( const int uniqueId = data.readInt32(); DecryptHandle handle; readDecryptHandleFromParcelData(&handle, data); sp<DecryptHandle> handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, data); const int playbackStatus = data.readInt32(); const int64_t position = data.readInt64(); const status_t status = setPlaybackStatus(uniqueId, &handle, playbackStatus, position); = setPlaybackStatus(uniqueId, handle, playbackStatus, position); reply->writeInt32(status); clearDecryptHandle(&handle); clearDecryptHandle(handle); return DRM_NO_ERROR; } Loading Loading @@ -1329,13 +1329,13 @@ status_t BnDrmManagerService::onTransact( const off64_t length = data.readInt64(); const String8 mime = data.readString8(); DecryptHandle* handle sp<DecryptHandle> handle = openDecryptSession(uniqueId, fd, offset, length, mime.string()); if (NULL != handle) { writeDecryptHandleToParcelData(handle, reply); if (NULL != handle.get()) { writeDecryptHandleToParcelData(handle.get(), reply); clearDecryptHandle(handle); delete handle; handle = NULL; handle.clear(); } return DRM_NO_ERROR; } Loading @@ -1349,13 +1349,13 @@ status_t BnDrmManagerService::onTransact( const String8 uri = data.readString8(); const String8 mime = data.readString8(); DecryptHandle* handle = openDecryptSession(uniqueId, uri.string(), mime.string()); sp<DecryptHandle> handle = openDecryptSession(uniqueId, uri.string(), mime.string()); if (NULL != handle) { writeDecryptHandleToParcelData(handle, reply); if (NULL != handle.get()) { writeDecryptHandleToParcelData(handle.get(), reply); clearDecryptHandle(handle); delete handle; handle = NULL; handle.clear(); } else { ALOGV("NULL decryptHandle is returned"); } Loading @@ -1373,13 +1373,12 @@ status_t BnDrmManagerService::onTransact( bufferSize); const String8 mimeType(data.readString8()); DecryptHandle* handle = openDecryptSession(uniqueId, buf, mimeType); sp<DecryptHandle> handle = openDecryptSession(uniqueId, buf, mimeType); if (handle != NULL) { writeDecryptHandleToParcelData(handle, reply); clearDecryptHandle(handle); delete handle; handle = NULL; handle.clear(); } else { ALOGV("NULL decryptHandle is returned"); } Loading @@ -1393,7 +1392,7 @@ status_t BnDrmManagerService::onTransact( const int uniqueId = data.readInt32(); DecryptHandle* handle = new DecryptHandle(); sp<DecryptHandle> handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, data); const status_t status = closeDecryptSession(uniqueId, handle); Loading @@ -1408,8 +1407,8 @@ status_t BnDrmManagerService::onTransact( const int uniqueId = data.readInt32(); DecryptHandle handle; readDecryptHandleFromParcelData(&handle, data); sp<DecryptHandle> handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, data); const int decryptUnitId = data.readInt32(); Loading @@ -1417,17 +1416,17 @@ status_t BnDrmManagerService::onTransact( const uint32_t bufferSize = data.readInt32(); if (bufferSize > data.dataAvail()) { reply->writeInt32(BAD_VALUE); clearDecryptHandle(&handle); clearDecryptHandle(handle); return DRM_NO_ERROR; } DrmBuffer* headerInfo = NULL; headerInfo = new DrmBuffer((char *)data.readInplace(bufferSize), bufferSize); const status_t status = initializeDecryptUnit(uniqueId, &handle, decryptUnitId, headerInfo); = initializeDecryptUnit(uniqueId, handle, decryptUnitId, headerInfo); reply->writeInt32(status); clearDecryptHandle(&handle); clearDecryptHandle(handle); delete headerInfo; headerInfo = NULL; return DRM_NO_ERROR; } Loading @@ -1439,8 +1438,8 @@ status_t BnDrmManagerService::onTransact( const int uniqueId = data.readInt32(); DecryptHandle handle; readDecryptHandleFromParcelData(&handle, data); sp<DecryptHandle> handle = new DecryptHandle; readDecryptHandleFromParcelData(handle, data); const int decryptUnitId = data.readInt32(); const uint32_t decBufferSize = data.readInt32(); Loading @@ -1450,7 +1449,7 @@ status_t BnDrmManagerService::onTransact( decBufferSize > MAX_BINDER_TRANSACTION_SIZE) { reply->writeInt32(BAD_VALUE); reply->writeInt32(0); clearDecryptHandle(&handle); clearDecryptHandle(handle); return DRM_NO_ERROR; } Loading @@ -1470,7 +1469,7 @@ status_t BnDrmManagerService::onTransact( } const status_t status = decrypt(uniqueId, &handle, decryptUnitId, encBuffer, &decBuffer, IV); = decrypt(uniqueId, handle, decryptUnitId, encBuffer, &decBuffer, IV); reply->writeInt32(status); Loading @@ -1480,7 +1479,7 @@ status_t BnDrmManagerService::onTransact( reply->write(decBuffer->data, size); } clearDecryptHandle(&handle); clearDecryptHandle(handle); delete encBuffer; encBuffer = NULL; delete decBuffer; decBuffer = NULL; delete [] buffer; buffer = NULL; Loading @@ -1495,13 +1494,13 @@ status_t BnDrmManagerService::onTransact( const int uniqueId = data.readInt32(); DecryptHandle handle; readDecryptHandleFromParcelData(&handle, data); sp<DecryptHandle> handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, data); const status_t status = finalizeDecryptUnit(uniqueId, &handle, data.readInt32()); const status_t status = finalizeDecryptUnit(uniqueId, handle, data.readInt32()); reply->writeInt32(status); clearDecryptHandle(&handle); clearDecryptHandle(handle); return DRM_NO_ERROR; } Loading @@ -1512,8 +1511,8 @@ status_t BnDrmManagerService::onTransact( const int uniqueId = data.readInt32(); DecryptHandle handle; readDecryptHandleFromParcelData(&handle, data); sp<DecryptHandle> handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, data); const uint32_t numBytes = data.readInt32(); if (numBytes > MAX_BINDER_TRANSACTION_SIZE) { Loading @@ -1524,13 +1523,13 @@ status_t BnDrmManagerService::onTransact( const off64_t offset = data.readInt64(); ssize_t result = pread(uniqueId, &handle, buffer, numBytes, offset); ssize_t result = pread(uniqueId, handle, buffer, numBytes, offset); reply->writeInt32(result); if (0 < result) { reply->write(buffer, result); } clearDecryptHandle(&handle); clearDecryptHandle(handle); delete [] buffer, buffer = NULL; return DRM_NO_ERROR; } Loading drm/common/include/DrmEngineBase.h +25 −22 Original line number Diff line number Diff line Loading @@ -59,10 +59,11 @@ public: int checkRightsStatus(int uniqueId, const String8& path, int action); status_t consumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve); status_t consumeRights(int uniqueId, sp<DecryptHandle>& decryptHandle, int action, bool reserve); status_t setPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position); int uniqueId, sp<DecryptHandle>& decryptHandle, int playbackStatus, int64_t position); bool validateAction( int uniqueId, const String8& path, int action, const ActionDescription& description); Loading @@ -80,27 +81,28 @@ public: DrmSupportInfo* getSupportInfo(int uniqueId); status_t openDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, int fd, off64_t offset, off64_t length, const char* mime); status_t openDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, const char* uri, const char* mime); status_t openDecryptSession(int uniqueId, DecryptHandle* decryptHandle, status_t openDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle, const DrmBuffer& buf, const String8& mimeType); status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); status_t closeDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle); status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, status_t initializeDecryptUnit(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, status_t decrypt(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV); status_t finalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId); status_t finalizeDecryptUnit(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId); ssize_t pread(int uniqueId, DecryptHandle* decryptHandle, ssize_t pread(int uniqueId, sp<DecryptHandle>& decryptHandle, void* buffer, ssize_t numBytes, off64_t offset); protected: Loading Loading @@ -265,7 +267,7 @@ protected: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t onConsumeRights(int uniqueId, DecryptHandle* decryptHandle, virtual status_t onConsumeRights(int uniqueId, sp<DecryptHandle>& decryptHandle, int action, bool reserve) = 0; /** Loading @@ -280,7 +282,8 @@ protected: * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t onSetPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) = 0; int uniqueId, sp<DecryptHandle>& decryptHandle, int playbackStatus, int64_t position) = 0; /** * Validates whether an action on the DRM content is allowed or not. Loading Loading @@ -381,7 +384,7 @@ protected: * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t onOpenDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, int fd, off64_t offset, off64_t length) = 0; /** Loading @@ -398,7 +401,7 @@ protected: * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t onOpenDecryptSession( int /* uniqueId */, DecryptHandle* /* decryptHandle */, int /* uniqueId */, sp<DecryptHandle>& /* decryptHandle */, int /* fd */, off64_t /* offset */, off64_t /* length */, const char* /* mime */) { Loading @@ -415,7 +418,7 @@ protected: * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t onOpenDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, const char* uri) = 0; /** Loading @@ -430,7 +433,7 @@ protected: * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t onOpenDecryptSession( int /* uniqueId */, DecryptHandle* /* decryptHandle */, int /* uniqueId */, sp<DecryptHandle>& /* decryptHandle */, const char* /* uri */, const char* /* mime */) { return DRM_ERROR_CANNOT_HANDLE; Loading @@ -447,7 +450,7 @@ protected: * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t onOpenDecryptSession(int /* uniqueId */, DecryptHandle* /* decryptHandle */, sp<DecryptHandle>& /* decryptHandle */, const DrmBuffer& /* buf */, const String8& /* mimeType */) { return DRM_ERROR_CANNOT_HANDLE; Loading @@ -461,7 +464,7 @@ protected: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t onCloseDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0; virtual status_t onCloseDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle) = 0; /** * Initialize decryption for the given unit of the protected content Loading @@ -473,7 +476,7 @@ protected: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, virtual status_t onInitializeDecryptUnit(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) = 0; /** Loading @@ -493,7 +496,7 @@ protected: * DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED, * DRM_ERROR_DECRYPT for failure. */ virtual status_t onDecrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, virtual status_t onDecrypt(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) = 0; /** Loading @@ -506,7 +509,7 @@ protected: * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t onFinalizeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) = 0; int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId) = 0; /** * Reads the specified number of bytes from an open DRM file. Loading @@ -519,7 +522,7 @@ protected: * * @return Number of bytes read. Returns -1 for Failure. */ virtual ssize_t onPread(int uniqueId, DecryptHandle* decryptHandle, virtual ssize_t onPread(int uniqueId, sp<DecryptHandle>& decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) = 0; }; Loading drm/common/include/IDrmEngine.h +10 −10 Original line number Diff line number Diff line Loading @@ -210,7 +210,7 @@ public: * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t consumeRights( int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) = 0; int uniqueId, sp<DecryptHandle>& decryptHandle, int action, bool reserve) = 0; /** * Informs the DRM Engine about the playback actions performed on the DRM files. Loading @@ -223,7 +223,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t setPlaybackStatus(int uniqueId, DecryptHandle* decryptHandle, virtual status_t setPlaybackStatus(int uniqueId, sp<DecryptHandle>& decryptHandle, int playbackStatus, int64_t position) = 0; /** Loading Loading @@ -327,7 +327,7 @@ public: * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t openDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, int fd, off64_t offset, off64_t length, const char* mime) = 0; /** Loading @@ -342,7 +342,7 @@ public: * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t openDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, const char* uri, const char* mime) = 0; /** Loading @@ -355,7 +355,7 @@ public: * @return * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t openDecryptSession(int uniqueId, DecryptHandle* decryptHandle, virtual status_t openDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle, const DrmBuffer& buf, const String8& mimeType) = 0; /** Loading @@ -366,7 +366,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0; virtual status_t closeDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle) = 0; /** * Initialize decryption for the given unit of the protected content Loading @@ -378,7 +378,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, virtual status_t initializeDecryptUnit(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) = 0; /** Loading @@ -398,7 +398,7 @@ public: * DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED, * DRM_ERROR_DECRYPT for failure. */ virtual status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, virtual status_t decrypt(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) = 0; /** Loading @@ -411,7 +411,7 @@ public: * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t finalizeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) = 0; int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId) = 0; /** * Reads the specified number of bytes from an open DRM file. Loading @@ -424,7 +424,7 @@ public: * * @return Number of bytes read. Returns -1 for Failure. */ virtual ssize_t pread(int uniqueId, DecryptHandle* decryptHandle, virtual ssize_t pread(int uniqueId, sp<DecryptHandle>& decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) = 0; }; Loading drm/common/include/IDrmManagerService.h +21 −20 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
drm/common/DrmEngineBase.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -79,12 +79,12 @@ int DrmEngineBase::checkRightsStatus(int uniqueId, const String8& path, int acti } status_t DrmEngineBase::consumeRights( int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) { int uniqueId, sp<DecryptHandle>& decryptHandle, int action, bool reserve) { return onConsumeRights(uniqueId, decryptHandle, action, reserve); } status_t DrmEngineBase::setPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) { int uniqueId, sp<DecryptHandle>& decryptHandle, int playbackStatus, int64_t position) { return onSetPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position); } Loading Loading @@ -120,7 +120,7 @@ DrmSupportInfo* DrmEngineBase::getSupportInfo(int uniqueId) { } status_t DrmEngineBase::openDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, int fd, off64_t offset, off64_t length, const char* mime) { if (!mime || mime[0] == '\0') { Loading @@ -131,7 +131,7 @@ status_t DrmEngineBase::openDecryptSession( } status_t DrmEngineBase::openDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, const char* uri, const char* mime) { if (!mime || mime[0] == '\0') { return onOpenDecryptSession(uniqueId, decryptHandle, uri); Loading @@ -139,33 +139,33 @@ status_t DrmEngineBase::openDecryptSession( return onOpenDecryptSession(uniqueId, decryptHandle, uri, mime); } status_t DrmEngineBase::openDecryptSession(int uniqueId, DecryptHandle* decryptHandle, status_t DrmEngineBase::openDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle, const DrmBuffer& buf, const String8& mimeType) { return onOpenDecryptSession(uniqueId, decryptHandle, buf, mimeType); } status_t DrmEngineBase::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { status_t DrmEngineBase::closeDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle) { return onCloseDecryptSession(uniqueId, decryptHandle); } status_t DrmEngineBase::initializeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) { int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) { return onInitializeDecryptUnit(uniqueId, decryptHandle, decryptUnitId, headerInfo); } status_t DrmEngineBase::decrypt( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) { return onDecrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV); } status_t DrmEngineBase::finalizeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) { int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId) { return onFinalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId); } ssize_t DrmEngineBase::pread( int uniqueId, DecryptHandle* decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) { int uniqueId, sp<DecryptHandle>& decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) { return onPread(uniqueId, decryptHandle, buffer, numBytes, offset); }
drm/common/IDrmManagerService.cpp +53 −54 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ using namespace android; static void writeDecryptHandleToParcelData( const DecryptHandle* handle, Parcel* data) { const sp<DecryptHandle>& handle, Parcel* data) { data->writeInt32(handle->decryptId); data->writeString8(handle->mimeType); data->writeInt32(handle->decryptApiType); Loading Loading @@ -67,7 +67,7 @@ static void writeDecryptHandleToParcelData( } static void readDecryptHandleFromParcelData( DecryptHandle* handle, const Parcel& data) { sp<DecryptHandle>& handle, const Parcel& data) { if (0 == data.dataAvail()) { return; } Loading Loading @@ -99,7 +99,7 @@ static void readDecryptHandleFromParcelData( } } static void clearDecryptHandle(DecryptHandle* handle) { static void clearDecryptHandle(sp<DecryptHandle> &handle) { if (handle == NULL) { return; } Loading Loading @@ -414,7 +414,7 @@ int BpDrmManagerService::checkRightsStatus(int uniqueId, const String8& path, in } status_t BpDrmManagerService::consumeRights( int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) { int uniqueId, sp<DecryptHandle>& decryptHandle, int action, bool reserve) { ALOGV("consumeRights"); Parcel data, reply; Loading @@ -431,7 +431,7 @@ status_t BpDrmManagerService::consumeRights( } status_t BpDrmManagerService::setPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) { int uniqueId, sp<DecryptHandle>& decryptHandle, int playbackStatus, int64_t position) { ALOGV("setPlaybackStatus"); Parcel data, reply; Loading Loading @@ -603,7 +603,7 @@ status_t BpDrmManagerService::getAllSupportInfo( return reply.readInt32(); } DecryptHandle* BpDrmManagerService::openDecryptSession( sp<DecryptHandle> BpDrmManagerService::openDecryptSession( int uniqueId, int fd, off64_t offset, off64_t length, const char* mime) { ALOGV("Entering BpDrmManagerService::openDecryptSession"); Parcel data, reply; Loading @@ -621,7 +621,7 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( remote()->transact(OPEN_DECRYPT_SESSION, data, &reply); DecryptHandle* handle = NULL; sp<DecryptHandle> handle; if (0 != reply.dataAvail()) { handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, reply); Loading @@ -629,7 +629,7 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( return handle; } DecryptHandle* BpDrmManagerService::openDecryptSession( sp<DecryptHandle> BpDrmManagerService::openDecryptSession( int uniqueId, const char* uri, const char* mime) { ALOGV("Entering BpDrmManagerService::openDecryptSession: mime=%s", mime? mime: "NULL"); Loading @@ -646,7 +646,7 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( remote()->transact(OPEN_DECRYPT_SESSION_FROM_URI, data, &reply); DecryptHandle* handle = NULL; sp<DecryptHandle> handle; if (0 != reply.dataAvail()) { handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, reply); Loading @@ -656,7 +656,7 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( return handle; } DecryptHandle* BpDrmManagerService::openDecryptSession( sp<DecryptHandle> BpDrmManagerService::openDecryptSession( int uniqueId, const DrmBuffer& buf, const String8& mimeType) { ALOGV("Entering BpDrmManagerService::openDecryptSession"); Parcel data, reply; Loading @@ -673,7 +673,7 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( remote()->transact(OPEN_DECRYPT_SESSION_FOR_STREAMING, data, &reply); DecryptHandle* handle = NULL; sp<DecryptHandle> handle; if (0 != reply.dataAvail()) { handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, reply); Loading @@ -683,7 +683,7 @@ DecryptHandle* BpDrmManagerService::openDecryptSession( return handle; } status_t BpDrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) { status_t BpDrmManagerService::closeDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle) { ALOGV("closeDecryptSession"); Parcel data, reply; Loading @@ -698,7 +698,7 @@ status_t BpDrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* d } status_t BpDrmManagerService::initializeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) { ALOGV("initializeDecryptUnit"); Parcel data, reply; Loading @@ -718,7 +718,7 @@ status_t BpDrmManagerService::initializeDecryptUnit( } status_t BpDrmManagerService::decrypt( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) { ALOGV("decrypt"); Parcel data, reply; Loading Loading @@ -754,7 +754,7 @@ status_t BpDrmManagerService::decrypt( } status_t BpDrmManagerService::finalizeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) { int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId) { ALOGV("finalizeDecryptUnit"); Parcel data, reply; Loading @@ -770,7 +770,7 @@ status_t BpDrmManagerService::finalizeDecryptUnit( } ssize_t BpDrmManagerService::pread( int uniqueId, DecryptHandle* decryptHandle, void* buffer, int uniqueId, sp<DecryptHandle>& decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) { ALOGV("read"); Parcel data, reply; Loading Loading @@ -1128,16 +1128,16 @@ status_t BnDrmManagerService::onTransact( const int uniqueId = data.readInt32(); DecryptHandle handle; readDecryptHandleFromParcelData(&handle, data); sp<DecryptHandle> handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, data); const int action = data.readInt32(); const bool reserve = static_cast<bool>(data.readInt32()); const status_t status = consumeRights(uniqueId, &handle, action, reserve); = consumeRights(uniqueId, handle, action, reserve); reply->writeInt32(status); clearDecryptHandle(&handle); clearDecryptHandle(handle); return DRM_NO_ERROR; } Loading @@ -1148,16 +1148,16 @@ status_t BnDrmManagerService::onTransact( const int uniqueId = data.readInt32(); DecryptHandle handle; readDecryptHandleFromParcelData(&handle, data); sp<DecryptHandle> handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, data); const int playbackStatus = data.readInt32(); const int64_t position = data.readInt64(); const status_t status = setPlaybackStatus(uniqueId, &handle, playbackStatus, position); = setPlaybackStatus(uniqueId, handle, playbackStatus, position); reply->writeInt32(status); clearDecryptHandle(&handle); clearDecryptHandle(handle); return DRM_NO_ERROR; } Loading Loading @@ -1329,13 +1329,13 @@ status_t BnDrmManagerService::onTransact( const off64_t length = data.readInt64(); const String8 mime = data.readString8(); DecryptHandle* handle sp<DecryptHandle> handle = openDecryptSession(uniqueId, fd, offset, length, mime.string()); if (NULL != handle) { writeDecryptHandleToParcelData(handle, reply); if (NULL != handle.get()) { writeDecryptHandleToParcelData(handle.get(), reply); clearDecryptHandle(handle); delete handle; handle = NULL; handle.clear(); } return DRM_NO_ERROR; } Loading @@ -1349,13 +1349,13 @@ status_t BnDrmManagerService::onTransact( const String8 uri = data.readString8(); const String8 mime = data.readString8(); DecryptHandle* handle = openDecryptSession(uniqueId, uri.string(), mime.string()); sp<DecryptHandle> handle = openDecryptSession(uniqueId, uri.string(), mime.string()); if (NULL != handle) { writeDecryptHandleToParcelData(handle, reply); if (NULL != handle.get()) { writeDecryptHandleToParcelData(handle.get(), reply); clearDecryptHandle(handle); delete handle; handle = NULL; handle.clear(); } else { ALOGV("NULL decryptHandle is returned"); } Loading @@ -1373,13 +1373,12 @@ status_t BnDrmManagerService::onTransact( bufferSize); const String8 mimeType(data.readString8()); DecryptHandle* handle = openDecryptSession(uniqueId, buf, mimeType); sp<DecryptHandle> handle = openDecryptSession(uniqueId, buf, mimeType); if (handle != NULL) { writeDecryptHandleToParcelData(handle, reply); clearDecryptHandle(handle); delete handle; handle = NULL; handle.clear(); } else { ALOGV("NULL decryptHandle is returned"); } Loading @@ -1393,7 +1392,7 @@ status_t BnDrmManagerService::onTransact( const int uniqueId = data.readInt32(); DecryptHandle* handle = new DecryptHandle(); sp<DecryptHandle> handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, data); const status_t status = closeDecryptSession(uniqueId, handle); Loading @@ -1408,8 +1407,8 @@ status_t BnDrmManagerService::onTransact( const int uniqueId = data.readInt32(); DecryptHandle handle; readDecryptHandleFromParcelData(&handle, data); sp<DecryptHandle> handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, data); const int decryptUnitId = data.readInt32(); Loading @@ -1417,17 +1416,17 @@ status_t BnDrmManagerService::onTransact( const uint32_t bufferSize = data.readInt32(); if (bufferSize > data.dataAvail()) { reply->writeInt32(BAD_VALUE); clearDecryptHandle(&handle); clearDecryptHandle(handle); return DRM_NO_ERROR; } DrmBuffer* headerInfo = NULL; headerInfo = new DrmBuffer((char *)data.readInplace(bufferSize), bufferSize); const status_t status = initializeDecryptUnit(uniqueId, &handle, decryptUnitId, headerInfo); = initializeDecryptUnit(uniqueId, handle, decryptUnitId, headerInfo); reply->writeInt32(status); clearDecryptHandle(&handle); clearDecryptHandle(handle); delete headerInfo; headerInfo = NULL; return DRM_NO_ERROR; } Loading @@ -1439,8 +1438,8 @@ status_t BnDrmManagerService::onTransact( const int uniqueId = data.readInt32(); DecryptHandle handle; readDecryptHandleFromParcelData(&handle, data); sp<DecryptHandle> handle = new DecryptHandle; readDecryptHandleFromParcelData(handle, data); const int decryptUnitId = data.readInt32(); const uint32_t decBufferSize = data.readInt32(); Loading @@ -1450,7 +1449,7 @@ status_t BnDrmManagerService::onTransact( decBufferSize > MAX_BINDER_TRANSACTION_SIZE) { reply->writeInt32(BAD_VALUE); reply->writeInt32(0); clearDecryptHandle(&handle); clearDecryptHandle(handle); return DRM_NO_ERROR; } Loading @@ -1470,7 +1469,7 @@ status_t BnDrmManagerService::onTransact( } const status_t status = decrypt(uniqueId, &handle, decryptUnitId, encBuffer, &decBuffer, IV); = decrypt(uniqueId, handle, decryptUnitId, encBuffer, &decBuffer, IV); reply->writeInt32(status); Loading @@ -1480,7 +1479,7 @@ status_t BnDrmManagerService::onTransact( reply->write(decBuffer->data, size); } clearDecryptHandle(&handle); clearDecryptHandle(handle); delete encBuffer; encBuffer = NULL; delete decBuffer; decBuffer = NULL; delete [] buffer; buffer = NULL; Loading @@ -1495,13 +1494,13 @@ status_t BnDrmManagerService::onTransact( const int uniqueId = data.readInt32(); DecryptHandle handle; readDecryptHandleFromParcelData(&handle, data); sp<DecryptHandle> handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, data); const status_t status = finalizeDecryptUnit(uniqueId, &handle, data.readInt32()); const status_t status = finalizeDecryptUnit(uniqueId, handle, data.readInt32()); reply->writeInt32(status); clearDecryptHandle(&handle); clearDecryptHandle(handle); return DRM_NO_ERROR; } Loading @@ -1512,8 +1511,8 @@ status_t BnDrmManagerService::onTransact( const int uniqueId = data.readInt32(); DecryptHandle handle; readDecryptHandleFromParcelData(&handle, data); sp<DecryptHandle> handle = new DecryptHandle(); readDecryptHandleFromParcelData(handle, data); const uint32_t numBytes = data.readInt32(); if (numBytes > MAX_BINDER_TRANSACTION_SIZE) { Loading @@ -1524,13 +1523,13 @@ status_t BnDrmManagerService::onTransact( const off64_t offset = data.readInt64(); ssize_t result = pread(uniqueId, &handle, buffer, numBytes, offset); ssize_t result = pread(uniqueId, handle, buffer, numBytes, offset); reply->writeInt32(result); if (0 < result) { reply->write(buffer, result); } clearDecryptHandle(&handle); clearDecryptHandle(handle); delete [] buffer, buffer = NULL; return DRM_NO_ERROR; } Loading
drm/common/include/DrmEngineBase.h +25 −22 Original line number Diff line number Diff line Loading @@ -59,10 +59,11 @@ public: int checkRightsStatus(int uniqueId, const String8& path, int action); status_t consumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve); status_t consumeRights(int uniqueId, sp<DecryptHandle>& decryptHandle, int action, bool reserve); status_t setPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position); int uniqueId, sp<DecryptHandle>& decryptHandle, int playbackStatus, int64_t position); bool validateAction( int uniqueId, const String8& path, int action, const ActionDescription& description); Loading @@ -80,27 +81,28 @@ public: DrmSupportInfo* getSupportInfo(int uniqueId); status_t openDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, int fd, off64_t offset, off64_t length, const char* mime); status_t openDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, const char* uri, const char* mime); status_t openDecryptSession(int uniqueId, DecryptHandle* decryptHandle, status_t openDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle, const DrmBuffer& buf, const String8& mimeType); status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle); status_t closeDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle); status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, status_t initializeDecryptUnit(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, status_t decrypt(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV); status_t finalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId); status_t finalizeDecryptUnit(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId); ssize_t pread(int uniqueId, DecryptHandle* decryptHandle, ssize_t pread(int uniqueId, sp<DecryptHandle>& decryptHandle, void* buffer, ssize_t numBytes, off64_t offset); protected: Loading Loading @@ -265,7 +267,7 @@ protected: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t onConsumeRights(int uniqueId, DecryptHandle* decryptHandle, virtual status_t onConsumeRights(int uniqueId, sp<DecryptHandle>& decryptHandle, int action, bool reserve) = 0; /** Loading @@ -280,7 +282,8 @@ protected: * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t onSetPlaybackStatus( int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) = 0; int uniqueId, sp<DecryptHandle>& decryptHandle, int playbackStatus, int64_t position) = 0; /** * Validates whether an action on the DRM content is allowed or not. Loading Loading @@ -381,7 +384,7 @@ protected: * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t onOpenDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, int fd, off64_t offset, off64_t length) = 0; /** Loading @@ -398,7 +401,7 @@ protected: * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t onOpenDecryptSession( int /* uniqueId */, DecryptHandle* /* decryptHandle */, int /* uniqueId */, sp<DecryptHandle>& /* decryptHandle */, int /* fd */, off64_t /* offset */, off64_t /* length */, const char* /* mime */) { Loading @@ -415,7 +418,7 @@ protected: * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t onOpenDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, const char* uri) = 0; /** Loading @@ -430,7 +433,7 @@ protected: * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t onOpenDecryptSession( int /* uniqueId */, DecryptHandle* /* decryptHandle */, int /* uniqueId */, sp<DecryptHandle>& /* decryptHandle */, const char* /* uri */, const char* /* mime */) { return DRM_ERROR_CANNOT_HANDLE; Loading @@ -447,7 +450,7 @@ protected: * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t onOpenDecryptSession(int /* uniqueId */, DecryptHandle* /* decryptHandle */, sp<DecryptHandle>& /* decryptHandle */, const DrmBuffer& /* buf */, const String8& /* mimeType */) { return DRM_ERROR_CANNOT_HANDLE; Loading @@ -461,7 +464,7 @@ protected: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t onCloseDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0; virtual status_t onCloseDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle) = 0; /** * Initialize decryption for the given unit of the protected content Loading @@ -473,7 +476,7 @@ protected: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, virtual status_t onInitializeDecryptUnit(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) = 0; /** Loading @@ -493,7 +496,7 @@ protected: * DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED, * DRM_ERROR_DECRYPT for failure. */ virtual status_t onDecrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, virtual status_t onDecrypt(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) = 0; /** Loading @@ -506,7 +509,7 @@ protected: * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t onFinalizeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) = 0; int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId) = 0; /** * Reads the specified number of bytes from an open DRM file. Loading @@ -519,7 +522,7 @@ protected: * * @return Number of bytes read. Returns -1 for Failure. */ virtual ssize_t onPread(int uniqueId, DecryptHandle* decryptHandle, virtual ssize_t onPread(int uniqueId, sp<DecryptHandle>& decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) = 0; }; Loading
drm/common/include/IDrmEngine.h +10 −10 Original line number Diff line number Diff line Loading @@ -210,7 +210,7 @@ public: * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t consumeRights( int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) = 0; int uniqueId, sp<DecryptHandle>& decryptHandle, int action, bool reserve) = 0; /** * Informs the DRM Engine about the playback actions performed on the DRM files. Loading @@ -223,7 +223,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t setPlaybackStatus(int uniqueId, DecryptHandle* decryptHandle, virtual status_t setPlaybackStatus(int uniqueId, sp<DecryptHandle>& decryptHandle, int playbackStatus, int64_t position) = 0; /** Loading Loading @@ -327,7 +327,7 @@ public: * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t openDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, int fd, off64_t offset, off64_t length, const char* mime) = 0; /** Loading @@ -342,7 +342,7 @@ public: * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t openDecryptSession( int uniqueId, DecryptHandle* decryptHandle, int uniqueId, sp<DecryptHandle>& decryptHandle, const char* uri, const char* mime) = 0; /** Loading @@ -355,7 +355,7 @@ public: * @return * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success */ virtual status_t openDecryptSession(int uniqueId, DecryptHandle* decryptHandle, virtual status_t openDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle, const DrmBuffer& buf, const String8& mimeType) = 0; /** Loading @@ -366,7 +366,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0; virtual status_t closeDecryptSession(int uniqueId, sp<DecryptHandle>& decryptHandle) = 0; /** * Initialize decryption for the given unit of the protected content Loading @@ -378,7 +378,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, virtual status_t initializeDecryptUnit(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) = 0; /** Loading @@ -398,7 +398,7 @@ public: * DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED, * DRM_ERROR_DECRYPT for failure. */ virtual status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, virtual status_t decrypt(int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) = 0; /** Loading @@ -411,7 +411,7 @@ public: * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ virtual status_t finalizeDecryptUnit( int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) = 0; int uniqueId, sp<DecryptHandle>& decryptHandle, int decryptUnitId) = 0; /** * Reads the specified number of bytes from an open DRM file. Loading @@ -424,7 +424,7 @@ public: * * @return Number of bytes read. Returns -1 for Failure. */ virtual ssize_t pread(int uniqueId, DecryptHandle* decryptHandle, virtual ssize_t pread(int uniqueId, sp<DecryptHandle>& decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) = 0; }; Loading
drm/common/include/IDrmManagerService.h +21 −20 File changed.Preview size limit exceeded, changes collapsed. Show changes