wv aidl: no set security level opening default session
Bug: 219538389 Test: atest WidevineDashPolicyTests#testL3ValidateKeyOutputProtection Change-Id: I5912a93fd0b7a144694ec3b251a129d839b8b149
This commit is contained in:
@@ -263,6 +263,11 @@ SecurityLevel WVDrmPlugin::mapSecurityLevel(const std::string& level) {
|
|||||||
::ndk::ScopedAStatus WVDrmPlugin::openSession(SecurityLevel in_securityLevel,
|
::ndk::ScopedAStatus WVDrmPlugin::openSession(SecurityLevel in_securityLevel,
|
||||||
vector<uint8_t>* _aidl_return) {
|
vector<uint8_t>* _aidl_return) {
|
||||||
vector<uint8_t> sessionId;
|
vector<uint8_t> sessionId;
|
||||||
|
if (SecurityLevel::DEFAULT == in_securityLevel) {
|
||||||
|
auto err = openSessionCommon(sessionId);
|
||||||
|
*_aidl_return = sessionId;
|
||||||
|
return toNdkScopedAStatus(err);
|
||||||
|
}
|
||||||
|
|
||||||
if (SecurityLevel::UNKNOWN == in_securityLevel) {
|
if (SecurityLevel::UNKNOWN == in_securityLevel) {
|
||||||
*_aidl_return = sessionId;
|
*_aidl_return = sessionId;
|
||||||
@@ -279,8 +284,7 @@ SecurityLevel WVDrmPlugin::mapSecurityLevel(const std::string& level) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (wvcdm::QUERY_VALUE_SECURITY_LEVEL_L3 == native_security_level &&
|
if (wvcdm::QUERY_VALUE_SECURITY_LEVEL_L3 == native_security_level &&
|
||||||
in_securityLevel >= SecurityLevel::SW_SECURE_DECODE &&
|
in_securityLevel >= SecurityLevel::SW_SECURE_DECODE) {
|
||||||
in_securityLevel != SecurityLevel::DEFAULT) {
|
|
||||||
*_aidl_return = sessionId;
|
*_aidl_return = sessionId;
|
||||||
return toNdkScopedAStatus(Status::ERROR_DRM_CANNOT_HANDLE);
|
return toNdkScopedAStatus(Status::ERROR_DRM_CANNOT_HANDLE);
|
||||||
}
|
}
|
||||||
@@ -292,25 +296,13 @@ SecurityLevel WVDrmPlugin::mapSecurityLevel(const std::string& level) {
|
|||||||
|
|
||||||
setPropertyString("securityLevel", std::string(wvcdm_security_level));
|
setPropertyString("securityLevel", std::string(wvcdm_security_level));
|
||||||
|
|
||||||
SecurityLevel securityLevel = in_securityLevel;
|
|
||||||
if (SecurityLevel::DEFAULT == in_securityLevel) {
|
|
||||||
std::string level;
|
|
||||||
Status status = queryProperty(wvcdm::kLevelDefault,
|
|
||||||
wvcdm::QUERY_KEY_SECURITY_LEVEL, level);
|
|
||||||
if (status == Status::OK) {
|
|
||||||
securityLevel = mapSecurityLevel(level);
|
|
||||||
} else {
|
|
||||||
ALOGE("openSession: failed to query security level, status=%d", status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
status = openSessionCommon(sessionId);
|
status = openSessionCommon(sessionId);
|
||||||
if (Status::OK == status) {
|
if (Status::OK == status) {
|
||||||
SecurityLevel currentSecurityLevel = SecurityLevel::UNKNOWN;
|
SecurityLevel currentSecurityLevel = SecurityLevel::UNKNOWN;
|
||||||
const auto ret = getSecurityLevel(sessionId, ¤tSecurityLevel);
|
const auto ret = getSecurityLevel(sessionId, ¤tSecurityLevel);
|
||||||
if (!ret.isOk() || securityLevel != currentSecurityLevel) {
|
if (!ret.isOk() || in_securityLevel != currentSecurityLevel) {
|
||||||
ALOGE("Failed to open session with the requested security level=%d",
|
ALOGE("Failed to open session with the requested security level=%d",
|
||||||
securityLevel);
|
in_securityLevel);
|
||||||
closeSession(sessionId);
|
closeSession(sessionId);
|
||||||
sessionId.clear();
|
sessionId.clear();
|
||||||
status = Status::ERROR_DRM_INVALID_STATE;
|
status = Status::ERROR_DRM_INVALID_STATE;
|
||||||
|
|||||||
Reference in New Issue
Block a user