Merge "Parameterize "forbid analog" in mod mock"
This commit is contained in:
committed by
Android (Google) Code Review
commit
e89c9b969c
@@ -94,6 +94,20 @@ class CryptoEngine {
|
|||||||
// Returns the max HDCP version supported.
|
// Returns the max HDCP version supported.
|
||||||
virtual OEMCrypto_HDCP_Capability config_maximum_hdcp_capability();
|
virtual OEMCrypto_HDCP_Capability config_maximum_hdcp_capability();
|
||||||
|
|
||||||
|
// Return true if there might be analog video output enabled.
|
||||||
|
virtual bool analog_display_active() {
|
||||||
|
return !config_local_display_only();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return true if there is an analog display, and CGMS A is turned on.
|
||||||
|
virtual bool cgms_a_active() { return false; }
|
||||||
|
|
||||||
|
// Return the analog output flags.
|
||||||
|
virtual uint32_t analog_output_flags() {
|
||||||
|
return config_local_display_only() ? OEMCrypto_No_Analog_Output
|
||||||
|
: OEMCrypto_Supports_Analog_Output;
|
||||||
|
}
|
||||||
|
|
||||||
UsageTable& usage_table() { return *(usage_table_.get()); }
|
UsageTable& usage_table() { return *(usage_table_.get()); }
|
||||||
wvcdm::FileSystem* file_system() { return file_system_.get(); }
|
wvcdm::FileSystem* file_system() { return file_system_.get(); }
|
||||||
|
|
||||||
|
|||||||
@@ -1140,11 +1140,18 @@ extern "C" OEMCryptoResult OEMCrypto_GetHDCPCapability(
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" uint32_t OEMCrypto_GetAnalogOutputFlags() {
|
extern "C" uint32_t OEMCrypto_GetAnalogOutputFlags() {
|
||||||
// TODO(b/69867568, fredgc): parameterize this.
|
if (!crypto_engine) {
|
||||||
return 0;
|
LOGE("OEMCrypto_GetAnalogOutputFlags: OEMCrypto Not Initialized.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return crypto_engine->analog_output_flags();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" bool OEMCrypto_SupportsUsageTable() {
|
extern "C" bool OEMCrypto_SupportsUsageTable() {
|
||||||
|
if (!crypto_engine) {
|
||||||
|
LOGE("OEMCrypto_SupportsUsageTable: OEMCrypto Not Initialized.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
bool supports_usage = crypto_engine->config_supports_usage_table();
|
bool supports_usage = crypto_engine->config_supports_usage_table();
|
||||||
return supports_usage;
|
return supports_usage;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -917,8 +917,7 @@ OEMCryptoResult SessionContext::CheckKeyUse(const std::string& log_string,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ce_->config_local_display_only()) {
|
if (!ce_->config_local_display_only()) {
|
||||||
// Only look at HDCP and Analog restrictions if the display can be
|
// Only look at HDCP restrictions if the display can be non-local.
|
||||||
// non-local.
|
|
||||||
if (control.control_bits() & wvoec::kControlHDCPRequired) {
|
if (control.control_bits() & wvoec::kControlHDCPRequired) {
|
||||||
uint8_t required_hdcp =
|
uint8_t required_hdcp =
|
||||||
(control.control_bits() & wvoec::kControlHDCPVersionMask) >>
|
(control.control_bits() & wvoec::kControlHDCPVersionMask) >>
|
||||||
@@ -934,10 +933,24 @@ OEMCryptoResult SessionContext::CheckKeyUse(const std::string& log_string,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ce_->config_local_display_only() ||
|
// If the output buffer is clear, then we cannot control whether the output is
|
||||||
buffer_type == OEMCrypto_BufferType_Clear) {
|
// an active analog display. In that case, return an error if analog displays
|
||||||
if (control.control_bits() & wvoec::kControlDisableAnalogOutput) {
|
// should be disabled.
|
||||||
LOGE("[%s(): control bit says disable analog.", log_string.c_str());
|
if ((control.control_bits() & wvoec::kControlDisableAnalogOutput) &&
|
||||||
|
(ce_->analog_display_active() ||
|
||||||
|
(buffer_type == OEMCrypto_BufferType_Clear))) {
|
||||||
|
LOGE("[%s(): control bit says disable analog.", log_string.c_str());
|
||||||
|
return OEMCrypto_ERROR_ANALOG_OUTPUT;
|
||||||
|
}
|
||||||
|
// Check if CGMS is required.
|
||||||
|
if (control.control_bits() & wvoec::kControlCGMSMask) {
|
||||||
|
// We can't control CGMS for a clear buffer.
|
||||||
|
if (buffer_type == OEMCrypto_BufferType_Clear) {
|
||||||
|
LOGE("[%s(): CGMS required, but buffer is clear.", log_string.c_str());
|
||||||
|
return OEMCrypto_ERROR_ANALOG_OUTPUT;
|
||||||
|
}
|
||||||
|
if ( ce_->analog_display_active() && !ce_->cgms_a_active()) {
|
||||||
|
LOGE("[%s(): control bit says CGMS required.", log_string.c_str());
|
||||||
return OEMCrypto_ERROR_ANALOG_OUTPUT;
|
return OEMCrypto_ERROR_ANALOG_OUTPUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user