Respect Client Properties when reporting CDM Status

[ Merge from go/wvgerrit/14286 ]

CDM now reports status information associated with the specified security level.
Earlier information would be reported from the default security level.

b/18709693

Change-Id: I7a01e8ea9773b56951c207437ce85e567fd32b09
This commit is contained in:
Rahul Frias
2015-05-07 10:26:07 -07:00
parent 1c6b675f0c
commit d2e91faf8e
12 changed files with 110 additions and 30 deletions

View File

@@ -537,7 +537,8 @@ status_t WVDrmPlugin::setPropertyString(const String8& name,
// We must be sure we CAN set the security level to L1.
std::string current_security_level;
status_t status =
queryProperty(QUERY_KEY_SECURITY_LEVEL, current_security_level);
queryProperty(kLevelDefault, QUERY_KEY_SECURITY_LEVEL,
current_security_level);
if (status != android::OK) return status;
if (current_security_level != QUERY_VALUE_SECURITY_LEVEL_L1) {
@@ -880,9 +881,20 @@ void WVDrmPlugin::OnExpirationUpdate(const CdmSessionId& cdmSessionId,
}
status_t WVDrmPlugin::queryProperty(const std::string& property,
std::string& string_value) const {
std::string& stringValue) const {
SecurityLevel securityLevel =
mPropertySet.security_level().compare(QUERY_VALUE_SECURITY_LEVEL_L3) == 0
? kLevel3
: kLevelDefault;
return queryProperty(securityLevel, property, stringValue);
}
status_t WVDrmPlugin::queryProperty(SecurityLevel securityLevel,
const std::string& property,
std::string& stringValue) const {
CdmQueryMap status;
CdmResponseType res = mCDM->QueryStatus(&status);
CdmResponseType res = mCDM->QueryStatus(securityLevel, &status);
if (res != wvcdm::NO_ERROR) {
ALOGE("Error querying CDM status: %u", res);
return mapCdmResponseType(res);
@@ -890,7 +902,7 @@ status_t WVDrmPlugin::queryProperty(const std::string& property,
ALOGE("CDM did not report %s", property.c_str());
return kErrorCDMGeneric;
}
string_value = status[property];
stringValue = status[property];
return android::OK;
}