Clean up other core CDM logs.

[ Merge of http://go/wvgerrit/122613 ]

Further log clean up in the core CDM code.
- Changed several INFO logs to DEBUG and VERBOSE
- Added more identifiers to the DEBUG logs to help match resource
  associations
- Added more enum-to-string functions
- Unknown enum values will be formatted to contain their numeric
  value

Key areas improved are the UsageTableHeader and CdmSession.

Bug: 183576879
Test: CE CDM unittests
Change-Id: I2d11e714d419e0736d3e2f7a7668e8d36d7ef449
This commit is contained in:
Alex Dale
2021-04-19 19:27:40 -07:00
parent 85afe8c0b0
commit 0579fe805e
7 changed files with 338 additions and 200 deletions

View File

@@ -509,8 +509,8 @@ CdmSecurityLevel CryptoSession::GetSecurityLevel(
if (length != kExpectedSecurityLevelLength) {
LOGE(
"Unexpected security level length: "
"length = %zu, requested_security_level = %d",
length, static_cast<int>(requested_security_level));
"length = %zu, requested_security_level = %s",
length, SecurityLevelToString(requested_security_level));
return kSecurityLevelUnknown;
}
const std::string security_level(level);
@@ -525,8 +525,8 @@ CdmSecurityLevel CryptoSession::GetSecurityLevel(
}
LOGE(
"Ill-formed security level: "
"level = \"%s\", requested_security_level = %d",
security_level.c_str(), static_cast<int>(requested_security_level));
"level = \"%s\", requested_security_level = %s",
security_level.c_str(), SecurityLevelToString(requested_security_level));
return kSecurityLevelUnknown;
}
@@ -673,8 +673,8 @@ CdmResponseType CryptoSession::GetSystemIdInternal(uint32_t* system_id) {
uint32_t* id = reinterpret_cast<uint32_t*>(&token[4]);
*system_id = ntohl(*id);
return NO_ERROR;
} else if (pre_provision_token_type_ == kClientTokenOemCert) {
}
if (pre_provision_token_type_ == kClientTokenOemCert) {
// Get the OEM Cert
std::string oem_cert;
CdmResponseType status = GetTokenFromOemCert(&oem_cert);
@@ -685,16 +685,15 @@ CdmResponseType CryptoSession::GetSystemIdInternal(uint32_t* system_id) {
return EXTRACT_SYSTEM_ID_FROM_OEM_CERT_ERROR;
return NO_ERROR;
}
if (pre_provision_token_type_ == kClientTokenDrmCert) {
// TODO(blueeyes): Support loading the system id from a pre-provisioned
// Drm certificate.
} else if (pre_provision_token_type_ == kClientTokenDrmCert) {
return NO_ERROR;
} else {
LOGE("Unsupported pre-provision token type: %d",
static_cast<int>(pre_provision_token_type_));
return UNKNOWN_CLIENT_TOKEN_TYPE;
}
LOGE("Unsupported pre-provision token type: %d",
static_cast<int>(pre_provision_token_type_));
return UNKNOWN_CLIENT_TOKEN_TYPE;
}
bool CryptoSession::ExtractSystemIdFromOemCert(const std::string& oem_cert,
@@ -721,7 +720,8 @@ CdmResponseType CryptoSession::GetProvisioningId(std::string* provisioning_id) {
}
return NO_ERROR;
} else if (pre_provision_token_type_ == kClientTokenKeybox) {
}
if (pre_provision_token_type_ == kClientTokenKeybox) {
std::string token;
CdmResponseType status = GetTokenFromKeybox(&token);
@@ -734,11 +734,10 @@ CdmResponseType CryptoSession::GetProvisioningId(std::string* provisioning_id) {
provisioning_id->assign(reinterpret_cast<char*>(&token[8]), 16);
return NO_ERROR;
} else {
LOGE("Unsupported pre-provision token type: %d",
static_cast<int>(pre_provision_token_type_));
return UNKNOWN_CLIENT_TOKEN_TYPE;
}
LOGE("Unsupported pre-provision token type: %d",
static_cast<int>(pre_provision_token_type_));
return UNKNOWN_CLIENT_TOKEN_TYPE;
}
uint8_t CryptoSession::GetSecurityPatchLevel() {