Change getSupportedCryptoSchemesNative to use getSupportedSchemes

Bug: 225064675
Test: CtsMediaDrmFrameworkTestCases
Change-Id: I2461e17f5e97e58110b6e2a56cd699496ef253eb
This commit is contained in:
Kyle Zhang 2022-03-17 23:39:05 +00:00
parent c79530b4e0
commit 621af3e560

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