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

Commit e70022cf authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Unmap shared memory when no longer used" into pi-dev

parents 96363281 0db0fa1d
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -262,6 +262,17 @@ int32_t CryptoHal::setHeapBase(const sp<IMemoryHeap>& heap) {
void CryptoHal::clearHeapBase(int32_t seqNum) {
    Mutex::Autolock autoLock(mLock);

    /*
     * Clear the remote shared memory mapping by setting the shared
     * buffer base to a null hidl_memory.
     *
     * TODO: Add a releaseSharedBuffer method in a future DRM HAL
     * API version to make this explicit.
     */
    uint32_t bufferId = mHeapBases.valueFor(seqNum).getBufferId();
    Return<void> hResult = mPlugin->setSharedBufferBase(hidl_memory(), bufferId);
    ALOGE_IF(!hResult.isOk(), "setSharedBufferBase(): remote call failed");

    mHeapBases.removeItem(seqNum);
}