openSession_1_1 should return error for wrong security level
Currently, if requestedLevel is not the same as the current security level, openSession_1_1 still returns Status::OK, we should return an error status. Merged from http://go/wvgerrit/95507 Test: unit test adb shell LD_LIBRARY_PATH="/vendor/lib64" /data/nativetest/libwvdrmdrmplugin_hidl_test Bug: 150407669 Change-Id: I5673ac7bbe7a234ddd07bb9c145135486fb9e583
This commit is contained in:
@@ -333,13 +333,15 @@ Return<void> WVDrmPlugin::openSession_1_1(
|
||||
status = openSessionCommon(sessionId);
|
||||
hidl_vec<uint8_t> hSessionId = toHidlVec(sessionId);
|
||||
if (Status::OK == status) {
|
||||
SecurityLevel currentSecurityLevel = SecurityLevel::UNKNOWN;
|
||||
Return<void> hResult = getSecurityLevel(hSessionId, [&](Status status, SecurityLevel hSecurityLevel) {
|
||||
currentSecurityLevel = hSecurityLevel;
|
||||
if (Status::OK != status || requestedLevel != hSecurityLevel) {
|
||||
ALOGE("Failed to open session with the requested security level=%d", requestedLevel);
|
||||
if (Status::OK != closeSession(hSessionId)) sessionId.clear();
|
||||
}
|
||||
});
|
||||
if (!hResult.isOk()) {
|
||||
if (!hResult.isOk() || (requestedLevel != currentSecurityLevel)) {
|
||||
status = Status::ERROR_DRM_INVALID_STATE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user