Fix some vendor-specific error reporting

Some decryption errors were being reported as
vendor-unique diagnostic codes that were not generally
actionable by an app.  Recently a new
MediaCodec.CryptoException code was added so these types
of failures can be reported as ERROR_UNSUPPORTED_OPERATION,
in which case the app can use an alternate DRM
configuration in a way that does not require
vendor-specific handling. This change remaps this class
of decrypt errors to the new error code.

Merge of http://go/wvgerrit/17110

bug: 25929554
Change-Id: Iff44c2f04f9ee28d065fb17d59bca4032c5d55ca
This commit is contained in:
Jeff Tinker
2016-03-11 08:57:58 -08:00
parent 6a10503b61
commit 65ed606872
5 changed files with 28 additions and 1 deletions

View File

@@ -215,7 +215,8 @@ enum CdmResponseType {
LOAD_USAGE_INFO_MISSING,
SESSION_FILE_HANDLE_INIT_ERROR,
INCORRECT_CRYPTO_MODE,
INVALID_PARAMETERS_ENG_5
INVALID_PARAMETERS_ENG_5,
DECRYPT_ERROR
};
enum CdmKeyStatus {

View File

@@ -710,6 +710,11 @@ CdmResponseType CryptoSession::Decrypt(const CdmDecryptionParameters& params) {
return INSUFFICIENT_CRYPTO_RESOURCES;
case OEMCrypto_ERROR_KEY_EXPIRED:
return NEED_KEY;
case OEMCrypto_ERROR_INVALID_SESSION:
return SESSION_NOT_FOUND_FOR_DECRYPT;
case OEMCrypto_ERROR_DECRYPT_FAILED:
case OEMCrypto_ERROR_UNKNOWN_FAILURE:
return DECRYPT_ERROR;
default:
return UNKNOWN_ERROR;
}

View File

@@ -332,11 +332,15 @@ void PrintTo(const enum CdmResponseType& value, ::std::ostream* os) {
case EMPTY_LICENSE_REQUEST: *os << "EMPTY_LICENSE_REQUEST";
break;
case DUPLICATE_SESSION_ID_SPECIFIED: *os << "DUPLICATE_SESSION_ID_SPECIFIED";
break;
case LICENSE_RENEWAL_PROHIBITED: *os << "LICENSE_RENEWAL_PROHIBITED";
break;
case SESSION_FILE_HANDLE_INIT_ERROR: *os << "SESSION_FILE_HANDLE_INIT_ERROR";
break;
case INCORRECT_CRYPTO_MODE: *os << "INCORRECT_CRYPTO_MODE";
break;
case DECRYPT_ERROR: *os << "DECRYPT_ERROR";
break;
default:
*os << "Unknown CdmResponseType";
break;