Merge cdm changes to android repo

Bug: 251924225
Test: GtsMediaTestCases
Change-Id: I1b4e64c0abf701fe1f5017f14dc72b72c3ea6770
This commit is contained in:
Kyle Zhang
2022-10-07 23:55:37 +00:00
parent 3cfe7c7299
commit af0168dbed
54 changed files with 295536 additions and 294359 deletions

View File

@@ -566,7 +566,8 @@ CdmResponseType CertificateProvisioning::HandleProvisioningResponse(
const bool result =
ExtractAndDecodeSignedMessage(response_message, &response);
if (!result || response.empty()) {
LOGE("Provisioning response message is an invalid JSON/base64 string");
LOGE("Provisioning response message is an invalid JSON/base64 string: %s",
response.c_str());
return CERT_PROVISIONING_RESPONSE_ERROR_1;
}
}
@@ -733,7 +734,7 @@ bool CertificateProvisioning::ExtractAndDecodeSignedMessage(
if (start == provisioning_response.npos) {
// Message is not properly wrapped - reject it.
LOGE("Cannot locate start substring");
LOGE("Cannot locate start substring '%s'", json_start_substr.c_str());
result->clear();
return false;
}
@@ -742,7 +743,7 @@ bool CertificateProvisioning::ExtractAndDecodeSignedMessage(
const size_t end = provisioning_response.find(
json_end_substr, start + json_start_substr.length());
if (end == provisioning_response.npos) {
LOGE("Cannot locate end substring");
LOGE("Cannot locate end substring '%s'", json_end_substr.c_str());
result->clear();
return false;
}

View File

@@ -924,30 +924,23 @@ class Adapter {
return result;
}
LOGI("L3 Initialized. Trying L1.");
std::string library_name;
if (!wvcdm::Properties::GetOEMCryptoPath(&library_name)) {
std::vector<std::string> library_names;
if (!wvcdm::Properties::GetOEMCryptoPaths(&library_names)) {
LOGW("L1 library not specified. Falling back to L3");
metrics.OemCryptoDynamicAdapterMetrics::SetInitializationMode(
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L3_NO_L1_LIBRARY_PATH);
return result;
}
if (level1_library_ == nullptr) {
vector<string> library_paths = {"/vendor/", "/system/", "/odm/"};
string sub_dir;
#if __LP64__
sub_dir = "lib64/";
#else
sub_dir = "lib/";
#endif
for (auto& path : library_paths) {
level1_library_ = dlopen((path + sub_dir + library_name).c_str(), RTLD_NOW);
if (level1_library_) break;
for (auto& name : library_names) {
level1_library_ = dlopen((name.c_str()), RTLD_NOW);
if (level1_library_) {
LOGV("Using oemcrypto path %s", name.c_str());
break;
}
}
if (level1_library_ == nullptr) {
LOGW("Could not load %s. Falling back to L3. %s", library_name.c_str(),
dlerror());
LOGW("Could not load oemcrypto. Falling back to L3. %s", dlerror());
metrics.OemCryptoDynamicAdapterMetrics::SetInitializationMode(
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_L3_L1_OPEN_FAILED);
return result;