Add error detail metric to some session methods
[ Merge from http://go/wvgerrit/71726 ] Adds an error detail metric attribute to RestoreUsageSession and RestoreOfflineSession. These metrics will now report an additional attribute providing additional error detail for debugging. BUG: http://b/115517916 Test: CDM Unit Tests. Manually tried GPlay. Change-Id: Ib48361ef29d33a16150473d8967e4850bc0c623d
This commit is contained in:
@@ -22,6 +22,15 @@
|
||||
|
||||
namespace {
|
||||
const size_t kKeySetIdLength = 14;
|
||||
|
||||
// Helper function for setting the error detail value.
|
||||
void SetErrorDetail(wvcdm::CdmResponseType* error_detail,
|
||||
wvcdm::CdmResponseType error_code) {
|
||||
if (error_detail != nullptr) {
|
||||
*error_detail = error_code;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace wvcdm {
|
||||
@@ -200,7 +209,8 @@ CdmResponseType CdmSession::Init(CdmClientPropertySet* cdm_client_property_set,
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::RestoreOfflineSession(
|
||||
const CdmKeySetId& key_set_id, CdmLicenseType license_type) {
|
||||
const CdmKeySetId& key_set_id, CdmLicenseType license_type,
|
||||
CdmResponseType* error_detail) {
|
||||
if (!initialized_) {
|
||||
LOGE("CdmSession::RestoreOfflineSession: not initialized");
|
||||
return NOT_INITIALIZED_ERROR;
|
||||
@@ -272,6 +282,7 @@ CdmResponseType CdmSession::RestoreOfflineSession(
|
||||
license_parser_->RestoreLicenseForRelease(key_request_, key_response_);
|
||||
|
||||
if (result != NO_ERROR) {
|
||||
SetErrorDetail(error_detail, result);
|
||||
return RELEASE_LICENSE_ERROR_1;
|
||||
}
|
||||
} else {
|
||||
@@ -279,6 +290,7 @@ CdmResponseType CdmSession::RestoreOfflineSession(
|
||||
key_request_, key_response_, offline_key_renewal_response_,
|
||||
playback_start_time, last_playback_time, grace_period_end_time, this);
|
||||
if (result != NO_ERROR) {
|
||||
SetErrorDetail(error_detail, result);
|
||||
return RESTORE_OFFLINE_LICENSE_ERROR_2;
|
||||
}
|
||||
}
|
||||
@@ -308,7 +320,8 @@ CdmResponseType CdmSession::RestoreOfflineSession(
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::RestoreUsageSession(
|
||||
const DeviceFiles::CdmUsageData& usage_data) {
|
||||
const DeviceFiles::CdmUsageData& usage_data,
|
||||
CdmResponseType* error_detail) {
|
||||
if (!initialized_) {
|
||||
LOGE("CdmSession::RestoreUsageSession: not initialized");
|
||||
return NOT_INITIALIZED_ERROR;
|
||||
@@ -338,6 +351,7 @@ CdmResponseType CdmSession::RestoreUsageSession(
|
||||
sts = license_parser_->RestoreLicenseForRelease(key_request_, key_response_);
|
||||
|
||||
if (sts != NO_ERROR) {
|
||||
SetErrorDetail(error_detail, sts);
|
||||
return RELEASE_LICENSE_ERROR_2;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user