Merge "Change getSupportedCryptoSchemesNative to use getSupportedSchemes" into tm-dev

This commit is contained in:
Kyle Zhang
2022-03-22 00:55:18 +00:00
committed by Android (Google) Code Review

View File

@@ -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()));