Merge "Add dumping provision request functionality" into udc-qpr-dev am: be8b64a4e6
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/24269065 Change-Id: Iad28bf04dbe46eac2fad9e75a2859f6d81cd52e2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -60,6 +60,7 @@ class WVDrmFactory : public ::aidl::android::hardware::drm::BnDrmFactory {
|
||||
static void printCdmMetrics(int fd);
|
||||
static void printCdmProperties(int fd);
|
||||
static void printUsage(int fd);
|
||||
static void printProvisioningRequest(int fd, bool cast);
|
||||
|
||||
friend class WVDrmFactoryTestPeer;
|
||||
};
|
||||
|
||||
@@ -230,6 +230,27 @@ string WVDrmFactory::stringToHex(const string& input) {
|
||||
return output;
|
||||
}
|
||||
|
||||
// Attempt to get provisioning request.
|
||||
// Choose if it's cast specific.
|
||||
// Output the request to fd.
|
||||
void WVDrmFactory::printProvisioningRequest(int fd, bool cast) {
|
||||
dprintf(fd, "provisioning_request:\n");
|
||||
std::shared_ptr<WVDrmPlugin> plugin = ndk::SharedRefBase::make<WVDrmPlugin>(
|
||||
getCDM(), "dumpsys", &sOemCryptoInterface,
|
||||
areSpoidsEnabled());
|
||||
::aidl::android::hardware::drm::ProvisionRequest res;
|
||||
std::string cert = "";
|
||||
std::string cert_auth = "";
|
||||
if (cast) {
|
||||
cert = "X.509";
|
||||
cert_auth = "cast.google.com";
|
||||
}
|
||||
plugin->getProvisionRequest(cert, cert_auth, &res);
|
||||
string req(res.request.begin(), res.request.end());
|
||||
dprintf(fd, " request: %s\n", req.c_str());
|
||||
dprintf(fd, " default_url: %s\n", res.defaultUrl.c_str());
|
||||
}
|
||||
|
||||
void WVDrmFactory::printCdmMetrics(int fd) {
|
||||
dprintf(fd, "widevine_cdm_metrics:\n");
|
||||
|
||||
@@ -354,6 +375,7 @@ binder_status_t WVDrmFactory::dump(int fd, const char** args,
|
||||
}
|
||||
|
||||
bool dumpCdmProperties, dumpCdmMetrics = false;
|
||||
bool dumpProvReq = false, provCast = false;
|
||||
if (numArgs == 0) {
|
||||
// default to print all info if no arguments are given
|
||||
dumpCdmProperties = dumpCdmMetrics = true;
|
||||
@@ -366,6 +388,13 @@ binder_status_t WVDrmFactory::dump(int fd, const char** args,
|
||||
} else if (option.find("-m") != string::npos ||
|
||||
option.find("-M") != string::npos) {
|
||||
dumpCdmMetrics = true;
|
||||
} else if (option.find("-prov_cast") != string::npos ||
|
||||
option.find("-Prov_cast") != string::npos) {
|
||||
dumpProvReq = true;
|
||||
provCast = true;
|
||||
} else if (option.find("-prov") != string::npos ||
|
||||
option.find("-Prov") != string::npos) {
|
||||
dumpProvReq = true;
|
||||
} else if (option.find("-p") != string::npos ||
|
||||
option.find("-P") != string::npos) {
|
||||
dumpCdmProperties = true;
|
||||
@@ -379,8 +408,9 @@ binder_status_t WVDrmFactory::dump(int fd, const char** args,
|
||||
}
|
||||
}
|
||||
|
||||
if (dumpCdmMetrics) printCdmMetrics(fd);
|
||||
if (dumpCdmProperties) printCdmProperties(fd);
|
||||
if (dumpProvReq) printProvisioningRequest(fd, provCast);
|
||||
if (dumpCdmMetrics) printCdmMetrics(fd);
|
||||
fsync(fd);
|
||||
|
||||
return STATUS_OK;
|
||||
|
||||
Reference in New Issue
Block a user