diff --git a/libwvdrmengine/aidl_src/WVDrmFactory.cpp b/libwvdrmengine/aidl_src/WVDrmFactory.cpp index 5c89e3c6..4d953cba 100644 --- a/libwvdrmengine/aidl_src/WVDrmFactory.cpp +++ b/libwvdrmengine/aidl_src/WVDrmFactory.cpp @@ -9,6 +9,8 @@ #include "WVDrmFactory.h" +#include + #include #include #include @@ -146,13 +148,11 @@ int32_t WVDrmFactory::firstApiLevel() { return ::ndk::ScopedAStatus::ok(); } -string WVDrmFactory::stringToHex(const string& input) { - // If input contains punctuations that are not part of - // a valid server url, we need to convert it to hex. - const string validChars = "/-._~%:"; +string WVDrmFactory::stringToHex(const string& s) { + string input(s.c_str()); bool toHex = false; for (const char ch : input) { - if (ispunct(ch) != 0 && validChars.find(ch) == string::npos) { + if (!isprint(ch)) { toHex = true; break; } @@ -204,41 +204,41 @@ void WVDrmFactory::printCdmMetrics(int fd) { } void WVDrmFactory::printCdmProperties(int fd) { - dprintf(fd, "\n**** Widevine CDM properties ****\n"); + dprintf(fd, "\nwidevine_cdm_properties:\n"); android::sp cdm(getCDM()); const bool isLevel1 = cdm->IsSecurityLevelSupported(wvcdm::CdmSecurityLevel::kSecurityLevelL1); - dprintf(fd, "default security level: [%s]\n", isLevel1 ? "L1" : "L3"); + dprintf(fd, " default_security_level: '%s'\n", isLevel1 ? "L1" : "L3"); const std::map cdmProperties = { - {"version- Widevine CDM:", wvcdm::QUERY_KEY_WVCDM_VERSION}, - {"version- current SRM:", wvcdm::QUERY_KEY_CURRENT_SRM_VERSION}, - {"version(major)- OEM Crypto API:", + {"version_widevine_cdm", wvcdm::QUERY_KEY_WVCDM_VERSION}, + {"version_current_srm", wvcdm::QUERY_KEY_CURRENT_SRM_VERSION}, + {"version_major_oemcrypto_api", wvcdm::QUERY_KEY_OEMCRYPTO_API_VERSION}, - {"version(minor)- OEM Crypto API:", + {"version_minor_oemcrypto_api", wvcdm::QUERY_KEY_OEMCRYPTO_API_MINOR_VERSION}, - {"id- device:", wvcdm::QUERY_KEY_DEVICE_ID}, - {"id- system:", wvcdm::QUERY_KEY_SYSTEM_ID}, - {"renewal server url:", wvcdm::QUERY_KEY_RENEWAL_SERVER_URL}, - {"hdcp level- max:", wvcdm::QUERY_KEY_MAX_HDCP_LEVEL}, - {"hdcp level- current:", wvcdm::QUERY_KEY_CURRENT_HDCP_LEVEL}, - {"num sessions- max supported:", wvcdm::QUERY_KEY_MAX_NUMBER_OF_SESSIONS}, - {"num sessions- opened:", wvcdm::QUERY_KEY_NUMBER_OF_OPEN_SESSIONS}, - {"resource rating tier:", wvcdm::QUERY_KEY_RESOURCE_RATING_TIER}, - {"support decrypt hash:", wvcdm::QUERY_KEY_DECRYPT_HASH_SUPPORT}, - {"support SRM update:", wvcdm::QUERY_KEY_SRM_UPDATE_SUPPORT}, - {"support usage table:", wvcdm::QUERY_KEY_USAGE_SUPPORT}, - {"max usage table entries:", wvcdm::QUERY_KEY_MAX_USAGE_TABLE_ENTRIES}, - {"OEM Crypto build info:", wvcdm::QUERY_KEY_OEMCRYPTO_BUILD_INFORMATION}, - {"provisioning id:", wvcdm::QUERY_KEY_PROVISIONING_ID}, - {"provisioning model:", wvcdm::QUERY_KEY_PROVISIONING_MODEL}, - {"analog capabilities:", wvcdm::QUERY_KEY_ANALOG_OUTPUT_CAPABILITIES}, - {"can disable analog output:", + {"device_id", wvcdm::QUERY_KEY_DEVICE_ID}, + {"system_id", wvcdm::QUERY_KEY_SYSTEM_ID}, + {"renewal_server_url", wvcdm::QUERY_KEY_RENEWAL_SERVER_URL}, + {"hdcp_level_max", wvcdm::QUERY_KEY_MAX_HDCP_LEVEL}, + {"hdcp_level_current", wvcdm::QUERY_KEY_CURRENT_HDCP_LEVEL}, + {"num_sessions_max_supported", wvcdm::QUERY_KEY_MAX_NUMBER_OF_SESSIONS}, + {"num_sessions_opened", wvcdm::QUERY_KEY_NUMBER_OF_OPEN_SESSIONS}, + {"resource_rating_tier", wvcdm::QUERY_KEY_RESOURCE_RATING_TIER}, + {"support_decrypt_hash", wvcdm::QUERY_KEY_DECRYPT_HASH_SUPPORT}, + {"support_SRM_update", wvcdm::QUERY_KEY_SRM_UPDATE_SUPPORT}, + {"support_usage_table", wvcdm::QUERY_KEY_USAGE_SUPPORT}, + {"max_usage_table_entries", wvcdm::QUERY_KEY_MAX_USAGE_TABLE_ENTRIES}, + {"oemcrypto_build_info", wvcdm::QUERY_KEY_OEMCRYPTO_BUILD_INFORMATION}, + {"provisioning_id", wvcdm::QUERY_KEY_PROVISIONING_ID}, + {"provisioning_model", wvcdm::QUERY_KEY_PROVISIONING_MODEL}, + {"analog_capabilities", wvcdm::QUERY_KEY_ANALOG_OUTPUT_CAPABILITIES}, + {"can_disable_analog_output", wvcdm::QUERY_KEY_CAN_DISABLE_ANALOG_OUTPUT}, - {"watermarking support:", wvcdm::QUERY_KEY_WATERMARKING_SUPPORT}, - {"production ready:", wvcdm::QUERY_KEY_PRODUCTION_READY}, + {"watermarking_support", wvcdm::QUERY_KEY_WATERMARKING_SUPPORT}, + {"production_ready", wvcdm::QUERY_KEY_PRODUCTION_READY}, }; string value; @@ -246,7 +246,7 @@ void WVDrmFactory::printCdmProperties(int fd) { cdm->QueryStatus(wvcdm::RequestedSecurityLevel::kLevelDefault, property.second, &value); string outString = stringToHex(value); - dprintf(fd, "%s [%s]\n", property.first.c_str(), outString.c_str()); + dprintf(fd, " %s: '%s'\n", property.first.c_str(), outString.c_str()); value.clear(); } }