Provide BCC in WVDrmFactory dumpsys.

[ Merge of go/wvgerrit/c/cdm/+/165138 ]

Enabled the Widevine DRM service on Android to return the raw boot
certificate chain via the CDM status query capabilities.  This
property key is not available for app-level queries.

The BCC is dumped by the WVDrmFactory when requested to print all
CDM properties via dumpsys.

Bug: 234095402
Test: request_license_test
Test: adb shell dumpsys android.hardware.drm.IDrmFactory/widevine -p
Change-Id: I34695b0655b4c609979577e9986974bc0fbda898
This commit is contained in:
Alex Dale
2022-06-09 15:58:18 -07:00
parent 1deba6cee1
commit b11890a694
5 changed files with 60 additions and 22 deletions

View File

@@ -10,6 +10,7 @@
#include "WVDrmFactory.h"
#include <cctype>
#include <algorithm>
#include <android/binder_ibinder_platform.h>
#include <binder/IPCThreadState.h>
@@ -154,19 +155,12 @@ int32_t WVDrmFactory::firstApiLevel() {
return ::ndk::ScopedAStatus::ok();
}
string WVDrmFactory::stringToHex(const string& s) {
string input(s.c_str());
bool toHex = false;
for (const char ch : input) {
if (!isprint(ch)) {
toHex = true;
break;
}
string WVDrmFactory::stringToHex(const string& input) {
if (std::all_of(input.begin(), input.end(), ::isprint)) {
return input;
}
if (!toHex) return input;
static constexpr char hex[] = "0123456789ABCDEF";
string output;
output.reserve(input.length() * 2);
for (const unsigned char ch : input) {
@@ -247,6 +241,9 @@ void WVDrmFactory::printCdmProperties(int fd) {
wvcdm::QUERY_KEY_CAN_DISABLE_ANALOG_OUTPUT},
{"watermarking_support", wvcdm::QUERY_KEY_WATERMARKING_SUPPORT},
{"production_ready", wvcdm::QUERY_KEY_PRODUCTION_READY},
// Debug properties. Not exposed to app.
{"boot_certificate_chain",
wvcdm::QUERY_KEY_DEBUG_BOOT_CERTIFICATE_CHAIN},
};
string value;