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

Commit 621af3e5 authored by Kyle Zhang's avatar Kyle Zhang
Browse files

Change getSupportedCryptoSchemesNative to use getSupportedSchemes

Bug: 225064675
Test: CtsMediaDrmFrameworkTestCases
Change-Id: I2461e17f5e97e58110b6e2a56cd699496ef253eb
parent c79530b4
Loading
Loading
Loading
Loading
+2 −12
Original line number Diff line number Diff line
@@ -1003,19 +1003,9 @@ DrmPlugin::SecurityLevel jintToSecurityLevel(jint jlevel) {
}

static jbyteArray android_media_MediaDrm_getSupportedCryptoSchemesNative(JNIEnv *env) {
    sp<IDrm> drm = android::DrmUtils::MakeDrm();
    std::vector<uint8_t> bv;
    for (auto &factory : DrmUtils::MakeDrmFactories()) {
        sp<drm::V1_3::IDrmFactory> factoryV1_3 = drm::V1_3::IDrmFactory::castFrom(factory);
        if (factoryV1_3 == nullptr) {
            continue;
        }
        factoryV1_3->getSupportedCryptoSchemes(
            [&](const hardware::hidl_vec<hardware::hidl_array<uint8_t, 16>>& schemes) {
                for (const auto &scheme : schemes) {
                    bv.insert(bv.end(), scheme.data(), scheme.data() + scheme.size());
                }
            });
    }
    drm->getSupportedSchemes(bv);

    jbyteArray jUuidBytes = env->NewByteArray(bv.size());
    env->SetByteArrayRegion(jUuidBytes, 0, bv.size(), reinterpret_cast<const jbyte *>(bv.data()));