Add device files error detail to metrics.
[ Merge from http://go/wvgerrit/71923 ] Plumb through the device files error detail and add the detail to metrics. Bug: http://b/115382201 Test: Unit tests, manual GPlay. Change-Id: I18139f6712b6670be5fed863a97f9f03440745c7
This commit is contained in:
@@ -24,8 +24,8 @@ namespace {
|
||||
const size_t kKeySetIdLength = 14;
|
||||
|
||||
// Helper function for setting the error detail value.
|
||||
void SetErrorDetail(wvcdm::CdmResponseType* error_detail,
|
||||
wvcdm::CdmResponseType error_code) {
|
||||
template<typename T>
|
||||
void SetErrorDetail(int* error_detail, T error_code) {
|
||||
if (error_detail != nullptr) {
|
||||
*error_detail = error_code;
|
||||
}
|
||||
@@ -210,7 +210,7 @@ CdmResponseType CdmSession::Init(CdmClientPropertySet* cdm_client_property_set,
|
||||
|
||||
CdmResponseType CdmSession::RestoreOfflineSession(
|
||||
const CdmKeySetId& key_set_id, CdmLicenseType license_type,
|
||||
CdmResponseType* error_detail) {
|
||||
int* error_detail) {
|
||||
if (!initialized_) {
|
||||
LOGE("CdmSession::RestoreOfflineSession: not initialized");
|
||||
return NOT_INITIALIZED_ERROR;
|
||||
@@ -237,6 +237,7 @@ CdmResponseType CdmSession::RestoreOfflineSession(
|
||||
"CdmSession::RestoreOfflineSession: failed to retrieve license. "
|
||||
"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;
|
||||
}
|
||||
|
||||
@@ -306,7 +307,7 @@ CdmResponseType CdmSession::RestoreOfflineSession(
|
||||
sts);
|
||||
return sts;
|
||||
}
|
||||
if (!StoreLicense(license_state)) {
|
||||
if (!StoreLicense(license_state, error_detail)) {
|
||||
LOGW(
|
||||
"CdmSession::RestoreUsageSession: unable to save updated usage "
|
||||
"info");
|
||||
@@ -320,8 +321,7 @@ CdmResponseType CdmSession::RestoreOfflineSession(
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::RestoreUsageSession(
|
||||
const DeviceFiles::CdmUsageData& usage_data,
|
||||
CdmResponseType* error_detail) {
|
||||
const DeviceFiles::CdmUsageData& usage_data, int* error_detail) {
|
||||
if (!initialized_) {
|
||||
LOGE("CdmSession::RestoreUsageSession: not initialized");
|
||||
return NOT_INITIALIZED_ERROR;
|
||||
@@ -686,7 +686,8 @@ CdmResponseType CdmSession::RenewKey(const CdmKeyResponse& key_response) {
|
||||
|
||||
if (is_offline_) {
|
||||
offline_key_renewal_response_ = key_response;
|
||||
if (!StoreLicense(DeviceFiles::kLicenseStateActive))
|
||||
if (!StoreLicense(DeviceFiles::kLicenseStateActive,
|
||||
nullptr /* error_detail */))
|
||||
return RENEW_KEY_ERROR_2;
|
||||
}
|
||||
return KEY_ADDED;
|
||||
@@ -721,7 +722,7 @@ CdmResponseType CdmSession::GenerateReleaseRequest(CdmKeyRequest* key_request) {
|
||||
}
|
||||
|
||||
if (is_offline_) { // Mark license as being released
|
||||
if (!StoreLicense(DeviceFiles::kLicenseStateReleasing))
|
||||
if (!StoreLicense(DeviceFiles::kLicenseStateReleasing, nullptr))
|
||||
return RELEASE_KEY_REQUEST_ERROR;
|
||||
} else if (!usage_provider_session_token_.empty()) {
|
||||
if (usage_support_type_ == kUsageEntrySupport) {
|
||||
@@ -846,7 +847,7 @@ CdmResponseType CdmSession::StoreLicense() {
|
||||
return OFFLINE_LICENSE_PROHIBITED;
|
||||
}
|
||||
|
||||
if (!StoreLicense(DeviceFiles::kLicenseStateActive)) {
|
||||
if (!StoreLicense(DeviceFiles::kLicenseStateActive, nullptr)) {
|
||||
LOGE("CdmSession::StoreLicense: Unable to store license");
|
||||
return STORE_LICENSE_ERROR_1;
|
||||
}
|
||||
@@ -891,15 +892,20 @@ CdmResponseType CdmSession::StoreLicense() {
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
bool CdmSession::StoreLicense(DeviceFiles::LicenseState state) {
|
||||
DeviceFiles::ResponseType sub_error_code = DeviceFiles::kNoError;
|
||||
return file_handle_->StoreLicense(
|
||||
bool CdmSession::StoreLicense(DeviceFiles::LicenseState state,
|
||||
int* error_detail) {
|
||||
DeviceFiles::ResponseType error_detail_alt = DeviceFiles::kNoError;
|
||||
bool result = file_handle_->StoreLicense(
|
||||
key_set_id_, state, offline_init_data_, key_request_, key_response_,
|
||||
offline_key_renewal_request_, offline_key_renewal_response_,
|
||||
offline_release_server_url_, policy_engine_->GetPlaybackStartTime(),
|
||||
policy_engine_->GetLastPlaybackTime(),
|
||||
policy_engine_->GetGracePeriodEndTime(), app_parameters_, usage_entry_,
|
||||
usage_entry_number_, &sub_error_code);
|
||||
usage_entry_number_, &error_detail_alt);
|
||||
if (error_detail != nullptr) {
|
||||
*error_detail = error_detail_alt;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::RemoveKeys() {
|
||||
@@ -953,7 +959,7 @@ void CdmSession::OnTimerEvent(bool update_usage) {
|
||||
policy_engine_->DecryptionEvent();
|
||||
has_decrypted_since_last_report_ = false;
|
||||
if (is_offline_ && !is_release_) {
|
||||
StoreLicense(DeviceFiles::kLicenseStateActive);
|
||||
StoreLicense(DeviceFiles::kLicenseStateActive, nullptr);
|
||||
}
|
||||
}
|
||||
policy_engine_->OnTimerEvent();
|
||||
@@ -1030,7 +1036,7 @@ CdmResponseType CdmSession::UpdateUsageEntryInformation() {
|
||||
|
||||
if (is_offline_)
|
||||
StoreLicense(is_release_ ? DeviceFiles::kLicenseStateReleasing
|
||||
: DeviceFiles::kLicenseStateActive);
|
||||
: DeviceFiles::kLicenseStateActive, nullptr);
|
||||
else if (!usage_provider_session_token_.empty())
|
||||
UpdateUsageInfo();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user