Add dumping provision request functionality
[ Merge of http://go/wvgerrit/179590 ] Bug: 277788529 Test: dumpsys android.hardware.drm.IDrmFactory/widevine -prov Change-Id: Ife88d1323bf5ee423eb8827ca324b73db3cc984a
This commit is contained in:
@@ -60,6 +60,7 @@ class WVDrmFactory : public ::aidl::android::hardware::drm::BnDrmFactory {
|
|||||||
static void printCdmMetrics(int fd);
|
static void printCdmMetrics(int fd);
|
||||||
static void printCdmProperties(int fd);
|
static void printCdmProperties(int fd);
|
||||||
static void printUsage(int fd);
|
static void printUsage(int fd);
|
||||||
|
static void printProvisioningRequest(int fd, bool cast);
|
||||||
|
|
||||||
friend class WVDrmFactoryTestPeer;
|
friend class WVDrmFactoryTestPeer;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -230,6 +230,27 @@ string WVDrmFactory::stringToHex(const string& input) {
|
|||||||
return output;
|
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) {
|
void WVDrmFactory::printCdmMetrics(int fd) {
|
||||||
dprintf(fd, "widevine_cdm_metrics:\n");
|
dprintf(fd, "widevine_cdm_metrics:\n");
|
||||||
|
|
||||||
@@ -355,6 +376,7 @@ binder_status_t WVDrmFactory::dump(int fd, const char** args,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool dumpCdmProperties, dumpCdmMetrics = false;
|
bool dumpCdmProperties, dumpCdmMetrics = false;
|
||||||
|
bool dumpProvReq = false, provCast = false;
|
||||||
if (numArgs == 0) {
|
if (numArgs == 0) {
|
||||||
// default to print all info if no arguments are given
|
// default to print all info if no arguments are given
|
||||||
dumpCdmProperties = dumpCdmMetrics = true;
|
dumpCdmProperties = dumpCdmMetrics = true;
|
||||||
@@ -367,6 +389,13 @@ binder_status_t WVDrmFactory::dump(int fd, const char** args,
|
|||||||
} else if (option.find("-m") != string::npos ||
|
} else if (option.find("-m") != string::npos ||
|
||||||
option.find("-M") != string::npos) {
|
option.find("-M") != string::npos) {
|
||||||
dumpCdmMetrics = true;
|
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 ||
|
} else if (option.find("-p") != string::npos ||
|
||||||
option.find("-P") != string::npos) {
|
option.find("-P") != string::npos) {
|
||||||
dumpCdmProperties = true;
|
dumpCdmProperties = true;
|
||||||
@@ -380,8 +409,9 @@ binder_status_t WVDrmFactory::dump(int fd, const char** args,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dumpCdmMetrics) printCdmMetrics(fd);
|
|
||||||
if (dumpCdmProperties) printCdmProperties(fd);
|
if (dumpCdmProperties) printCdmProperties(fd);
|
||||||
|
if (dumpProvReq) printProvisioningRequest(fd, provCast);
|
||||||
|
if (dumpCdmMetrics) printCdmMetrics(fd);
|
||||||
fsync(fd);
|
fsync(fd);
|
||||||
|
|
||||||
return STATUS_OK;
|
return STATUS_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user