Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 192b591c authored by Gloria Wang's avatar Gloria Wang
Browse files

- Some change on the DrmManager in order to support feature request 4082089.

    In DrmManager, we currently lock both processDrmInfo() and onInfo() which is
    ok for now since processDrmInfo() is async call, and it will return without
    waiting for onInfo() call. However, if we send an event in processDrmInfo(),
    we will got deadlock here because we need to invoke onInf() which will wait
    for processDrmInfo() to release the lock. Use different lock for onInfo().
- Remove some redundent mutex lock.

Change-Id: I59c794f95ba1693425723224114fa975cf9b235f
parent 0eb7b697
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ status_t DrmManager::unloadPlugIns() {

status_t DrmManager::setDrmServiceListener(
            int uniqueId, const sp<IDrmServiceListener>& drmServiceListener) {
    Mutex::Autolock _l(mLock);
    Mutex::Autolock _l(mListenerLock);
    if (NULL != drmServiceListener.get()) {
        mServiceListeners.add(uniqueId, drmServiceListener);
    } else {
@@ -573,7 +573,7 @@ String8 DrmManager::getSupportedPlugInIdFromPath(int uniqueId, const String8& pa
}

void DrmManager::onInfo(const DrmInfoEvent& event) {
    Mutex::Autolock _l(mLock);
    Mutex::Autolock _l(mListenerLock);
    for (unsigned int index = 0; index < mServiceListeners.size(); index++) {
        int uniqueId = mServiceListeners.keyAt(index);

+0 −5
Original line number Diff line number Diff line
@@ -78,7 +78,6 @@ int DrmManagerClient::checkRightsStatus(const String8& path, int action) {
}

status_t DrmManagerClient::consumeRights(DecryptHandle* decryptHandle, int action, bool reserve) {
    Mutex::Autolock _l(mDecryptLock);
    return mDrmManagerClientImpl->consumeRights(mUniqueId, decryptHandle, action, reserve);
}

@@ -131,7 +130,6 @@ status_t DrmManagerClient::closeDecryptSession(DecryptHandle* decryptHandle) {

status_t DrmManagerClient::initializeDecryptUnit(
            DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) {
    Mutex::Autolock _l(mDecryptLock);
    return mDrmManagerClientImpl->initializeDecryptUnit(
            mUniqueId, decryptHandle, decryptUnitId, headerInfo);
}
@@ -139,19 +137,16 @@ status_t DrmManagerClient::initializeDecryptUnit(
status_t DrmManagerClient::decrypt(
    DecryptHandle* decryptHandle, int decryptUnitId,
    const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
    Mutex::Autolock _l(mDecryptLock);
    return mDrmManagerClientImpl->decrypt(
            mUniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV);
}

status_t DrmManagerClient::finalizeDecryptUnit(DecryptHandle* decryptHandle, int decryptUnitId) {
    Mutex::Autolock _l(mDecryptLock);
    return mDrmManagerClientImpl->finalizeDecryptUnit(mUniqueId, decryptHandle, decryptUnitId);
}

ssize_t DrmManagerClient::pread(
            DecryptHandle* decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) {
    Mutex::Autolock _l(mDecryptLock);
    return mDrmManagerClientImpl->pread(mUniqueId, decryptHandle, buffer, numBytes, offset);
}
+1 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ private:
    int mDecryptSessionId;
    int mConvertId;
    Mutex mLock;
    Mutex mListenerLock;
    Mutex mDecryptLock;
    Mutex mConvertLock;
    TPlugInManager<IDrmEngine> mPlugInManager;
+0 −1
Original line number Diff line number Diff line
@@ -365,7 +365,6 @@ public:

private:
    int mUniqueId;
    Mutex mDecryptLock;
    DrmManagerClientImpl* mDrmManagerClientImpl;
};