Merge "openSession_1_1 should return error for wrong security level" into rvc-dev am: fae5d3f7a9 am: a352d99c43 am: 3550602f92
Change-Id: I0d6d8c3f65d6fa3143bb28d58c9c170cdedea13d
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ TEST_F(WVDrmPluginTest, OpensSessions_1_1) {
|
||||
|
||||
plugin.openSession_1_1(android::hardware::drm::V1_1::SecurityLevel::SW_SECURE_CRYPTO,
|
||||
[&](Status status, hidl_vec<uint8_t> hSessionId) {
|
||||
ASSERT_EQ(Status::OK, status);
|
||||
ASSERT_EQ(Status::ERROR_DRM_INVALID_STATE, status);
|
||||
sessionId.clear();
|
||||
sessionId.assign(hSessionId.data(), hSessionId.data() + hSessionId.size());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user