diff options
author | Gloria Wang <gwang@google.com> | 2011-03-15 14:10:30 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-03-15 14:10:30 -0700 |
commit | 0e5e2e2b2bb3d6c3a0216181df29e6bfdc71256f (patch) | |
tree | fa2438bdf9db0b794cf09ea70fab05bf8f3f22e6 /drm | |
parent | d4a9bb569e6d23294dae5be21023f3182e7586a1 (diff) | |
parent | 5c96c65f692f8c2297d213c88450dd601d2b5c1f (diff) | |
download | frameworks_base-0e5e2e2b2bb3d6c3a0216181df29e6bfdc71256f.zip frameworks_base-0e5e2e2b2bb3d6c3a0216181df29e6bfdc71256f.tar.gz frameworks_base-0e5e2e2b2bb3d6c3a0216181df29e6bfdc71256f.tar.bz2 |
Merge "Bug fixes of DRM framework."
Diffstat (limited to 'drm')
-rw-r--r-- | drm/drmserver/DrmManager.cpp | 1 | ||||
-rw-r--r-- | drm/java/android/drm/DrmInfoRequest.java | 2 | ||||
-rw-r--r-- | drm/libdrmframework/DrmManagerClientImpl.cpp | 37 | ||||
-rw-r--r-- | drm/libdrmframework/include/DrmManager.h | 3 | ||||
-rw-r--r-- | drm/libdrmframework/include/DrmManagerClientImpl.h | 12 | ||||
-rw-r--r-- | drm/libdrmframework/include/IDrmManagerService.h | 1 | ||||
-rw-r--r-- | drm/libdrmframework/plugins/common/include/IDrmEngine.h | 1 |
7 files changed, 37 insertions, 20 deletions
diff --git a/drm/drmserver/DrmManager.cpp b/drm/drmserver/DrmManager.cpp index 1eee5f2..2fee59c 100644 --- a/drm/drmserver/DrmManager.cpp +++ b/drm/drmserver/DrmManager.cpp @@ -37,7 +37,6 @@ using namespace android; -Vector<int> DrmManager::mUniqueIdVector; const String8 DrmManager::EMPTY_STRING(""); DrmManager::DrmManager() : diff --git a/drm/java/android/drm/DrmInfoRequest.java b/drm/java/android/drm/DrmInfoRequest.java index a5a799c..366a342 100644 --- a/drm/java/android/drm/DrmInfoRequest.java +++ b/drm/java/android/drm/DrmInfoRequest.java @@ -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} */ diff --git a/drm/libdrmframework/DrmManagerClientImpl.cpp b/drm/libdrmframework/DrmManagerClientImpl.cpp index e6ae220..a57dd98 100644 --- a/drm/libdrmframework/DrmManagerClientImpl.cpp +++ b/drm/libdrmframework/DrmManagerClientImpl.cpp @@ -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) { @@ -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 { @@ -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) { @@ -143,11 +146,8 @@ 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( @@ -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!"); +} + diff --git a/drm/libdrmframework/include/DrmManager.h b/drm/libdrmframework/include/DrmManager.h index c7276f9..af2c2a8 100644 --- a/drm/libdrmframework/include/DrmManager.h +++ b/drm/libdrmframework/include/DrmManager.h @@ -30,7 +30,6 @@ class IDrmManager; class DrmRegistrationInfo; class DrmUnregistrationInfo; class DrmRightsAcquisitionInfo; -class DrmContentIds; class DrmConstraints; class DrmMetadata; class DrmRights; @@ -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; diff --git a/drm/libdrmframework/include/DrmManagerClientImpl.h b/drm/libdrmframework/include/DrmManagerClientImpl.h index 0cba8d4..564896b 100644 --- a/drm/libdrmframework/include/DrmManagerClientImpl.h +++ b/drm/libdrmframework/include/DrmManagerClientImpl.h @@ -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; }; diff --git a/drm/libdrmframework/include/IDrmManagerService.h b/drm/libdrmframework/include/IDrmManagerService.h index 2424ea5..7727e55 100644 --- a/drm/libdrmframework/include/IDrmManagerService.h +++ b/drm/libdrmframework/include/IDrmManagerService.h @@ -25,7 +25,6 @@ namespace android { -class DrmContentIds; class DrmConstraints; class DrmMetadata; class DrmRights; diff --git a/drm/libdrmframework/plugins/common/include/IDrmEngine.h b/drm/libdrmframework/plugins/common/include/IDrmEngine.h index d05c24f..77460f6 100644 --- a/drm/libdrmframework/plugins/common/include/IDrmEngine.h +++ b/drm/libdrmframework/plugins/common/include/IDrmEngine.h @@ -21,7 +21,6 @@ namespace android { -class DrmContentIds; class DrmConstraints; class DrmMetadata; class DrmRights; |