Add Property to Access System ID

Adds a new property to the CDM's QueryStatus called QUERY_KEY_SYSTEM_ID that
contains the System ID. (as read from OEMCrypto_GetKeyData)  Adds a new
property to the DrmPlugin (cleverly named "systemId") that allows the app to
query for this.  Also adds unit tests.

Also changes the Device ID getter in crypto_engine.cpp to return a failure
instead of an empty ID.

Bug: 8621632

Merge of https://widevine-internal-review.googlesource.com/#/c/5010/ from
widevine cdm repository to android repository.

Change-Id: I8f309af18487c499e8ce25e829059e45623ea4dc
This commit is contained in:
Jeff Tinker
2013-04-18 13:55:15 -07:00
parent 0fc9bf9699
commit 0ab787b958
8 changed files with 87 additions and 25 deletions

View File

@@ -285,9 +285,7 @@ status_t WVDrmPlugin::getPropertyString(const String8& name,
value = "AES/CBC/NoPadding,HmacSHA256";
} else if (name == "securityLevel") {
CdmQueryMap status;
CdmResponseType res = mCDM->QueryStatus(&status);
if (!isCdmResponseTypeSuccess(res)) {
ALOGE("Error querying CDM status: %u", res);
return mapCdmResponseType(res);
@@ -295,11 +293,18 @@ status_t WVDrmPlugin::getPropertyString(const String8& name,
ALOGE("CDM did not report a security level");
return kErrorCDMGeneric;
}
const string& securityLevel = status[QUERY_KEY_SECURITY_LEVEL];
value.clear();
value.append(securityLevel.data(), securityLevel.size());
value = status[QUERY_KEY_SECURITY_LEVEL].c_str();
} else if (name == "systemId") {
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_SYSTEM_ID)) {
ALOGE("CDM did not report a system ID");
return kErrorCDMGeneric;
}
value = status[QUERY_KEY_SYSTEM_ID].c_str();
} else {
ALOGE("App requested unknown property %s", name.string());
return android::ERROR_DRM_CANNOT_HANDLE;