Add detail about L3 initialization
Bug: b/70299597 Merge of http://go/wvgerrit/67304 Test: Android, CE CDM, and Linux tests There's a few different things that can go wrong in the L3 initialization, with seeding and device key failures among others. They should be recorded in metrics to track. Along the same lines, since multiple errors can happen in conjunction, metrics needs to change to add more fields for errors. This CL also adds the hidl_metrics_adapter_unittest to the Android test scripts. Change-Id: Ie5bcf81bbe294a1136c58410f90087a13b3d911d
This commit is contained in:
@@ -437,8 +437,9 @@ class WatchDog {
|
||||
if (size == size_read && flag) {
|
||||
LOGE("Previous L3 Init failed.");
|
||||
if (metrics == NULL) return;
|
||||
metrics->OemCryptoDynamicAdapterMetrics::SetInitializationMode(
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_L3_INITIALIZATION_FAILED);
|
||||
metrics
|
||||
->OemCryptoDynamicAdapterMetrics::SetPreviousInitializationFailure(
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_L3_INITIALIZATION_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -480,7 +481,8 @@ class WatchDog {
|
||||
}
|
||||
|
||||
// Called by main thread to wait for worker thread.
|
||||
OEMCryptoResult WaitForStatusAndCleanUp() {
|
||||
OEMCryptoResult WaitForStatusAndCleanUp(
|
||||
wvcdm::metrics::OemCryptoDynamicAdapterMetrics* metrics) {
|
||||
bool should_delete;
|
||||
OEMCryptoResult status;
|
||||
{
|
||||
@@ -492,15 +494,51 @@ class WatchDog {
|
||||
gave_up_ = true;
|
||||
status_ = OEMCrypto_ERROR_INIT_FAILED;
|
||||
LOGE("XXX WATCH DOG ERROR XXX");
|
||||
// HACK: this normally just returns an error. However, we are using it
|
||||
// as a signal to dump debugging information.
|
||||
Level3_GetOEMPublicCertificate(0, NULL, NULL);
|
||||
Level3_OutputErrorLogs();
|
||||
SaveFailureInformation();
|
||||
// This is controversial. The argument for an abort here is that if we
|
||||
// do not abort, we will suck all the life out of the user's battery.
|
||||
// By saving information to the file system, above, we can still track
|
||||
// metrics.
|
||||
abort();
|
||||
} else if (metrics != NULL) {
|
||||
// Even if we succeeded in calling initialize, there might be failures
|
||||
// in the initialize process that we want to record.
|
||||
wvoec3::Level3InitializationState state =
|
||||
Level3_GetInitializationState();
|
||||
switch (state) {
|
||||
case wvoec3::LEVEL3_INITIALIZATION_UNKNOWN_FAILURE:
|
||||
metrics
|
||||
->OemCryptoDynamicAdapterMetrics::SetLevel3InitializationError(
|
||||
wvcdm::metrics::
|
||||
OEMCrypto_INITIALIZED_L3_INITIALIZATION_FAILED);
|
||||
break;
|
||||
case wvoec3::LEVEL3_SEED_FAILURE:
|
||||
metrics
|
||||
->OemCryptoDynamicAdapterMetrics::SetLevel3InitializationError(
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_L3_RNG_FAILED);
|
||||
break;
|
||||
case wvoec3::LEVEL3_SAVE_DEVICE_KEYS_FAILURE:
|
||||
metrics
|
||||
->OemCryptoDynamicAdapterMetrics::SetLevel3InitializationError(
|
||||
wvcdm::metrics::
|
||||
OEMCrypto_INITIALIZED_L3_SAVE_DEVICE_KEYS_FAILED);
|
||||
break;
|
||||
case wvoec3::LEVEL3_READ_DEVICE_KEYS_FAILURE:
|
||||
metrics
|
||||
->OemCryptoDynamicAdapterMetrics::SetLevel3InitializationError(
|
||||
wvcdm::metrics::
|
||||
OEMCrypto_INITIALIZED_L3_READ_DEVICE_KEYS_FAILED);
|
||||
break;
|
||||
case wvoec3::LEVEL3_VERIFY_DEVICE_KEYS_FAILURE:
|
||||
metrics
|
||||
->OemCryptoDynamicAdapterMetrics::SetLevel3InitializationError(
|
||||
wvcdm::metrics::
|
||||
OEMCrypto_INITIALIZED_L3_VERIFY_DEVICE_KEYS_FAILED);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If we gave up waiting for init thread, we should not delete the mutex
|
||||
// out from under it.
|
||||
@@ -600,7 +638,7 @@ class Adapter {
|
||||
LOGI("Level 3 Build Info (v%d): %s", level3_.version,
|
||||
level3_.BuildInformation());
|
||||
}
|
||||
OEMCryptoResult result = watcher->WaitForStatusAndCleanUp();
|
||||
OEMCryptoResult result = watcher->WaitForStatusAndCleanUp(&metrics);
|
||||
if (Level3_IsInApp()) {
|
||||
metrics.SetInitializationMode(
|
||||
wvcdm::metrics::OEMCrypto_INITIALIZED_USING_IN_APP);
|
||||
|
||||
Reference in New Issue
Block a user