Correct exception returned after RemoveKeys is called.

[ Merge of http://go/wvgerrit/47065 ]

RemoveKeys now resets associated crypto and policy resources,
rather than just closing the crypto session. This results in a
MediaCodec.CryptoException with error code ERROR_NO_KEY
rather than ERROR_SESSION_NOT_OPENED, if decrypt is called
afterwards.

Error SESSION_NOT_FOUND_FOR_DECRYPT is made unique. Error codes
were also synchonized between various branches in the widevine repo.

Bug: 77304819
Test: WV unit/integration tests, VtsHalDrmV1_0Target tests
Change-Id: I6cba2a3e1ce466d58c7727cde2d8f81d9503d655
This commit is contained in:
Rahul Frias
2018-04-07 02:05:07 -07:00
parent f0cd22d4f4
commit d102f8a4d2
11 changed files with 89 additions and 15 deletions

View File

@@ -27,6 +27,7 @@ static Status mapCdmResponseType(wvcdm::CdmResponseType res) {
case wvcdm::DECRYPT_NOT_READY:
case wvcdm::KEY_NOT_FOUND_IN_SESSION:
case wvcdm::NEED_KEY:
case wvcdm::NO_MATCHING_ENTITLEMENT_KEY:
return Status::ERROR_DRM_NO_LICENSE;
case wvcdm::NEED_PROVISIONING:
@@ -53,6 +54,8 @@ static Status mapCdmResponseType(wvcdm::CdmResponseType res) {
case wvcdm::SESSION_NOT_FOUND_8:
case wvcdm::SESSION_NOT_FOUND_9:
case wvcdm::SESSION_NOT_FOUND_10:
case wvcdm::SESSION_NOT_FOUND_17:
case wvcdm::SESSION_NOT_FOUND_18:
return Status::ERROR_DRM_SESSION_NOT_OPENED;
case wvcdm::DECRYPT_ERROR:
@@ -290,6 +293,9 @@ static Status mapCdmResponseType(wvcdm::CdmResponseType res) {
case wvcdm::REMOVE_USAGE_INFO_ERROR_1:
case wvcdm::REMOVE_USAGE_INFO_ERROR_2:
case wvcdm::REMOVE_USAGE_INFO_ERROR_3:
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES_6:
case wvcdm::NOT_AN_ENTITLEMENT_SESSION:
case wvcdm::LOAD_ENTITLED_CONTENT_KEYS_ERROR:
case wvcdm::GET_PROVISIONING_METHOD_ERROR:
ALOGW("Returns UNKNOWN error for legacy status: %d", res);
return Status::ERROR_DRM_UNKNOWN;