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:
@@ -215,7 +215,8 @@ enum CdmResponseType {
|
|||||||
LOAD_USAGE_INFO_MISSING,
|
LOAD_USAGE_INFO_MISSING,
|
||||||
SESSION_FILE_HANDLE_INIT_ERROR,
|
SESSION_FILE_HANDLE_INIT_ERROR,
|
||||||
INCORRECT_CRYPTO_MODE,
|
INCORRECT_CRYPTO_MODE,
|
||||||
INVALID_PARAMETERS_ENG_5
|
INVALID_PARAMETERS_ENG_5,
|
||||||
|
DECRYPT_ERROR
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CdmKeyStatus {
|
enum CdmKeyStatus {
|
||||||
|
|||||||
@@ -710,6 +710,11 @@ CdmResponseType CryptoSession::Decrypt(const CdmDecryptionParameters& params) {
|
|||||||
return INSUFFICIENT_CRYPTO_RESOURCES;
|
return INSUFFICIENT_CRYPTO_RESOURCES;
|
||||||
case OEMCrypto_ERROR_KEY_EXPIRED:
|
case OEMCrypto_ERROR_KEY_EXPIRED:
|
||||||
return NEED_KEY;
|
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:
|
default:
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -332,11 +332,15 @@ void PrintTo(const enum CdmResponseType& value, ::std::ostream* os) {
|
|||||||
case EMPTY_LICENSE_REQUEST: *os << "EMPTY_LICENSE_REQUEST";
|
case EMPTY_LICENSE_REQUEST: *os << "EMPTY_LICENSE_REQUEST";
|
||||||
break;
|
break;
|
||||||
case DUPLICATE_SESSION_ID_SPECIFIED: *os << "DUPLICATE_SESSION_ID_SPECIFIED";
|
case DUPLICATE_SESSION_ID_SPECIFIED: *os << "DUPLICATE_SESSION_ID_SPECIFIED";
|
||||||
|
break;
|
||||||
case LICENSE_RENEWAL_PROHIBITED: *os << "LICENSE_RENEWAL_PROHIBITED";
|
case LICENSE_RENEWAL_PROHIBITED: *os << "LICENSE_RENEWAL_PROHIBITED";
|
||||||
|
break;
|
||||||
case SESSION_FILE_HANDLE_INIT_ERROR: *os << "SESSION_FILE_HANDLE_INIT_ERROR";
|
case SESSION_FILE_HANDLE_INIT_ERROR: *os << "SESSION_FILE_HANDLE_INIT_ERROR";
|
||||||
break;
|
break;
|
||||||
case INCORRECT_CRYPTO_MODE: *os << "INCORRECT_CRYPTO_MODE";
|
case INCORRECT_CRYPTO_MODE: *os << "INCORRECT_CRYPTO_MODE";
|
||||||
break;
|
break;
|
||||||
|
case DECRYPT_ERROR: *os << "DECRYPT_ERROR";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
*os << "Unknown CdmResponseType";
|
*os << "Unknown CdmResponseType";
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -359,6 +359,8 @@ static android::status_t mapCdmResponseType(wvcdm::CdmResponseType res) {
|
|||||||
return android::ERROR_DRM_UNKNOWN;
|
return android::ERROR_DRM_UNKNOWN;
|
||||||
case wvcdm::SECURE_BUFFER_REQUIRED:
|
case wvcdm::SECURE_BUFFER_REQUIRED:
|
||||||
return android::ERROR_DRM_CANNOT_HANDLE;
|
return android::ERROR_DRM_CANNOT_HANDLE;
|
||||||
|
case wvcdm::DECRYPT_ERROR:
|
||||||
|
return android::ERROR_DRM_CANNOT_HANDLE;
|
||||||
case wvcdm::UNUSED_1:
|
case wvcdm::UNUSED_1:
|
||||||
case wvcdm::UNUSED_2:
|
case wvcdm::UNUSED_2:
|
||||||
case wvcdm::UNUSED_3:
|
case wvcdm::UNUSED_3:
|
||||||
|
|||||||
@@ -212,6 +212,11 @@ ssize_t WVCryptoPlugin::decrypt(bool secure, const uint8_t key[KEY_ID_SIZE],
|
|||||||
"Error decrypting data: session not found, possibly reclaimed");
|
"Error decrypting data: session not found, possibly reclaimed");
|
||||||
// This error is actionable by the app and should be passed up.
|
// This error is actionable by the app and should be passed up.
|
||||||
return mapCdmResponseType(res);
|
return mapCdmResponseType(res);
|
||||||
|
} else if (res == wvcdm::DECRYPT_ERROR) {
|
||||||
|
errorDetailMsg->setTo(
|
||||||
|
"Error decrypting data: unspecified error");
|
||||||
|
// This error is actionable by the app and should be passed up.
|
||||||
|
return mapCdmResponseType(res);
|
||||||
} else {
|
} else {
|
||||||
// Swallow the specifics of other errors to obscure decrypt internals.
|
// Swallow the specifics of other errors to obscure decrypt internals.
|
||||||
return kErrorCDMGeneric;
|
return kErrorCDMGeneric;
|
||||||
@@ -253,6 +258,16 @@ ssize_t WVCryptoPlugin::decrypt(bool secure, const uint8_t key[KEY_ID_SIZE],
|
|||||||
"Error decrypting data: requested key has not been loaded");
|
"Error decrypting data: requested key has not been loaded");
|
||||||
// This error is actionable by the app and should be passed up.
|
// This error is actionable by the app and should be passed up.
|
||||||
return mapCdmResponseType(res);
|
return mapCdmResponseType(res);
|
||||||
|
} else if (res == wvcdm::SESSION_NOT_FOUND_FOR_DECRYPT) {
|
||||||
|
errorDetailMsg->setTo(
|
||||||
|
"Error decrypting data: session not found, possibly reclaimed");
|
||||||
|
// This error is actionable by the app and should be passed up.
|
||||||
|
return mapCdmResponseType(res);
|
||||||
|
} else if (res == wvcdm::DECRYPT_ERROR) {
|
||||||
|
errorDetailMsg->setTo(
|
||||||
|
"Error decrypting data: unspecified error");
|
||||||
|
// This error is actionable by the app and should be passed up.
|
||||||
|
return mapCdmResponseType(res);
|
||||||
} else {
|
} else {
|
||||||
// Swallow the specifics of other errors to obscure decrypt internals.
|
// Swallow the specifics of other errors to obscure decrypt internals.
|
||||||
return kErrorCDMGeneric;
|
return kErrorCDMGeneric;
|
||||||
|
|||||||
Reference in New Issue
Block a user