Loading drm/drmserver/DrmManager.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ using namespace android; Vector<int> DrmManager::mUniqueIdVector; const String8 DrmManager::EMPTY_STRING(""); DrmManager::DrmManager() : Loading drm/java/android/drm/DrmInfoRequest.java +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import java.util.Iterator; * */ public class DrmInfoRequest { // Changes in following constants should be in sync with DrmInfoRequest.cpp // Changes in following constants should be in sync with DrmInfoRequest.h /** * Constants defines the type of {@link DrmInfoRequest} */ Loading drm/libdrmframework/DrmManagerClientImpl.cpp +25 −12 Original line number Diff line number Diff line Loading @@ -28,8 +28,9 @@ using namespace android; #define INVALID_VALUE -1 Mutex DrmManagerClientImpl::mMutex; sp<IDrmManagerService> DrmManagerClientImpl::mDrmManagerService; Mutex DrmManagerClientImpl::sMutex; sp<IDrmManagerService> DrmManagerClientImpl::sDrmManagerService; sp<DrmManagerClientImpl::DeathNotifier> DrmManagerClientImpl::sDeathNotifier; const String8 DrmManagerClientImpl::EMPTY_STRING(""); DrmManagerClientImpl* DrmManagerClientImpl::create(int* pUniqueId) { Loading @@ -47,8 +48,8 @@ void DrmManagerClientImpl::remove(int uniqueId) { } const sp<IDrmManagerService>& DrmManagerClientImpl::getDrmManagerService() { mMutex.lock(); if (NULL == mDrmManagerService.get()) { Mutex::Autolock lock(sMutex); if (NULL == sDrmManagerService.get()) { sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder; do { Loading @@ -62,11 +63,13 @@ const sp<IDrmManagerService>& DrmManagerClientImpl::getDrmManagerService() { reqt.tv_nsec = 500000000; //0.5 sec nanosleep(&reqt, NULL); } while (true); mDrmManagerService = interface_cast<IDrmManagerService>(binder); if (NULL == sDeathNotifier.get()) { sDeathNotifier = new DeathNotifier(); } binder->linkToDeath(sDeathNotifier); sDrmManagerService = interface_cast<IDrmManagerService>(binder); } mMutex.unlock(); return mDrmManagerService; return sDrmManagerService; } void DrmManagerClientImpl::addClient(int uniqueId) { Loading Loading @@ -143,12 +146,9 @@ DrmInfo* DrmManagerClientImpl::acquireDrmInfo( status_t DrmManagerClientImpl::saveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath) { status_t status = DRM_ERROR_UNKNOWN; if (EMPTY_STRING != contentPath) { status = getDrmManagerService()->saveRights( return getDrmManagerService()->saveRights( uniqueId, drmRights, rightsPath, contentPath); } return status; } String8 DrmManagerClientImpl::getOriginalMimeType( int uniqueId, const String8& path) { Loading Loading @@ -336,3 +336,16 @@ status_t DrmManagerClientImpl::notify(const DrmInfoEvent& event) { return DRM_NO_ERROR; } DrmManagerClientImpl::DeathNotifier::~DeathNotifier() { Mutex::Autolock lock(sMutex); if (NULL != sDrmManagerService.get()) { sDrmManagerService->asBinder()->unlinkToDeath(this); } } void DrmManagerClientImpl::DeathNotifier::binderDied(const wp<IBinder>& who) { Mutex::Autolock lock(sMutex); DrmManagerClientImpl::sDrmManagerService.clear(); LOGW("DrmManager server died!"); } drm/libdrmframework/include/DrmManager.h +1 −2 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ class IDrmManager; class DrmRegistrationInfo; class DrmUnregistrationInfo; class DrmRightsAcquisitionInfo; class DrmContentIds; class DrmConstraints; class DrmMetadata; class DrmRights; Loading Loading @@ -141,7 +140,7 @@ private: bool canHandle(int uniqueId, const String8& path); private: static Vector<int> mUniqueIdVector; Vector<int> mUniqueIdVector; static const String8 EMPTY_STRING; int mDecryptSessionId; Loading drm/libdrmframework/include/DrmManagerClientImpl.h +10 −2 Original line number Diff line number Diff line Loading @@ -407,9 +407,17 @@ private: Mutex mLock; sp<DrmManagerClient::OnInfoListener> mOnInfoListener; class DeathNotifier: public IBinder::DeathRecipient { public: DeathNotifier() {} virtual ~DeathNotifier(); virtual void binderDied(const wp<IBinder>& who); }; private: static Mutex mMutex; static sp<IDrmManagerService> mDrmManagerService; static Mutex sMutex; static sp<DeathNotifier> sDeathNotifier; static sp<IDrmManagerService> sDrmManagerService; static const sp<IDrmManagerService>& getDrmManagerService(); static const String8 EMPTY_STRING; }; Loading Loading
drm/drmserver/DrmManager.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ using namespace android; Vector<int> DrmManager::mUniqueIdVector; const String8 DrmManager::EMPTY_STRING(""); DrmManager::DrmManager() : Loading
drm/java/android/drm/DrmInfoRequest.java +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import java.util.Iterator; * */ public class DrmInfoRequest { // Changes in following constants should be in sync with DrmInfoRequest.cpp // Changes in following constants should be in sync with DrmInfoRequest.h /** * Constants defines the type of {@link DrmInfoRequest} */ Loading
drm/libdrmframework/DrmManagerClientImpl.cpp +25 −12 Original line number Diff line number Diff line Loading @@ -28,8 +28,9 @@ using namespace android; #define INVALID_VALUE -1 Mutex DrmManagerClientImpl::mMutex; sp<IDrmManagerService> DrmManagerClientImpl::mDrmManagerService; Mutex DrmManagerClientImpl::sMutex; sp<IDrmManagerService> DrmManagerClientImpl::sDrmManagerService; sp<DrmManagerClientImpl::DeathNotifier> DrmManagerClientImpl::sDeathNotifier; const String8 DrmManagerClientImpl::EMPTY_STRING(""); DrmManagerClientImpl* DrmManagerClientImpl::create(int* pUniqueId) { Loading @@ -47,8 +48,8 @@ void DrmManagerClientImpl::remove(int uniqueId) { } const sp<IDrmManagerService>& DrmManagerClientImpl::getDrmManagerService() { mMutex.lock(); if (NULL == mDrmManagerService.get()) { Mutex::Autolock lock(sMutex); if (NULL == sDrmManagerService.get()) { sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder; do { Loading @@ -62,11 +63,13 @@ const sp<IDrmManagerService>& DrmManagerClientImpl::getDrmManagerService() { reqt.tv_nsec = 500000000; //0.5 sec nanosleep(&reqt, NULL); } while (true); mDrmManagerService = interface_cast<IDrmManagerService>(binder); if (NULL == sDeathNotifier.get()) { sDeathNotifier = new DeathNotifier(); } binder->linkToDeath(sDeathNotifier); sDrmManagerService = interface_cast<IDrmManagerService>(binder); } mMutex.unlock(); return mDrmManagerService; return sDrmManagerService; } void DrmManagerClientImpl::addClient(int uniqueId) { Loading Loading @@ -143,12 +146,9 @@ DrmInfo* DrmManagerClientImpl::acquireDrmInfo( status_t DrmManagerClientImpl::saveRights(int uniqueId, const DrmRights& drmRights, const String8& rightsPath, const String8& contentPath) { status_t status = DRM_ERROR_UNKNOWN; if (EMPTY_STRING != contentPath) { status = getDrmManagerService()->saveRights( return getDrmManagerService()->saveRights( uniqueId, drmRights, rightsPath, contentPath); } return status; } String8 DrmManagerClientImpl::getOriginalMimeType( int uniqueId, const String8& path) { Loading Loading @@ -336,3 +336,16 @@ status_t DrmManagerClientImpl::notify(const DrmInfoEvent& event) { return DRM_NO_ERROR; } DrmManagerClientImpl::DeathNotifier::~DeathNotifier() { Mutex::Autolock lock(sMutex); if (NULL != sDrmManagerService.get()) { sDrmManagerService->asBinder()->unlinkToDeath(this); } } void DrmManagerClientImpl::DeathNotifier::binderDied(const wp<IBinder>& who) { Mutex::Autolock lock(sMutex); DrmManagerClientImpl::sDrmManagerService.clear(); LOGW("DrmManager server died!"); }
drm/libdrmframework/include/DrmManager.h +1 −2 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ class IDrmManager; class DrmRegistrationInfo; class DrmUnregistrationInfo; class DrmRightsAcquisitionInfo; class DrmContentIds; class DrmConstraints; class DrmMetadata; class DrmRights; Loading Loading @@ -141,7 +140,7 @@ private: bool canHandle(int uniqueId, const String8& path); private: static Vector<int> mUniqueIdVector; Vector<int> mUniqueIdVector; static const String8 EMPTY_STRING; int mDecryptSessionId; Loading
drm/libdrmframework/include/DrmManagerClientImpl.h +10 −2 Original line number Diff line number Diff line Loading @@ -407,9 +407,17 @@ private: Mutex mLock; sp<DrmManagerClient::OnInfoListener> mOnInfoListener; class DeathNotifier: public IBinder::DeathRecipient { public: DeathNotifier() {} virtual ~DeathNotifier(); virtual void binderDied(const wp<IBinder>& who); }; private: static Mutex mMutex; static sp<IDrmManagerService> mDrmManagerService; static Mutex sMutex; static sp<DeathNotifier> sDeathNotifier; static sp<IDrmManagerService> sDrmManagerService; static const sp<IDrmManagerService>& getDrmManagerService(); static const String8 EMPTY_STRING; }; Loading