Squashed merge 3 CLs.
1. "Change CdmResponseType from enum into a struct" Merged from http://go/wvgerrit/163199 Bug: 253271674 2. "Log request information when server returns 401" Bug: 260760387 Bug: 186031735 Merged from http://go/wvgerrit/162798 3. "Specify server version on the command line" Bug: 251599048 Merged from http://go/wvgerrit/158897 Test: build android.hardware.drm-service.widevine Test: Netflix and Play Movies & TV Test: build_and_run_all_unit_tests.sh Bug: 253271674 Change-Id: I70c950acce070609ee0343920ec68e66b058bc23
This commit is contained in:
@@ -122,7 +122,7 @@ class CdmEngineMetricsImpl : public T {
|
||||
CdmKeySetId* key_set_id) override {
|
||||
if (license_type == nullptr) {
|
||||
LOGE("|license_type| cannot be null");
|
||||
return PARAMETER_NULL;
|
||||
return CdmResponseType(PARAMETER_NULL);
|
||||
}
|
||||
|
||||
CdmResponseType sts;
|
||||
|
||||
@@ -50,7 +50,7 @@ enum CdmOfflineLicenseState : int32_t {
|
||||
kLicenseStateUnknown,
|
||||
};
|
||||
|
||||
enum CdmResponseType : int32_t {
|
||||
enum CdmResponseEnum : int32_t {
|
||||
NO_ERROR = 0,
|
||||
UNKNOWN_ERROR = 1,
|
||||
KEY_ADDED = 2,
|
||||
@@ -447,6 +447,41 @@ enum CdmResponseType : int32_t {
|
||||
// * android/include/mapErrors-inl.h
|
||||
};
|
||||
|
||||
struct CdmResponseType {
|
||||
CdmResponseType() : status_(NO_ERROR){};
|
||||
explicit CdmResponseType(CdmResponseEnum status) : status_(status){};
|
||||
explicit operator CdmResponseEnum() const { return status_; };
|
||||
explicit operator std::string() {
|
||||
std::string str = "status = ";
|
||||
str.append(std::to_string(static_cast<int>(status_)));
|
||||
return str;
|
||||
}
|
||||
CdmResponseEnum Enum() const { return status_; };
|
||||
constexpr explicit operator int() const { return status_; };
|
||||
bool operator==(CdmResponseEnum other) const { return status_ == other; }
|
||||
bool operator!=(CdmResponseEnum other) const { return status_ != other; }
|
||||
bool operator==(const CdmResponseType& other) const {
|
||||
return status_ == other.Enum();
|
||||
}
|
||||
bool operator!=(const CdmResponseType& other) const {
|
||||
return status_ != other.Enum();
|
||||
}
|
||||
|
||||
private:
|
||||
CdmResponseEnum status_;
|
||||
// CORE_DISALLOW_COPY_AND_ASSIGN(CdmResponseType);
|
||||
};
|
||||
|
||||
static inline bool operator==(const CdmResponseEnum lhs,
|
||||
const CdmResponseType& rhs) {
|
||||
return lhs == rhs.Enum();
|
||||
}
|
||||
|
||||
static inline bool operator!=(const CdmResponseEnum lhs,
|
||||
const CdmResponseType& rhs) {
|
||||
return !(lhs == rhs.Enum());
|
||||
}
|
||||
|
||||
enum CdmKeyStatus : int32_t {
|
||||
kKeyStatusKeyUnknown,
|
||||
kKeyStatusUsable,
|
||||
@@ -843,7 +878,7 @@ const char* CdmClientTokenTypeToString(CdmClientTokenType type);
|
||||
const char* CdmLicenseTypeToString(CdmLicenseType license_type);
|
||||
const char* CdmOfflineLicenseStateToString(
|
||||
CdmOfflineLicenseState license_state);
|
||||
const char* CdmResponseTypeToString(CdmResponseType cdm_response_type);
|
||||
const char* CdmResponseEnumToString(CdmResponseEnum cdm_response_enum);
|
||||
const char* CdmSecurityLevelToString(CdmSecurityLevel security_level);
|
||||
const char* CdmUsageEntryStorageTypeToString(CdmUsageEntryStorageType type);
|
||||
const char* RequestedSecurityLevelToString(
|
||||
|
||||
Reference in New Issue
Block a user