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

Commit 5179aff3 authored by Robert Shih's avatar Robert Shih
Browse files

DrmHal: check hidl txn err in isCryptoSchemeSupported

Bug: 263412540
Change-Id: I43aedc4851db395d4ded9ccd7810f17261127b16
Merged-In: I43aedc4851db395d4ded9ccd7810f17261127b16
parent ea44678b
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -513,10 +513,14 @@ status_t DrmHalHidl::matchMimeTypeAndSecurityLevel(const sp<IDrmFactory>& factor
        if (mimeType == "") {
            // isCryptoSchemeSupported(uuid)
            *isSupported = true;
        } else {
            return OK;
        }
        // isCryptoSchemeSupported(uuid, mimeType)
            *isSupported = factory->isContentTypeSupported(mimeType.string());
        auto hResult = factory->isContentTypeSupported(mimeType.string());
        if (!hResult.isOk()) {
            return DEAD_OBJECT;
        }
        *isSupported = hResult;
        return OK;
    } else if (mimeType == "") {
        return BAD_VALUE;
@@ -526,8 +530,12 @@ status_t DrmHalHidl::matchMimeTypeAndSecurityLevel(const sp<IDrmFactory>& factor
    if (factoryV1_2 == NULL) {
        return ERROR_UNSUPPORTED;
    } else {
        *isSupported = factoryV1_2->isCryptoSchemeSupported_1_2(uuid, mimeType.string(),
        auto hResult = factoryV1_2->isCryptoSchemeSupported_1_2(uuid, mimeType.string(),
                                                                toHidlSecurityLevel(level));
        if (!hResult.isOk()) {
            return DEAD_OBJECT;
        }
        *isSupported = hResult;
        return OK;
    }
}
@@ -537,7 +545,8 @@ status_t DrmHalHidl::isCryptoSchemeSupported(const uint8_t uuid[16], const Strin
    Mutex::Autolock autoLock(mLock);
    *isSupported = false;
    for (ssize_t i = mFactories.size() - 1; i >= 0; i--) {
        if (mFactories[i]->isCryptoSchemeSupported(uuid)) {
        auto hResult = mFactories[i]->isCryptoSchemeSupported(uuid);
        if (hResult.isOk() && hResult) {
            return matchMimeTypeAndSecurityLevel(mFactories[i], uuid, mimeType, level, isSupported);
        }
    }