Merge changes I442b7919,Ie5b4ff75

* changes:
  Improve android MediaDrm property latency
  Delay OEMCrypto Termination
This commit is contained in:
Rahul Frias
2020-02-19 15:51:14 +00:00
committed by Android (Google) Code Review
11 changed files with 254 additions and 108 deletions

View File

@@ -44,11 +44,11 @@ class CryptoSessionFactory;
class CryptoSession {
public:
using HdcpCapability = OEMCrypto_HDCP_Capability;
typedef enum {
enum UsageDurationStatus {
kUsageDurationsInvalid = 0,
kUsageDurationPlaybackNotBegun = 1,
kUsageDurationsValid = 2,
} UsageDurationStatus;
};
struct SupportedCertificateTypes {
bool rsa_2048_bit;
@@ -64,6 +64,17 @@ class CryptoSession {
virtual ~CryptoSession();
// This method will try to terminate OEMCrypto if |session_size_| is 0.
// A platform configured property |delay_oem_crypto_termination| will
// determine if termination occurs immediately or after a delay.
// If termination is delayed, a countdown mechanism is employed.
// Call |TryTerminate| periodically until it no longer returns true.
// To immediately terminate call |DisableDelayedTermination| before calling
// |TryTerminate|.
static bool TryTerminate();
static void DisableDelayedTermination();
virtual CdmResponseType GetProvisioningToken(std::string* client_token);
virtual CdmClientTokenType GetPreProvisionTokenType() {
return pre_provision_token_type_;
@@ -282,7 +293,6 @@ class CryptoSession {
}
void Init();
void Terminate();
CdmResponseType GetTokenFromKeybox(std::string* token);
CdmResponseType GetTokenFromOemCert(std::string* token);
static bool ExtractSystemIdFromOemCert(const std::string& oem_cert,
@@ -385,6 +395,7 @@ class CryptoSession {
static bool initialized_;
static int session_count_;
static int termination_counter_;
metrics::CryptoMetrics* metrics_;
metrics::TimerMetric life_span_;

View File

@@ -61,6 +61,9 @@ class Properties {
static void set_provisioning_messages_are_binary(bool flag) {
provisioning_messages_are_binary_ = flag;
}
static inline bool delay_oem_crypto_termination() {
return delay_oem_crypto_termination_;
}
static bool GetCompanyName(std::string* company_name);
static bool GetModelName(std::string* model_name);
static bool GetArchitectureName(std::string* arch_name);
@@ -147,6 +150,7 @@ class Properties {
static bool allow_service_certificate_requests_;
static bool device_files_is_a_real_filesystem_;
static bool allow_restore_of_offline_licenses_with_release_;
static bool delay_oem_crypto_termination_;
static std::unique_ptr<CdmClientPropertySetMap> session_property_set_;
CORE_DISALLOW_COPY_AND_ASSIGN(Properties);