Core CDM: Removed secure stop support.

[ Merge of http://go/wvgerrit/158721 ]

This CL removes support for secure stop / usage info sessions from the
CDM engine and CDM session.  APIs for related to secure stop
operations will return NOT_IMPLEMENTED_ERROR.

New secure stop licenses will be rejected by the CDM when added.

Bug: 242289743
Test: run_x86_64_tests request_license_test
Change-Id: I30cd47e580d63014e001c903382a28238746f6d4
This commit is contained in:
Alex Dale
2022-10-12 18:10:13 -07:00
parent f5fbfa6176
commit b039f31b27
6 changed files with 139 additions and 660 deletions

View File

@@ -127,10 +127,10 @@ class CdmEngine {
// stored offline data associated with the session.
virtual CdmResponseType RemoveKeys(const CdmSessionId& session_id);
// This method removes all offline data associated with the session, such as
// offline keys and usage info. It should be used with care, as it deletes the
// info immediately and without using a release message, so the server is not
// able to receive usage info or track releases for offline licenses.
// This method removes all offline data associated with the session. It
// should be used with care, as it deletes the info immediately and
// without using a release message, so the server is not able to
// receive usage info or track releases for offline licenses.
virtual CdmResponseType RemoveLicense(const CdmSessionId& session_id);
// Construct valid renewal request for the current session keys.
@@ -235,38 +235,32 @@ class CdmEngine {
virtual CdmResponseType RemoveOfflineLicense(const std::string& key_set_id,
CdmSecurityLevel security_level);
// Usage related methods for streaming licenses
// Retrieve a random usage info from the list of all usage infos for this app
// id. If |error_detail| is not null, an additional error code may be provided
// in the event of an error.
// Usage related methods for streaming licenses with persistent usage
// information (deprecated).
virtual CdmResponseType GetUsageInfo(const std::string& app_id,
int* error_detail,
CdmUsageInfo* usage_info);
// Retrieve usage info whose PST is specified by |ssid|
// If |error_detail| is not null, an additional error code may be provided
// in the event of an error.
// Retrieve usage info whose PST is specified by |ssid| (deprecated).
virtual CdmResponseType GetUsageInfo(const std::string& app_id,
const CdmSecureStopId& ssid,
int* error_detail,
CdmUsageInfo* usage_info);
// Retrieve usage info for a given security level and whose
// PST is specified by |ssid|.
// If |error_detail| is not null, an additional error code may be provided
// in the event of an error.
// Retrieve usage info for a given security level and whose PST is
// specified by |ssid| (deprecated).
virtual CdmResponseType GetUsageInfo(const std::string& app_id,
const CdmSecureStopId& ssid,
RequestedSecurityLevel security_level,
int* error_detail,
CdmUsageInfo* usage_info);
// Remove all usage records for the current origin.
// Remove all usage records for the current origin (deprecated).
virtual CdmResponseType RemoveAllUsageInfo(const std::string& app_id,
CdmSecurityLevel security_level);
// Remove all usage records for the current origin. Span all
// security levels.
// security levels (deprecated).
virtual CdmResponseType RemoveAllUsageInfo(const std::string& app_id);
virtual CdmResponseType RemoveUsageInfo(
@@ -406,9 +400,6 @@ class CdmEngine {
CdmSessionId* session_id);
bool ValidateKeySystem(const CdmKeySystem& key_system);
CdmResponseType GetUsageInfo(const std::string& app_id,
RequestedSecurityLevel requested_security_level,
int* error_detail, CdmUsageInfo* usage_info);
void OnKeyReleaseEvent(const CdmKeySetId& key_set_id);
@@ -443,13 +434,11 @@ class CdmEngine {
std::string spoid_;
uint32_t user_id_;
// Usage related variables
// Used to isolate a single active usage information license. Loading,
// creating or releasing a different usage licenses through the engine
// API will release the handle to previously active secure stop license.
std::unique_ptr<CdmSession> usage_session_;
std::unique_ptr<UsagePropertySet> usage_property_set_;
int64_t last_usage_information_update_time_;
// Tracks the time of the last update to usage info across all
// actively managed CDM sessions with loaded usage entries. Used
// to periodically update a usage entry associated with an active
// license.
int64_t last_usage_info_update_time_ = 0;
// Protect release_key_sets_ from non-thread-safe operations.
std::mutex release_key_sets_lock_;

View File

@@ -75,12 +75,6 @@ class CdmSession {
virtual CdmResponseType RestoreOfflineSession(const CdmKeySetId& key_set_id,
CdmLicenseType license_type,
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, int* error_detail);
virtual const CdmSessionId& session_id() { return session_id_; }
virtual const CdmKeySetId& key_set_id() { return key_set_id_; }
@@ -150,7 +144,7 @@ class CdmSession {
virtual bool is_initial_usage_update() { return is_initial_usage_update_; }
virtual bool is_usage_update_needed() { return is_usage_update_needed_; }
virtual void reset_usage_flags() {
virtual void ResetUsageFlags() {
is_initial_usage_update_ = false;
is_usage_update_needed_ = false;
}
@@ -159,12 +153,19 @@ class CdmSession {
virtual bool is_offline() { return is_offline_; }
virtual bool is_temporary() { return is_temporary_; }
virtual bool license_received() { return license_received_; }
virtual bool has_provider_session_token() {
return (license_parser_ &&
license_parser_->provider_session_token().size() > 0);
virtual bool HasUsageEntry() {
// The PST is only set if a usage entry has been loaded.
return provider_session_token_.size() > 0;
}
virtual const std::string& provider_session_token() {
return provider_session_token_;
}
void SetProviderSessionTokenForTest(const std::string& pst) {
provider_session_token_ = pst;
}
virtual bool supports_usage_info() const {
virtual bool SupportsUsageEntries() const {
return usage_table_header_ != nullptr;
}
@@ -243,8 +244,6 @@ class CdmSession {
bool StoreLicense(CdmOfflineLicenseState state, int* error_detail);
bool UpdateUsageInfo();
CdmResponseType GenerateKeyRequestInternal(
const InitializationData& init_data, CdmLicenseType license_type,
const CdmAppParameterMap& app_parameters, CdmKeyRequest* key_request);
@@ -305,14 +304,15 @@ class CdmSession {
bool last_decrypt_failed_ = false;
// Usage related flags and data
bool is_initial_usage_update_;
bool is_usage_update_needed_;
bool is_initial_usage_update_ = true;
bool is_usage_update_needed_ = false;
// Only assign |usage_table_header_| if capable of supporting usage
// information.
UsageTableHeader* usage_table_header_ = nullptr;
uint32_t usage_entry_number_;
uint32_t usage_entry_number_ = 0;
CdmUsageEntry usage_entry_;
std::string usage_provider_session_token_;
// This PST should only be set if the session has a usage entry.
std::string provider_session_token_;
// information useful for offline and usage scenarios
CdmKeyMessage key_request_;