hidl: return BAD_VALUE from RemoveOfflineLicense when keyset is not found
Bug: 127828539 Test: VtsHalDrmV1_2TargetTest Change-Id: Ia567be076a9460546c59c2a38231e18bb0549ce3
This commit is contained in:
@@ -395,6 +395,7 @@ enum CdmResponseType {
|
||||
REWRAP_DEVICE_RSA_KEY_ERROR = 344,
|
||||
REWRAP_DEVICE_RSA_KEY_30_ERROR = 345,
|
||||
INVALID_SRM_LIST = 346,
|
||||
KEYSET_ID_NOT_FOUND_4 = 347,
|
||||
// Don't forget to add new values to ../test/test_printers.cpp.
|
||||
};
|
||||
|
||||
|
||||
@@ -238,7 +238,9 @@ CdmResponseType CdmSession::RestoreOfflineSession(
|
||||
"sub error: %d, key set id = %s",
|
||||
sub_error_code, key_set_id.c_str());
|
||||
SetErrorDetail(error_detail, sub_error_code);
|
||||
return GET_LICENSE_ERROR;
|
||||
return sub_error_code == DeviceFiles::kFileNotFound
|
||||
? KEYSET_ID_NOT_FOUND_4
|
||||
: GET_LICENSE_ERROR;
|
||||
}
|
||||
|
||||
// Attempts to restore a released offline license are treated as a release
|
||||
|
||||
@@ -247,6 +247,9 @@ void PrintTo(const enum CdmResponseType& value, ::std::ostream* os) {
|
||||
case KEYSET_ID_NOT_FOUND_3:
|
||||
*os << "KEYSET_ID_NOT_FOUND_3";
|
||||
break;
|
||||
case KEYSET_ID_NOT_FOUND_4:
|
||||
*os << "KEYSET_ID_NOT_FOUND_4";
|
||||
break;
|
||||
case LICENSE_ID_NOT_FOUND:
|
||||
*os << "LICENSE_ID_NOT_FOUND";
|
||||
break;
|
||||
|
||||
@@ -354,6 +354,9 @@ static Status mapCdmResponseType(wvcdm::CdmResponseType res) {
|
||||
ALOGW("Returns UNKNOWN error for legacy status: %d", res);
|
||||
return Status::ERROR_DRM_UNKNOWN;
|
||||
|
||||
case wvcdm::KEYSET_ID_NOT_FOUND_4:
|
||||
return Status::BAD_VALUE;
|
||||
|
||||
case wvcdm::UNKNOWN_ERROR:
|
||||
return Status::ERROR_DRM_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -1159,11 +1159,7 @@ Return<Status> WVDrmPlugin::removeOfflineLicense(const KeySetId &keySetId) {
|
||||
std::string(keySetId.begin(), keySetId.end()),
|
||||
wvcdm::kSecurityLevelL3,
|
||||
identifier);
|
||||
if (isCdmResponseTypeSuccess(res)) {
|
||||
status = Status::OK;
|
||||
} else {
|
||||
status = Status::ERROR_DRM_INVALID_STATE;
|
||||
}
|
||||
status = mapCdmResponseType(res);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
Reference in New Issue
Block a user