Only one function for reporting usage support.
[ Merge of http://go/wvgerrit/121567 ] Replaced the two usage support functions GetUsageSupportType() and UsageInformationSupport() into a single function HasUsageInfoSupport(). Since moving to only supporting a single usage info system (usage table header + usage entries), the different usage support functions have lost their purpose. One version of the method works on an open session and will use a cached value of the property if previously set. The other can be called without opening the session (as used for query calls). This is part of larger fix for the usage table initialization process. Bug: 169195093 Test: CE CDM unit tests Change-Id: I637c24dd143e995dbb0f8848850e3c71ff1018eb
This commit is contained in:
@@ -160,8 +160,8 @@ class CdmSession {
|
||||
license_parser_->provider_session_token().size() > 0);
|
||||
}
|
||||
|
||||
virtual CdmUsageSupportType get_usage_support_type() {
|
||||
return usage_support_type_;
|
||||
virtual bool supports_usage_info() const {
|
||||
return usage_table_header_ != nullptr;
|
||||
}
|
||||
|
||||
// This method will remove keys by resetting crypto resources and
|
||||
@@ -297,8 +297,9 @@ class CdmSession {
|
||||
// Usage related flags and data
|
||||
bool is_initial_usage_update_;
|
||||
bool is_usage_update_needed_;
|
||||
CdmUsageSupportType usage_support_type_;
|
||||
UsageTableHeader* usage_table_header_;
|
||||
// Only assign |usage_table_header_| if capable of supporting usage
|
||||
// information.
|
||||
UsageTableHeader* usage_table_header_ = nullptr;
|
||||
uint32_t usage_entry_number_;
|
||||
CdmUsageEntry usage_entry_;
|
||||
std::string usage_provider_session_token_;
|
||||
|
||||
@@ -238,14 +238,13 @@ class CryptoSession {
|
||||
// Used to manipulate the CDM managed usage table header & entries,
|
||||
// delegating calls to OEMCrypto.
|
||||
|
||||
// Usage support.
|
||||
virtual CdmResponseType GetUsageSupportType(CdmUsageSupportType* type);
|
||||
|
||||
// The overloaded method with |security_level| may be called without a
|
||||
// preceding call to Open. The other method must call Open first.
|
||||
virtual bool UsageInformationSupport(bool* has_support);
|
||||
virtual bool UsageInformationSupport(SecurityLevel security_level,
|
||||
bool* has_support);
|
||||
// Determines whether the OEMCrypto library supports usage info.
|
||||
// As of V16, the only valid type of support is usage table header +
|
||||
// usage entries.
|
||||
// The first method will use a cached value if present.
|
||||
virtual bool HasUsageInfoSupport(bool* has_support);
|
||||
virtual bool HasUsageInfoSupport(SecurityLevel security_level,
|
||||
bool* has_support);
|
||||
|
||||
// Usage report.
|
||||
virtual CdmResponseType DeactivateUsageInformation(
|
||||
@@ -329,6 +328,12 @@ class CryptoSession {
|
||||
CdmResponseType SelectKey(const std::string& key_id,
|
||||
CdmCipherMode cipher_mode);
|
||||
|
||||
// Retrieves the OEMCrypto usage info support for the specified
|
||||
// |requested_security_level|.
|
||||
// Caller should acquire the OEMCrypto read lock before calling.
|
||||
bool HasUsageInfoSupportInternal(SecurityLevel requested_security_level,
|
||||
bool* has_support);
|
||||
|
||||
// These methods fall back into each other in the order given, depending on
|
||||
// how much data they were given and how much data OEMCrypto can accept in one
|
||||
// call.
|
||||
@@ -415,6 +420,15 @@ class CryptoSession {
|
||||
static int session_count_;
|
||||
static int termination_counter_;
|
||||
|
||||
enum CachedBooleanProperty {
|
||||
// Property has not yet been checked/cached.
|
||||
kBooleanUnset,
|
||||
// Property has been cached as false.
|
||||
kBooleanFalse,
|
||||
// Property has been cached as true.
|
||||
kBooleanTrue
|
||||
};
|
||||
|
||||
metrics::CryptoMetrics* metrics_;
|
||||
metrics::TimerMetric life_span_;
|
||||
uint32_t system_id_;
|
||||
@@ -430,8 +444,9 @@ class CryptoSession {
|
||||
bool is_destination_buffer_type_valid_;
|
||||
SecurityLevel requested_security_level_;
|
||||
|
||||
CdmUsageSupportType usage_support_type_;
|
||||
UsageTableHeader* usage_table_header_;
|
||||
// Open session-cached result of OEMCrypto_SupportsUsageTable().
|
||||
CachedBooleanProperty has_usage_info_support_ = kBooleanUnset;
|
||||
UsageTableHeader* usage_table_header_ = nullptr;
|
||||
static UsageTableHeader* usage_table_header_l1_;
|
||||
static UsageTableHeader* usage_table_header_l3_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user