Correctly handle local display only for SRM version.
[ Merge of http://go/wvgerrit/105343 ] If a device only supports local display (eliminating the need for an SRM version), then the CDM should treat this as no SRM version. Bug: 166009716 Test: License request integration test Change-Id: I2d9c3f98735563df6d7c7a287abab41bf0a8c513
This commit is contained in:
@@ -1913,25 +1913,33 @@ CdmResponseType CryptoSession::GetSrmVersion(uint16_t* srm_version) {
|
||||
RETURN_IF_UNINITIALIZED(CRYPTO_SESSION_NOT_INITIALIZED);
|
||||
RETURN_IF_NULL(srm_version, PARAMETER_NULL);
|
||||
|
||||
OEMCryptoResult status;
|
||||
WithOecReadLock("GetSrmVersion", [&] {
|
||||
status = OEMCrypto_GetCurrentSRMVersion(srm_version);
|
||||
const OEMCryptoResult status = WithOecReadLock("GetSrmVersion", [&] {
|
||||
return OEMCrypto_GetCurrentSRMVersion(srm_version);
|
||||
});
|
||||
|
||||
// SRM is an optional feature. Whether it is implemented is up to the
|
||||
// discretion of OEMs
|
||||
if (status == OEMCrypto_ERROR_NOT_IMPLEMENTED) {
|
||||
LOGV("OEMCrypto_GetCurrentSRMVersion not implemented");
|
||||
return NOT_IMPLEMENTED_ERROR;
|
||||
// discretion of OEMs. OEMs may implement this method, but SRM is not
|
||||
// required if there is only a local display, as such no SRM version
|
||||
// is available/reportable. |srm_version| is only set if SUCCESS is
|
||||
// returned.
|
||||
switch (status) {
|
||||
case OEMCrypto_SUCCESS:
|
||||
return NO_ERROR;
|
||||
case OEMCrypto_LOCAL_DISPLAY_ONLY:
|
||||
LOGD("No SRM: Local display only");
|
||||
return NO_SRM_VERSION;
|
||||
case OEMCrypto_ERROR_NOT_IMPLEMENTED:
|
||||
LOGD("No SRM: Not implemented");
|
||||
return NO_SRM_VERSION;
|
||||
default:
|
||||
return MapOEMCryptoResult(status, GET_SRM_VERSION_ERROR,
|
||||
"GetCurrentSRMVersion");
|
||||
}
|
||||
|
||||
return MapOEMCryptoResult(status, GET_SRM_VERSION_ERROR,
|
||||
"GetCurrentSRMVersion");
|
||||
}
|
||||
|
||||
bool CryptoSession::IsSrmUpdateSupported() {
|
||||
LOGV("Checking if SRM update is supported");
|
||||
if (!IsInitialized()) return false;
|
||||
RETURN_IF_UNINITIALIZED(false);
|
||||
return WithOecReadLock("IsSrmUpdateSupported",
|
||||
[&] { return OEMCrypto_IsSRMUpdateSupported(); });
|
||||
}
|
||||
@@ -1944,10 +1952,9 @@ CdmResponseType CryptoSession::LoadSrm(const std::string& srm) {
|
||||
return INVALID_SRM_LIST;
|
||||
}
|
||||
|
||||
OEMCryptoResult status;
|
||||
WithOecWriteLock("LoadSrm", [&] {
|
||||
status = OEMCrypto_LoadSRM(reinterpret_cast<const uint8_t*>(srm.data()),
|
||||
srm.size());
|
||||
const OEMCryptoResult status = WithOecWriteLock("LoadSrm", [&] {
|
||||
return OEMCrypto_LoadSRM(reinterpret_cast<const uint8_t*>(srm.data()),
|
||||
srm.size());
|
||||
});
|
||||
|
||||
return MapOEMCryptoResult(status, LOAD_SRM_ERROR, "LoadSRM");
|
||||
|
||||
Reference in New Issue
Block a user