Add a static method to query security level
[ Merge of http://go/wvgerrit/70665 ] This allows one to be able to query for security level, from Crypto factory methods before the plugins and CdmEngine objects have been created. Bug: 117104043 Test: WV Unit/integration tests Change-Id: Id07f420c3cfb92166cd3bb3cf82148d52e10eb03
This commit is contained in:
@@ -815,6 +815,25 @@ CdmResponseType CdmEngine::QueryOemCryptoSessionId(
|
||||
return session->QueryOemCryptoSessionId(query_response);
|
||||
}
|
||||
|
||||
bool CdmEngine::IsSecurityLevelSupported(CdmSecurityLevel level) {
|
||||
LOGI("CdmEngine::IsSecurityLevelSupported");
|
||||
metrics::CryptoMetrics alternate_crypto_metrics;
|
||||
std::unique_ptr<CryptoSession> crypto_session(
|
||||
CryptoSession::MakeCryptoSession(&alternate_crypto_metrics));
|
||||
|
||||
switch (level) {
|
||||
case kSecurityLevelL1:
|
||||
return
|
||||
crypto_session->GetSecurityLevel(kLevelDefault) == kSecurityLevelL1;
|
||||
case kSecurityLevelL3:
|
||||
return crypto_session->GetSecurityLevel(kLevel3) == kSecurityLevelL3;
|
||||
default:
|
||||
LOGE("CdmEngine::IsSecurityLevelSupported: Invalid security level: %d",
|
||||
level);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Composes a device provisioning request and output the request in JSON format
|
||||
* in *request. It also returns the default url for the provisioning server
|
||||
|
||||
Reference in New Issue
Block a user