Loading drm/libdrmframework/Android.mk +3 −1 Original line number Diff line number Diff line Loading @@ -19,12 +19,14 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ DrmManagerClientImpl.cpp \ DrmManagerClient.cpp DrmManagerClient.cpp \ NoOpDrmManagerClientImpl.cpp LOCAL_MODULE:= libdrmframework LOCAL_SHARED_LIBRARIES := \ libutils \ libcutils \ liblog \ libbinder \ libdl Loading drm/libdrmframework/DrmManagerClient.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ DrmManagerClient::DrmManagerClient(): } DrmManagerClient::~DrmManagerClient() { DrmManagerClientImpl::remove(mUniqueId); mDrmManagerClientImpl->remove(mUniqueId); mDrmManagerClientImpl->removeClient(mUniqueId); mDrmManagerClientImpl->setOnInfoListener(mUniqueId, NULL); } Loading drm/libdrmframework/DrmManagerClientImpl.cpp +14 −3 Original line number Diff line number Diff line Loading @@ -21,8 +21,10 @@ #include <utils/String8.h> #include <utils/Vector.h> #include <binder/IServiceManager.h> #include <cutils/properties.h> #include "DrmManagerClientImpl.h" #include "NoOpDrmManagerClientImpl.h" using namespace android; Loading @@ -35,10 +37,13 @@ const String8 DrmManagerClientImpl::EMPTY_STRING(""); DrmManagerClientImpl* DrmManagerClientImpl::create( int* pUniqueId, bool isNative) { sp<IDrmManagerService> service = getDrmManagerService(); if (service != NULL) { *pUniqueId = getDrmManagerService()->addUniqueId(isNative); return new DrmManagerClientImpl(); } return new NoOpDrmManagerClientImpl(); } void DrmManagerClientImpl::remove(int uniqueId) { getDrmManagerService()->removeUniqueId(uniqueId); Loading @@ -47,6 +52,12 @@ void DrmManagerClientImpl::remove(int uniqueId) { const sp<IDrmManagerService>& DrmManagerClientImpl::getDrmManagerService() { Mutex::Autolock lock(sMutex); if (NULL == sDrmManagerService.get()) { char value[PROPERTY_VALUE_MAX]; if (property_get("drm.service.enabled", value, NULL) == 0) { // Drm is undefined for this device return sDrmManagerService; } sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder; do { Loading drm/libdrmframework/NoOpDrmManagerClientImpl.cpp 0 → 100644 +152 −0 Original line number Diff line number Diff line /* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "NoOpDrmManagerClientImpl.h" namespace android { void NoOpDrmManagerClientImpl::remove(int uniqueId) { } void NoOpDrmManagerClientImpl::addClient(int uniqueId) { } void NoOpDrmManagerClientImpl::removeClient(int uniqueId) { } status_t NoOpDrmManagerClientImpl::setOnInfoListener( int uniqueId, const sp<DrmManagerClient::OnInfoListener>& infoListener) { return UNKNOWN_ERROR; } DrmConstraints* NoOpDrmManagerClientImpl::getConstraints(int uniqueId, const String8* path, const int action) { return NULL; } DrmMetadata* NoOpDrmManagerClientImpl::getMetadata(int uniqueId, const String8* path) { return NULL; } bool NoOpDrmManagerClientImpl::canHandle(int uniqueId, const String8& path, const String8& mimeType) { return false; } DrmInfoStatus* NoOpDrmManagerClientImpl::processDrmInfo(int uniqueId, const DrmInfo* drmInfo) { return NULL; } DrmInfo* NoOpDrmManagerClientImpl::acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest) { return NULL; } status_t NoOpDrmManagerClientImpl::saveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath) { return UNKNOWN_ERROR; } String8 NoOpDrmManagerClientImpl::getOriginalMimeType(int uniqueId, const String8& path, int fd) { return String8(); } int NoOpDrmManagerClientImpl::getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType) { return -1; } int NoOpDrmManagerClientImpl::checkRightsStatus(int uniqueId, const String8& path, int action) { return -1; } status_t NoOpDrmManagerClientImpl::consumeRights(int uniqueId, sp<DecryptHandle> &decryptHandle, int action, bool reserve) { return UNKNOWN_ERROR; } status_t NoOpDrmManagerClientImpl::setPlaybackStatus( int uniqueId, sp<DecryptHandle> &decryptHandle, int playbackStatus, int64_t position) { return UNKNOWN_ERROR; } bool NoOpDrmManagerClientImpl::validateAction( int uniqueId, const String8& path, int action, const ActionDescription& description) { return false; } status_t NoOpDrmManagerClientImpl::removeRights(int uniqueId, const String8& path) { return UNKNOWN_ERROR; } status_t NoOpDrmManagerClientImpl::removeAllRights(int uniqueId) { return UNKNOWN_ERROR; } int NoOpDrmManagerClientImpl::openConvertSession(int uniqueId, const String8& mimeType) { return -1; } DrmConvertedStatus* NoOpDrmManagerClientImpl::convertData(int uniqueId, int convertId, const DrmBuffer* inputData) { return NULL; } DrmConvertedStatus* NoOpDrmManagerClientImpl::closeConvertSession(int uniqueId, int convertId) { return NULL; } status_t NoOpDrmManagerClientImpl::getAllSupportInfo(int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray) { return UNKNOWN_ERROR; } sp<DecryptHandle> NoOpDrmManagerClientImpl::openDecryptSession( int uniqueId, int fd, off64_t offset, off64_t length, const char* mime) { return NULL; } sp<DecryptHandle> NoOpDrmManagerClientImpl::openDecryptSession( int uniqueId, const char* uri, const char* mime) { return NULL; } sp<DecryptHandle> NoOpDrmManagerClientImpl::openDecryptSession(int uniqueId, const DrmBuffer& buf, const String8& mimeType) { return NULL; } status_t NoOpDrmManagerClientImpl::closeDecryptSession(int uniqueId, sp<DecryptHandle> &decryptHandle) { return UNKNOWN_ERROR; } status_t NoOpDrmManagerClientImpl::initializeDecryptUnit(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) { return UNKNOWN_ERROR; } status_t NoOpDrmManagerClientImpl::decrypt(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) { return UNKNOWN_ERROR; } status_t NoOpDrmManagerClientImpl::finalizeDecryptUnit(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId) { return UNKNOWN_ERROR; } ssize_t NoOpDrmManagerClientImpl::pread(int uniqueId, sp<DecryptHandle> &decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) { return -1; } status_t NoOpDrmManagerClientImpl::notify(const DrmInfoEvent& event) { return UNKNOWN_ERROR; } } drm/libdrmframework/include/DrmManagerClientImpl.h +33 −33 Original line number Diff line number Diff line Loading @@ -34,30 +34,30 @@ class DrmInfoEvent; * */ class DrmManagerClientImpl : public BnDrmServiceListener { private: protected: DrmManagerClientImpl() { } public: static DrmManagerClientImpl* create(int* pUniqueId, bool isNative); static void remove(int uniqueId); virtual ~DrmManagerClientImpl() { } public: virtual void remove(int uniqueId); /** * Adds the client respective to given unique id. * * @param[in] uniqueId Unique identifier for a session */ void addClient(int uniqueId); virtual void addClient(int uniqueId); /** * Removes the client respective to given unique id. * * @param[in] uniqueId Unique identifier for a session */ void removeClient(int uniqueId); virtual void removeClient(int uniqueId); /** * Register a callback to be invoked when the caller required to Loading @@ -68,7 +68,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t setOnInfoListener( virtual status_t setOnInfoListener( int uniqueId, const sp<DrmManagerClient::OnInfoListener>& infoListener); /** Loading @@ -83,7 +83,7 @@ public: * @note * In case of error, return NULL */ DrmConstraints* getConstraints(int uniqueId, const String8* path, const int action); virtual DrmConstraints* getConstraints(int uniqueId, const String8* path, const int action); /** * Get metadata information associated with input content. Loading @@ -95,7 +95,7 @@ public: * @note * In case of error, return NULL */ DrmMetadata* getMetadata(int uniqueId, const String8* path); virtual DrmMetadata* getMetadata(int uniqueId, const String8* path); /** * Check whether the given mimetype or path can be handled Loading @@ -106,7 +106,7 @@ public: * @return * True if DrmManager can handle given path or mime type. */ bool canHandle(int uniqueId, const String8& path, const String8& mimeType); virtual bool canHandle(int uniqueId, const String8& path, const String8& mimeType); /** * Executes given drm information based on its type Loading @@ -116,7 +116,7 @@ public: * @return DrmInfoStatus * instance as a result of processing given input */ DrmInfoStatus* processDrmInfo(int uniqueId, const DrmInfo* drmInfo); virtual DrmInfoStatus* processDrmInfo(int uniqueId, const DrmInfo* drmInfo); /** * Retrieves necessary information for registration, unregistration or rights Loading @@ -127,7 +127,7 @@ public: * @return DrmInfo * instance as a result of processing given input */ DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest); virtual DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest); /** * Save DRM rights to specified rights path Loading @@ -140,7 +140,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t saveRights(int uniqueId, const DrmRights& drmRights, virtual status_t saveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath); /** Loading @@ -152,7 +152,7 @@ public: * @return String8 * Returns mime-type of the original content, such as "video/mpeg" */ String8 getOriginalMimeType(int uniqueId, const String8& path, int fd); virtual String8 getOriginalMimeType(int uniqueId, const String8& path, int fd); /** * Retrieves the type of the protected object (content, rights, etc..) Loading @@ -165,7 +165,7 @@ public: * @return type of the DRM content, * such as DrmObjectType::CONTENT, DrmObjectType::RIGHTS_OBJECT */ int getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType); virtual int getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType); /** * Check whether the given content has valid rights or not Loading @@ -176,7 +176,7 @@ public: * @return the status of the rights for the protected content, * such as RightsStatus::RIGHTS_VALID, RightsStatus::RIGHTS_EXPIRED, etc. */ int checkRightsStatus(int uniqueId, const String8& path, int action); virtual int checkRightsStatus(int uniqueId, const String8& path, int action); /** * Consumes the rights for a content. Loading @@ -190,7 +190,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t consumeRights(int uniqueId, sp<DecryptHandle> &decryptHandle, int action, bool reserve); virtual status_t consumeRights(int uniqueId, sp<DecryptHandle> &decryptHandle, int action, bool reserve); /** * Informs the DRM engine about the playback actions performed on the DRM files. Loading @@ -203,7 +203,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t setPlaybackStatus( virtual status_t setPlaybackStatus( int uniqueId, sp<DecryptHandle> &decryptHandle, int playbackStatus, int64_t position); /** Loading @@ -215,7 +215,7 @@ public: * @param[in] description Detailed description of the action * @return true if the action is allowed. */ bool validateAction( virtual bool validateAction( int uniqueId, const String8& path, int action, const ActionDescription& description); /** Loading @@ -226,7 +226,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t removeRights(int uniqueId, const String8& path); virtual status_t removeRights(int uniqueId, const String8& path); /** * Removes all the rights information of each plug-in associated with Loading @@ -236,7 +236,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t removeAllRights(int uniqueId); virtual status_t removeAllRights(int uniqueId); /** * This API is for Forward Lock based DRM scheme. Loading @@ -248,7 +248,7 @@ public: * @param[in] mimeType Description/MIME type of the input data packet * @return Return handle for the convert session */ int openConvertSession(int uniqueId, const String8& mimeType); virtual int openConvertSession(int uniqueId, const String8& mimeType); /** * Accepts and converts the input data which is part of DRM file. Loading @@ -263,7 +263,7 @@ public: * the output converted data and offset. In this case the * application will ignore the offset information. */ DrmConvertedStatus* convertData(int uniqueId, int convertId, const DrmBuffer* inputData); virtual DrmConvertedStatus* convertData(int uniqueId, int convertId, const DrmBuffer* inputData); /** * Informs the Drm Agent when there is no more data which need to be converted Loading @@ -279,7 +279,7 @@ public: * the application on which offset these signature data * should be appended. */ DrmConvertedStatus* closeConvertSession(int uniqueId, int convertId); virtual DrmConvertedStatus* closeConvertSession(int uniqueId, int convertId); /** * Retrieves all DrmSupportInfo instance that native DRM framework can handle. Loading @@ -292,7 +292,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t getAllSupportInfo(int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray); virtual status_t getAllSupportInfo(int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray); /** * Open the decrypt session to decrypt the given protected content Loading @@ -305,7 +305,7 @@ public: * @return * Handle for the decryption session */ sp<DecryptHandle> openDecryptSession( virtual sp<DecryptHandle> openDecryptSession( int uniqueId, int fd, off64_t offset, off64_t length, const char* mime); /** Loading @@ -317,7 +317,7 @@ public: * @return * Handle for the decryption session */ sp<DecryptHandle> openDecryptSession( virtual sp<DecryptHandle> openDecryptSession( int uniqueId, const char* uri, const char* mime); /** Loading @@ -329,7 +329,7 @@ public: * @return * Handle for the decryption session */ sp<DecryptHandle> openDecryptSession(int uniqueId, const DrmBuffer& buf, virtual sp<DecryptHandle> openDecryptSession(int uniqueId, const DrmBuffer& buf, const String8& mimeType); /** Loading @@ -340,7 +340,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t closeDecryptSession(int uniqueId, sp<DecryptHandle> &decryptHandle); virtual status_t closeDecryptSession(int uniqueId, sp<DecryptHandle> &decryptHandle); /** * Initialize decryption for the given unit of the protected content Loading @@ -352,7 +352,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t initializeDecryptUnit(int uniqueId, sp<DecryptHandle> &decryptHandle, virtual status_t initializeDecryptUnit(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); /** Loading @@ -372,7 +372,7 @@ public: * DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED, * DRM_ERROR_DECRYPT for failure. */ status_t decrypt(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId, virtual status_t decrypt(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV); /** Loading @@ -384,7 +384,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t finalizeDecryptUnit(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId); virtual status_t finalizeDecryptUnit(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId); /** * Reads the specified number of bytes from an open DRM file. Loading @@ -397,7 +397,7 @@ public: * * @return Number of bytes read. Returns -1 for Failure. */ ssize_t pread(int uniqueId, sp<DecryptHandle> &decryptHandle, virtual ssize_t pread(int uniqueId, sp<DecryptHandle> &decryptHandle, void* buffer, ssize_t numBytes, off64_t offset); /** Loading @@ -407,7 +407,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t notify(const DrmInfoEvent& event); virtual status_t notify(const DrmInfoEvent& event); private: Mutex mLock; Loading Loading
drm/libdrmframework/Android.mk +3 −1 Original line number Diff line number Diff line Loading @@ -19,12 +19,14 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ DrmManagerClientImpl.cpp \ DrmManagerClient.cpp DrmManagerClient.cpp \ NoOpDrmManagerClientImpl.cpp LOCAL_MODULE:= libdrmframework LOCAL_SHARED_LIBRARIES := \ libutils \ libcutils \ liblog \ libbinder \ libdl Loading
drm/libdrmframework/DrmManagerClient.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ DrmManagerClient::DrmManagerClient(): } DrmManagerClient::~DrmManagerClient() { DrmManagerClientImpl::remove(mUniqueId); mDrmManagerClientImpl->remove(mUniqueId); mDrmManagerClientImpl->removeClient(mUniqueId); mDrmManagerClientImpl->setOnInfoListener(mUniqueId, NULL); } Loading
drm/libdrmframework/DrmManagerClientImpl.cpp +14 −3 Original line number Diff line number Diff line Loading @@ -21,8 +21,10 @@ #include <utils/String8.h> #include <utils/Vector.h> #include <binder/IServiceManager.h> #include <cutils/properties.h> #include "DrmManagerClientImpl.h" #include "NoOpDrmManagerClientImpl.h" using namespace android; Loading @@ -35,10 +37,13 @@ const String8 DrmManagerClientImpl::EMPTY_STRING(""); DrmManagerClientImpl* DrmManagerClientImpl::create( int* pUniqueId, bool isNative) { sp<IDrmManagerService> service = getDrmManagerService(); if (service != NULL) { *pUniqueId = getDrmManagerService()->addUniqueId(isNative); return new DrmManagerClientImpl(); } return new NoOpDrmManagerClientImpl(); } void DrmManagerClientImpl::remove(int uniqueId) { getDrmManagerService()->removeUniqueId(uniqueId); Loading @@ -47,6 +52,12 @@ void DrmManagerClientImpl::remove(int uniqueId) { const sp<IDrmManagerService>& DrmManagerClientImpl::getDrmManagerService() { Mutex::Autolock lock(sMutex); if (NULL == sDrmManagerService.get()) { char value[PROPERTY_VALUE_MAX]; if (property_get("drm.service.enabled", value, NULL) == 0) { // Drm is undefined for this device return sDrmManagerService; } sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder; do { Loading
drm/libdrmframework/NoOpDrmManagerClientImpl.cpp 0 → 100644 +152 −0 Original line number Diff line number Diff line /* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "NoOpDrmManagerClientImpl.h" namespace android { void NoOpDrmManagerClientImpl::remove(int uniqueId) { } void NoOpDrmManagerClientImpl::addClient(int uniqueId) { } void NoOpDrmManagerClientImpl::removeClient(int uniqueId) { } status_t NoOpDrmManagerClientImpl::setOnInfoListener( int uniqueId, const sp<DrmManagerClient::OnInfoListener>& infoListener) { return UNKNOWN_ERROR; } DrmConstraints* NoOpDrmManagerClientImpl::getConstraints(int uniqueId, const String8* path, const int action) { return NULL; } DrmMetadata* NoOpDrmManagerClientImpl::getMetadata(int uniqueId, const String8* path) { return NULL; } bool NoOpDrmManagerClientImpl::canHandle(int uniqueId, const String8& path, const String8& mimeType) { return false; } DrmInfoStatus* NoOpDrmManagerClientImpl::processDrmInfo(int uniqueId, const DrmInfo* drmInfo) { return NULL; } DrmInfo* NoOpDrmManagerClientImpl::acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest) { return NULL; } status_t NoOpDrmManagerClientImpl::saveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath) { return UNKNOWN_ERROR; } String8 NoOpDrmManagerClientImpl::getOriginalMimeType(int uniqueId, const String8& path, int fd) { return String8(); } int NoOpDrmManagerClientImpl::getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType) { return -1; } int NoOpDrmManagerClientImpl::checkRightsStatus(int uniqueId, const String8& path, int action) { return -1; } status_t NoOpDrmManagerClientImpl::consumeRights(int uniqueId, sp<DecryptHandle> &decryptHandle, int action, bool reserve) { return UNKNOWN_ERROR; } status_t NoOpDrmManagerClientImpl::setPlaybackStatus( int uniqueId, sp<DecryptHandle> &decryptHandle, int playbackStatus, int64_t position) { return UNKNOWN_ERROR; } bool NoOpDrmManagerClientImpl::validateAction( int uniqueId, const String8& path, int action, const ActionDescription& description) { return false; } status_t NoOpDrmManagerClientImpl::removeRights(int uniqueId, const String8& path) { return UNKNOWN_ERROR; } status_t NoOpDrmManagerClientImpl::removeAllRights(int uniqueId) { return UNKNOWN_ERROR; } int NoOpDrmManagerClientImpl::openConvertSession(int uniqueId, const String8& mimeType) { return -1; } DrmConvertedStatus* NoOpDrmManagerClientImpl::convertData(int uniqueId, int convertId, const DrmBuffer* inputData) { return NULL; } DrmConvertedStatus* NoOpDrmManagerClientImpl::closeConvertSession(int uniqueId, int convertId) { return NULL; } status_t NoOpDrmManagerClientImpl::getAllSupportInfo(int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray) { return UNKNOWN_ERROR; } sp<DecryptHandle> NoOpDrmManagerClientImpl::openDecryptSession( int uniqueId, int fd, off64_t offset, off64_t length, const char* mime) { return NULL; } sp<DecryptHandle> NoOpDrmManagerClientImpl::openDecryptSession( int uniqueId, const char* uri, const char* mime) { return NULL; } sp<DecryptHandle> NoOpDrmManagerClientImpl::openDecryptSession(int uniqueId, const DrmBuffer& buf, const String8& mimeType) { return NULL; } status_t NoOpDrmManagerClientImpl::closeDecryptSession(int uniqueId, sp<DecryptHandle> &decryptHandle) { return UNKNOWN_ERROR; } status_t NoOpDrmManagerClientImpl::initializeDecryptUnit(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) { return UNKNOWN_ERROR; } status_t NoOpDrmManagerClientImpl::decrypt(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) { return UNKNOWN_ERROR; } status_t NoOpDrmManagerClientImpl::finalizeDecryptUnit(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId) { return UNKNOWN_ERROR; } ssize_t NoOpDrmManagerClientImpl::pread(int uniqueId, sp<DecryptHandle> &decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) { return -1; } status_t NoOpDrmManagerClientImpl::notify(const DrmInfoEvent& event) { return UNKNOWN_ERROR; } }
drm/libdrmframework/include/DrmManagerClientImpl.h +33 −33 Original line number Diff line number Diff line Loading @@ -34,30 +34,30 @@ class DrmInfoEvent; * */ class DrmManagerClientImpl : public BnDrmServiceListener { private: protected: DrmManagerClientImpl() { } public: static DrmManagerClientImpl* create(int* pUniqueId, bool isNative); static void remove(int uniqueId); virtual ~DrmManagerClientImpl() { } public: virtual void remove(int uniqueId); /** * Adds the client respective to given unique id. * * @param[in] uniqueId Unique identifier for a session */ void addClient(int uniqueId); virtual void addClient(int uniqueId); /** * Removes the client respective to given unique id. * * @param[in] uniqueId Unique identifier for a session */ void removeClient(int uniqueId); virtual void removeClient(int uniqueId); /** * Register a callback to be invoked when the caller required to Loading @@ -68,7 +68,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t setOnInfoListener( virtual status_t setOnInfoListener( int uniqueId, const sp<DrmManagerClient::OnInfoListener>& infoListener); /** Loading @@ -83,7 +83,7 @@ public: * @note * In case of error, return NULL */ DrmConstraints* getConstraints(int uniqueId, const String8* path, const int action); virtual DrmConstraints* getConstraints(int uniqueId, const String8* path, const int action); /** * Get metadata information associated with input content. Loading @@ -95,7 +95,7 @@ public: * @note * In case of error, return NULL */ DrmMetadata* getMetadata(int uniqueId, const String8* path); virtual DrmMetadata* getMetadata(int uniqueId, const String8* path); /** * Check whether the given mimetype or path can be handled Loading @@ -106,7 +106,7 @@ public: * @return * True if DrmManager can handle given path or mime type. */ bool canHandle(int uniqueId, const String8& path, const String8& mimeType); virtual bool canHandle(int uniqueId, const String8& path, const String8& mimeType); /** * Executes given drm information based on its type Loading @@ -116,7 +116,7 @@ public: * @return DrmInfoStatus * instance as a result of processing given input */ DrmInfoStatus* processDrmInfo(int uniqueId, const DrmInfo* drmInfo); virtual DrmInfoStatus* processDrmInfo(int uniqueId, const DrmInfo* drmInfo); /** * Retrieves necessary information for registration, unregistration or rights Loading @@ -127,7 +127,7 @@ public: * @return DrmInfo * instance as a result of processing given input */ DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest); virtual DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest); /** * Save DRM rights to specified rights path Loading @@ -140,7 +140,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t saveRights(int uniqueId, const DrmRights& drmRights, virtual status_t saveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath); /** Loading @@ -152,7 +152,7 @@ public: * @return String8 * Returns mime-type of the original content, such as "video/mpeg" */ String8 getOriginalMimeType(int uniqueId, const String8& path, int fd); virtual String8 getOriginalMimeType(int uniqueId, const String8& path, int fd); /** * Retrieves the type of the protected object (content, rights, etc..) Loading @@ -165,7 +165,7 @@ public: * @return type of the DRM content, * such as DrmObjectType::CONTENT, DrmObjectType::RIGHTS_OBJECT */ int getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType); virtual int getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType); /** * Check whether the given content has valid rights or not Loading @@ -176,7 +176,7 @@ public: * @return the status of the rights for the protected content, * such as RightsStatus::RIGHTS_VALID, RightsStatus::RIGHTS_EXPIRED, etc. */ int checkRightsStatus(int uniqueId, const String8& path, int action); virtual int checkRightsStatus(int uniqueId, const String8& path, int action); /** * Consumes the rights for a content. Loading @@ -190,7 +190,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t consumeRights(int uniqueId, sp<DecryptHandle> &decryptHandle, int action, bool reserve); virtual status_t consumeRights(int uniqueId, sp<DecryptHandle> &decryptHandle, int action, bool reserve); /** * Informs the DRM engine about the playback actions performed on the DRM files. Loading @@ -203,7 +203,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t setPlaybackStatus( virtual status_t setPlaybackStatus( int uniqueId, sp<DecryptHandle> &decryptHandle, int playbackStatus, int64_t position); /** Loading @@ -215,7 +215,7 @@ public: * @param[in] description Detailed description of the action * @return true if the action is allowed. */ bool validateAction( virtual bool validateAction( int uniqueId, const String8& path, int action, const ActionDescription& description); /** Loading @@ -226,7 +226,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t removeRights(int uniqueId, const String8& path); virtual status_t removeRights(int uniqueId, const String8& path); /** * Removes all the rights information of each plug-in associated with Loading @@ -236,7 +236,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t removeAllRights(int uniqueId); virtual status_t removeAllRights(int uniqueId); /** * This API is for Forward Lock based DRM scheme. Loading @@ -248,7 +248,7 @@ public: * @param[in] mimeType Description/MIME type of the input data packet * @return Return handle for the convert session */ int openConvertSession(int uniqueId, const String8& mimeType); virtual int openConvertSession(int uniqueId, const String8& mimeType); /** * Accepts and converts the input data which is part of DRM file. Loading @@ -263,7 +263,7 @@ public: * the output converted data and offset. In this case the * application will ignore the offset information. */ DrmConvertedStatus* convertData(int uniqueId, int convertId, const DrmBuffer* inputData); virtual DrmConvertedStatus* convertData(int uniqueId, int convertId, const DrmBuffer* inputData); /** * Informs the Drm Agent when there is no more data which need to be converted Loading @@ -279,7 +279,7 @@ public: * the application on which offset these signature data * should be appended. */ DrmConvertedStatus* closeConvertSession(int uniqueId, int convertId); virtual DrmConvertedStatus* closeConvertSession(int uniqueId, int convertId); /** * Retrieves all DrmSupportInfo instance that native DRM framework can handle. Loading @@ -292,7 +292,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t getAllSupportInfo(int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray); virtual status_t getAllSupportInfo(int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray); /** * Open the decrypt session to decrypt the given protected content Loading @@ -305,7 +305,7 @@ public: * @return * Handle for the decryption session */ sp<DecryptHandle> openDecryptSession( virtual sp<DecryptHandle> openDecryptSession( int uniqueId, int fd, off64_t offset, off64_t length, const char* mime); /** Loading @@ -317,7 +317,7 @@ public: * @return * Handle for the decryption session */ sp<DecryptHandle> openDecryptSession( virtual sp<DecryptHandle> openDecryptSession( int uniqueId, const char* uri, const char* mime); /** Loading @@ -329,7 +329,7 @@ public: * @return * Handle for the decryption session */ sp<DecryptHandle> openDecryptSession(int uniqueId, const DrmBuffer& buf, virtual sp<DecryptHandle> openDecryptSession(int uniqueId, const DrmBuffer& buf, const String8& mimeType); /** Loading @@ -340,7 +340,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t closeDecryptSession(int uniqueId, sp<DecryptHandle> &decryptHandle); virtual status_t closeDecryptSession(int uniqueId, sp<DecryptHandle> &decryptHandle); /** * Initialize decryption for the given unit of the protected content Loading @@ -352,7 +352,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t initializeDecryptUnit(int uniqueId, sp<DecryptHandle> &decryptHandle, virtual status_t initializeDecryptUnit(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo); /** Loading @@ -372,7 +372,7 @@ public: * DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED, * DRM_ERROR_DECRYPT for failure. */ status_t decrypt(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId, virtual status_t decrypt(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV); /** Loading @@ -384,7 +384,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t finalizeDecryptUnit(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId); virtual status_t finalizeDecryptUnit(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId); /** * Reads the specified number of bytes from an open DRM file. Loading @@ -397,7 +397,7 @@ public: * * @return Number of bytes read. Returns -1 for Failure. */ ssize_t pread(int uniqueId, sp<DecryptHandle> &decryptHandle, virtual ssize_t pread(int uniqueId, sp<DecryptHandle> &decryptHandle, void* buffer, ssize_t numBytes, off64_t offset); /** Loading @@ -407,7 +407,7 @@ public: * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure */ status_t notify(const DrmInfoEvent& event); virtual status_t notify(const DrmInfoEvent& event); private: Mutex mLock; Loading