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:
Adam Stone
2019-02-01 11:28:03 -08:00
parent 605ff83103
commit 5b49bf83a2
10 changed files with 79 additions and 59 deletions

View File

@@ -228,7 +228,7 @@ class CdmEngine {
// id. If |error_detail| is not null, an additional error code may be provided
// in the event of an error.
virtual CdmResponseType GetUsageInfo(const std::string& app_id,
CdmResponseType* error_detail,
int* error_detail,
CdmUsageInfo* usage_info);
// Retrieve the usage info for the specified pst.
@@ -237,7 +237,7 @@ class CdmEngine {
// in the event of an error.
virtual CdmResponseType GetUsageInfo(const std::string& app_id,
const CdmSecureStopId& ssid,
CdmResponseType* error_detail,
int* error_detail,
CdmUsageInfo* usage_info);
// Remove all usage records for the current origin.
@@ -363,7 +363,7 @@ class CdmEngine {
bool ValidateKeySystem(const CdmKeySystem& key_system);
CdmResponseType GetUsageInfo(const std::string& app_id,
SecurityLevel requested_security_level,
CdmResponseType* error_detail,
int* error_detail,
CdmUsageInfo* usage_info);
void OnKeyReleaseEvent(const CdmKeySetId& key_set_id);

View File

@@ -181,10 +181,10 @@ class CdmEngineMetricsImpl : public T {
}
CdmResponseType GetUsageInfo(const std::string& app_id,
CdmResponseType* error_detail,
int* error_detail,
CdmUsageInfo* usage_info) override {
CdmResponseType sts;
CdmResponseType error_detail_alt;
int error_detail_alt;
M_TIME(sts = T::GetUsageInfo(app_id, &error_detail_alt, usage_info),
metrics_, cdm_engine_get_usage_info_, sts, error_detail_alt);
if (error_detail != nullptr) {
@@ -196,10 +196,10 @@ class CdmEngineMetricsImpl : public T {
CdmResponseType GetUsageInfo(const std::string& app_id,
const CdmSecureStopId& ssid,
CdmResponseType* error_detail,
int* error_detail,
CdmUsageInfo* usage_info) override {
CdmResponseType sts;
CdmResponseType error_detail_alt;
int error_detail_alt;
M_TIME(sts = T::GetUsageInfo(app_id, ssid, &error_detail_alt, usage_info),
metrics_, cdm_engine_get_usage_info_, sts, error_detail_alt);
if (error_detail != nullptr) {

View File

@@ -60,12 +60,20 @@ class CdmSession {
const CdmSessionId* forced_session_id,
WvCdmEventListener* event_listener);
// Restores an offline session identified by the |key_set_id| and
// |license_type|. The |error_detail| will be filled with an internal error
// code. The |error_detail| may be a CdmResponseType or other error code type.
// It is only suitable for additional logging or debugging.
virtual CdmResponseType RestoreOfflineSession(
const CdmKeySetId& key_set_id, CdmLicenseType license_type,
CdmResponseType* error_detail);
int* error_detail);
// Restores an usage session from the provided |usage_data|.
// The |error_detail| will be filled with an internal error code. The
// |error_detail| may be a CdmResponseType or other error code type. It is
// only suitable for additional logging or debugging.
virtual CdmResponseType RestoreUsageSession(
const DeviceFiles::CdmUsageData& usage_data,
CdmResponseType* error_detail);
int* error_detail);
virtual const CdmSessionId& session_id() { return session_id_; }
virtual const CdmKeySetId& key_set_id() { return key_set_id_; }
@@ -209,7 +217,9 @@ class CdmSession {
bool GenerateKeySetId(CdmKeySetId* key_set_id);
CdmResponseType StoreLicense();
bool StoreLicense(DeviceFiles::LicenseState state);
bool StoreLicense(DeviceFiles::LicenseState state,
int* error_detail);
bool UpdateUsageInfo();

View File

@@ -30,24 +30,27 @@ class DeviceFiles {
kLicenseStateUnknown,
} LicenseState;
// All error response codes start with 5000 to avoid overlap with other error
// spaces.
enum ResponseType {
kNoError = 0,
kObjectNotInitialized = 1,
kParameterNull = 2,
kBasePathUnavailable = 3,
kFileNotFound = 4,
kFileOpenFailed = 5,
kFileWriteError = 6,
kFileReadError = 7,
kInvalidFileSize = 8,
kHashComputationFailed = 9,
kFileHashMismatch = 10,
kFileParseError1 = 11,
kFileParseError2 = 12,
kUnknownLicenseState = 13,
kIncorrectFileType = 14,
kIncorrectFileVersion = 15,
kLicenseNotPresent = 16,
kNoError = NO_ERROR,
kResponseTypeBase = 5000,
kObjectNotInitialized = kResponseTypeBase + 1,
kParameterNull = kResponseTypeBase + 2,
kBasePathUnavailable = kResponseTypeBase + 3,
kFileNotFound = kResponseTypeBase + 4,
kFileOpenFailed = kResponseTypeBase + 5,
kFileWriteError = kResponseTypeBase + 6,
kFileReadError = kResponseTypeBase + 7,
kInvalidFileSize = kResponseTypeBase + 8,
kHashComputationFailed = kResponseTypeBase + 9,
kFileHashMismatch = kResponseTypeBase + 10,
kFileParseError1 = kResponseTypeBase + 11,
kFileParseError2 = kResponseTypeBase + 12,
kUnknownLicenseState = kResponseTypeBase + 13,
kIncorrectFileType = kResponseTypeBase + 14,
kIncorrectFileVersion = kResponseTypeBase + 15,
kLicenseNotPresent = kResponseTypeBase + 16,
};
struct CdmUsageData {