Added metrics for production readiness.
[ Merge of http://go/wvgerrit/151749 ] Extended CryptoSession for recording the result of OEMCrypto_ProductionReady(). Only OEMCrypto_SUCCESS is considered "production ready". With the exception of OEMCrypto_ERROR_NOT_IMPLEMENTED, any other result is vendor-specific and indicates not being production ready. Bug: 231655151 Test: metrics_collections_unittest Change-Id: Ia0e5603d7ee1290238cce63d0194ae1aced424c1
This commit is contained in:
@@ -2358,6 +2358,7 @@ bool CryptoSession::GetProductionReadiness(
|
|||||||
const OEMCryptoResult result = WithOecReadLock("GetProductionReadiness", [&] {
|
const OEMCryptoResult result = WithOecReadLock("GetProductionReadiness", [&] {
|
||||||
return OEMCrypto_ProductionReady(security_level);
|
return OEMCrypto_ProductionReady(security_level);
|
||||||
});
|
});
|
||||||
|
metrics_->oemcrypto_production_readiness_.Record(result);
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case OEMCrypto_SUCCESS:
|
case OEMCrypto_SUCCESS:
|
||||||
*readiness = kProductionReadinessTrue;
|
*readiness = kProductionReadinessTrue;
|
||||||
@@ -2367,6 +2368,9 @@ bool CryptoSession::GetProductionReadiness(
|
|||||||
break;
|
break;
|
||||||
case OEMCrypto_ERROR_UNKNOWN_FAILURE:
|
case OEMCrypto_ERROR_UNKNOWN_FAILURE:
|
||||||
default: // Other vendor-defined codes indicate not production ready.
|
default: // Other vendor-defined codes indicate not production ready.
|
||||||
|
LOGD("Not production ready: security_level = %s, result = %d",
|
||||||
|
RequestedSecurityLevelToString(security_level),
|
||||||
|
static_cast<int>(result));
|
||||||
*readiness = kProductionReadinessFalse;
|
*readiness = kProductionReadinessFalse;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -298,6 +298,7 @@ class CryptoMetrics {
|
|||||||
EventMetric<kOemCryptoResultFieldNumber, OEMCryptoResult>
|
EventMetric<kOemCryptoResultFieldNumber, OEMCryptoResult>
|
||||||
oemcrypto_install_oem_private_key_;
|
oemcrypto_install_oem_private_key_;
|
||||||
ValueMetric<int> oemcrypto_watermarking_support_;
|
ValueMetric<int> oemcrypto_watermarking_support_;
|
||||||
|
ValueMetric<int> oemcrypto_production_readiness_;
|
||||||
}; // class CryptoMetrics
|
}; // class CryptoMetrics
|
||||||
|
|
||||||
// This class contains session-scoped metrics. All properties and
|
// This class contains session-scoped metrics. All properties and
|
||||||
|
|||||||
@@ -211,6 +211,8 @@ void CryptoMetrics::Serialize(
|
|||||||
oemcrypto_maximum_usage_table_header_size_.ToProto());
|
oemcrypto_maximum_usage_table_header_size_.ToProto());
|
||||||
crypto_metrics->set_allocated_oemcrypto_watermarking_support(
|
crypto_metrics->set_allocated_oemcrypto_watermarking_support(
|
||||||
oemcrypto_watermarking_support_.ToProto());
|
oemcrypto_watermarking_support_.ToProto());
|
||||||
|
crypto_metrics->set_allocated_oemcrypto_production_readiness(
|
||||||
|
oemcrypto_production_readiness_.ToProto());
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionMetrics::SessionMetrics() : session_id_(""), completed_(false) {}
|
SessionMetrics::SessionMetrics() : session_id_(""), completed_(false) {}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ message WvCdmMetrics {
|
|||||||
|
|
||||||
// This contains metrics that were captured at the CryptoSession level. These
|
// This contains metrics that were captured at the CryptoSession level. These
|
||||||
// include CryptoSession metrics and most OEMCrypto metrics.
|
// include CryptoSession metrics and most OEMCrypto metrics.
|
||||||
// next id: 86
|
// next id: 87
|
||||||
message CryptoMetrics {
|
message CryptoMetrics {
|
||||||
// Crypto Session Metrics.
|
// Crypto Session Metrics.
|
||||||
optional ValueMetric crypto_session_security_level = 1;
|
optional ValueMetric crypto_session_security_level = 1;
|
||||||
@@ -193,6 +193,7 @@ message WvCdmMetrics {
|
|||||||
optional ValueMetric oemcrypto_minor_api_version = 83;
|
optional ValueMetric oemcrypto_minor_api_version = 83;
|
||||||
optional ValueMetric oemcrypto_maximum_usage_table_header_size = 84;
|
optional ValueMetric oemcrypto_maximum_usage_table_header_size = 84;
|
||||||
optional ValueMetric oemcrypto_watermarking_support = 85;
|
optional ValueMetric oemcrypto_watermarking_support = 85;
|
||||||
|
optional ValueMetric oemcrypto_production_readiness = 86;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This contains metrics that were captured within a CdmSession. This contains
|
// This contains metrics that were captured within a CdmSession. This contains
|
||||||
|
|||||||
@@ -445,6 +445,7 @@ TEST_F(CryptoMetricsTest, AllCryptoMetrics) {
|
|||||||
crypto_metrics.oemcrypto_maximum_usage_table_header_size_.Record(321);
|
crypto_metrics.oemcrypto_maximum_usage_table_header_size_.Record(321);
|
||||||
crypto_metrics.oemcrypto_watermarking_support_.Record(
|
crypto_metrics.oemcrypto_watermarking_support_.Record(
|
||||||
OEMCrypto_WatermarkingAlwaysOn);
|
OEMCrypto_WatermarkingAlwaysOn);
|
||||||
|
crypto_metrics.oemcrypto_production_readiness_.Record(OEMCrypto_SUCCESS);
|
||||||
|
|
||||||
WvCdmMetrics::CryptoMetrics actual;
|
WvCdmMetrics::CryptoMetrics actual;
|
||||||
crypto_metrics.Serialize(&actual);
|
crypto_metrics.Serialize(&actual);
|
||||||
@@ -538,6 +539,8 @@ TEST_F(CryptoMetricsTest, AllCryptoMetrics) {
|
|||||||
actual.oemcrypto_maximum_usage_table_header_size().int_value());
|
actual.oemcrypto_maximum_usage_table_header_size().int_value());
|
||||||
EXPECT_EQ(static_cast<int>(OEMCrypto_WatermarkingAlwaysOn),
|
EXPECT_EQ(static_cast<int>(OEMCrypto_WatermarkingAlwaysOn),
|
||||||
actual.oemcrypto_watermarking_support().int_value());
|
actual.oemcrypto_watermarking_support().int_value());
|
||||||
|
EXPECT_EQ(static_cast<int>(OEMCrypto_SUCCESS),
|
||||||
|
actual.oemcrypto_production_readiness().int_value());
|
||||||
}
|
}
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
Reference in New Issue
Block a user