Add Properties to Query HDCP Status and Usage Reporting Support

This is a merge of http://go/wvgerrit/10846/ from the Widevine repository.

Change-Id: I682069073d9ec58c03781de25d9c6fa5ec5864ff
This commit is contained in:
John "Juce" Bruce
2014-08-05 15:09:53 -07:00
parent 3099da6170
commit b608e17e08
4 changed files with 84 additions and 0 deletions

View File

@@ -464,6 +464,39 @@ status_t WVDrmPlugin::getPropertyString(const String8& name,
} else {
value = kDisable;
}
} else if (name == "hdcpLevel") {
CdmQueryMap status;
CdmResponseType res = mCDM->QueryStatus(&status);
if (res != wvcdm::NO_ERROR) {
ALOGE("Error querying CDM status: %u", res);
return mapCdmResponseType(res);
} else if (!status.count(QUERY_KEY_CURRENT_HDCP_LEVEL)) {
ALOGE("CDM did not report a current HDCP level");
return kErrorCDMGeneric;
}
value = status[QUERY_KEY_CURRENT_HDCP_LEVEL].c_str();
} else if (name == "maxHdcpLevel") {
CdmQueryMap status;
CdmResponseType res = mCDM->QueryStatus(&status);
if (res != wvcdm::NO_ERROR) {
ALOGE("Error querying CDM status: %u", res);
return mapCdmResponseType(res);
} else if (!status.count(QUERY_KEY_MAX_HDCP_LEVEL)) {
ALOGE("CDM did not report a maximum HDCP level");
return kErrorCDMGeneric;
}
value = status[QUERY_KEY_MAX_HDCP_LEVEL].c_str();
} else if (name == "usageReportingSupport") {
CdmQueryMap status;
CdmResponseType res = mCDM->QueryStatus(&status);
if (res != wvcdm::NO_ERROR) {
ALOGE("Error querying CDM status: %u", res);
return mapCdmResponseType(res);
} else if (!status.count(QUERY_KEY_USAGE_SUPPORT)) {
ALOGE("CDM did not report whether it supports usage reporting");
return kErrorCDMGeneric;
}
value = status[QUERY_KEY_USAGE_SUPPORT].c_str();
} else {
ALOGE("App requested unknown string property %s", name.string());
return android::ERROR_DRM_CANNOT_HANDLE;