Merge "Corrections when releasing usage information" into oc-mr1-dev am: d355e505c7

am: 637a4d10ad

Change-Id: I4e940aee5361db310d617ab1fcbb17cbb9569a62
This commit is contained in:
Rahul Frias
2017-09-07 18:11:08 +00:00
committed by android-build-merger
7 changed files with 37 additions and 17 deletions

View File

@@ -312,6 +312,7 @@ enum CdmResponseType {
PARSE_RESPONSE_ERROR_2, PARSE_RESPONSE_ERROR_2,
PARSE_RESPONSE_ERROR_3, /* 270 */ PARSE_RESPONSE_ERROR_3, /* 270 */
PARSE_RESPONSE_ERROR_4, PARSE_RESPONSE_ERROR_4,
RELEASE_ALL_USAGE_INFO_ERROR_6,
}; };
enum CdmKeyStatus { enum CdmKeyStatus {

View File

@@ -1135,19 +1135,32 @@ CdmResponseType CdmEngine::ReleaseAllUsageInfo(const std::string& app_id) {
if (usage_session_->get_usage_support_type() == kUsageEntrySupport) { if (usage_session_->get_usage_support_type() == kUsageEntrySupport) {
std::vector<DeviceFiles::CdmUsageData> usage_data; std::vector<DeviceFiles::CdmUsageData> usage_data;
if (!handle.RetrieveUsageInfo( // Retrieve all usage information but delete only one before
DeviceFiles::GetUsageInfoFileName(app_id), // refetching. This is because deleting the usage entry
&usage_data)) { // might cause other entries to be shifted and information updated.
status = RELEASE_ALL_USAGE_INFO_ERROR_4; do {
} else { if (!handle.RetrieveUsageInfo(
for (size_t k = 0; k < usage_data.size(); ++k) { DeviceFiles::GetUsageInfoFileName(app_id),
CdmResponseType status2 = &usage_data)) {
usage_session_->DeleteUsageEntry( status = RELEASE_ALL_USAGE_INFO_ERROR_4;
usage_data[k].usage_entry_number); break;
if (status == NO_ERROR && status2 != NO_ERROR)
status = status2;
} }
}
if (usage_data.empty()) break;
status = usage_session_->DeleteUsageEntry(
usage_data[0].usage_entry_number);
if (status != NO_ERROR) break;
if (!handle.DeleteUsageInfo(
DeviceFiles::GetUsageInfoFileName(app_id),
usage_data[0].provider_session_token)) {
status = RELEASE_ALL_USAGE_INFO_ERROR_6;
break;
}
} while (status == NO_ERROR && !usage_data.empty());
std::vector<std::string> provider_session_tokens; std::vector<std::string> provider_session_tokens;
if (!handle.DeleteAllUsageInfoForApp( if (!handle.DeleteAllUsageInfoForApp(
DeviceFiles::GetUsageInfoFileName(app_id), DeviceFiles::GetUsageInfoFileName(app_id),

View File

@@ -686,8 +686,7 @@ CdmResponseType CdmSession::ReleaseKey(const CdmKeyResponse& key_response) {
} }
CdmResponseType CdmSession::DeleteUsageEntry(uint32_t usage_entry_number) { CdmResponseType CdmSession::DeleteUsageEntry(uint32_t usage_entry_number) {
if (usage_support_type_ != kUsageEntrySupport || if (usage_support_type_ != kUsageEntrySupport) {
!has_provider_session_token()) {
LOGE("CdmSession::DeleteUsageEntry: Unexpected usage type supported: %d", LOGE("CdmSession::DeleteUsageEntry: Unexpected usage type supported: %d",
usage_support_type_); usage_support_type_);
return INCORRECT_USAGE_SUPPORT_TYPE_1; return INCORRECT_USAGE_SUPPORT_TYPE_1;
@@ -886,8 +885,8 @@ CdmResponseType CdmSession::UpdateUsageTableInformation() {
CdmResponseType CdmSession::UpdateUsageEntryInformation() { CdmResponseType CdmSession::UpdateUsageEntryInformation() {
if (usage_support_type_ != kUsageEntrySupport || if (usage_support_type_ != kUsageEntrySupport ||
!has_provider_session_token() && !has_provider_session_token() ||
usage_table_header_ != nullptr) { usage_table_header_ == nullptr) {
LOGE("CdmSession::UpdateUsageEntryInformation: Unexpected usage type " LOGE("CdmSession::UpdateUsageEntryInformation: Unexpected usage type "
"supported: %d", usage_support_type_); "supported: %d", usage_support_type_);
return INCORRECT_USAGE_SUPPORT_TYPE_2; return INCORRECT_USAGE_SUPPORT_TYPE_2;

View File

@@ -560,6 +560,9 @@ void PrintTo(const enum CdmResponseType& value, ::std::ostream* os) {
case RELEASE_ALL_USAGE_INFO_ERROR_5: case RELEASE_ALL_USAGE_INFO_ERROR_5:
*os << "RELEASE_ALL_USAGE_INFO_ERROR_5"; *os << "RELEASE_ALL_USAGE_INFO_ERROR_5";
break; break;
case RELEASE_ALL_USAGE_INFO_ERROR_6:
*os << "RELEASE_ALL_USAGE_INFO_ERROR_6";
break;
case RELEASE_USAGE_INFO_FAILED: *os << "RELEASE_USAGE_INFO_FAILED"; case RELEASE_USAGE_INFO_FAILED: *os << "RELEASE_USAGE_INFO_FAILED";
break; break;
case INCORRECT_USAGE_SUPPORT_TYPE_1: case INCORRECT_USAGE_SUPPORT_TYPE_1:

View File

@@ -274,10 +274,11 @@ enum {
kParseResponseError2 = ERROR_DRM_VENDOR_MIN + 261, kParseResponseError2 = ERROR_DRM_VENDOR_MIN + 261,
kParseResponseError3 = ERROR_DRM_VENDOR_MIN + 262, kParseResponseError3 = ERROR_DRM_VENDOR_MIN + 262,
kParseResponseError4 = ERROR_DRM_VENDOR_MIN + 263, kParseResponseError4 = ERROR_DRM_VENDOR_MIN + 263,
kReleaseAllUsageInfoError6 = ERROR_DRM_VENDOR_MIN + 264,
// This should always follow the last error code. // This should always follow the last error code.
// The offset value should be updated each time a new error code is added. // The offset value should be updated each time a new error code is added.
kErrorWVDrmMaxErrorUsed = ERROR_DRM_VENDOR_MIN + 263, kErrorWVDrmMaxErrorUsed = ERROR_DRM_VENDOR_MIN + 264,
// Used by crypto test mode // Used by crypto test mode
kErrorTestMode = ERROR_DRM_VENDOR_MAX, kErrorTestMode = ERROR_DRM_VENDOR_MAX,

View File

@@ -499,6 +499,8 @@ static android::status_t mapCdmResponseType(wvcdm::CdmResponseType res) {
return kReleaseAllUsageInfoError4; return kReleaseAllUsageInfoError4;
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_5: case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_5:
return kReleaseAllUsageInfoError5; return kReleaseAllUsageInfoError5;
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_6:
return kReleaseAllUsageInfoError6;
case wvcdm::RELEASE_USAGE_INFO_FAILED: case wvcdm::RELEASE_USAGE_INFO_FAILED:
return android::ERROR_DRM_TAMPER_DETECTED; return android::ERROR_DRM_TAMPER_DETECTED;
case wvcdm::INCORRECT_USAGE_SUPPORT_TYPE_1: case wvcdm::INCORRECT_USAGE_SUPPORT_TYPE_1:

View File

@@ -286,6 +286,7 @@ static Status mapCdmResponseType(wvcdm::CdmResponseType res) {
case wvcdm::USAGE_INVALID_LOAD_ENTRY: case wvcdm::USAGE_INVALID_LOAD_ENTRY:
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_4: case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_4:
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_5: case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_5:
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_6:
case wvcdm::INCORRECT_USAGE_SUPPORT_TYPE_1: case wvcdm::INCORRECT_USAGE_SUPPORT_TYPE_1:
case wvcdm::INCORRECT_USAGE_SUPPORT_TYPE_2: case wvcdm::INCORRECT_USAGE_SUPPORT_TYPE_2:
case wvcdm::NO_USAGE_ENTRIES: case wvcdm::NO_USAGE_ENTRIES: