Add debug display of Keystore metric info
Output:
```
Metrics information:
KEYGEN_GENERAL : [
RSA ksz=2048 crv=NONE UNSPECED rc= 1 attest? N => count=1
AES ksz= -1 crv=NONE UNSPECED rc= -67 attest? N => count=1
AES ksz= -1 crv=NONE UNSPECED rc= 1 attest? N => count=1
AES ksz= 128 crv=NONE UNSPECED rc= 1 attest? N => count=1
AES ksz= 256 crv=NONE UNSPECED rc= -67 attest? N => count=3
AES ksz= 256 crv=NONE UNSPECED rc= 1 attest? N => count=3
HMAC ksz= 256 crv=NONE UNSPECED rc= 1 attest? N => count=1
]
KEYGEN_AUTH : [
auth=UNSPEC log(time)=-1 sec=TEE => count=11
]
KEYGEN_MODES : [
RSA purpose=----S-- padding=-S---- digest=--2---- blockmode=---- => count=1
AES purpose=-----D- padding=-----N digest=------- blockmode=G--- => count=2
AES purpose=-----DE padding=-----N digest=------- blockmode=G--- => count=7
HMAC purpose=---VS-- padding=------ digest=--2---- blockmode=---- => count=1
]
KEYOP_MODES : [
ENCRYPT padding=-----N digest=------- blockmode=G--- => count=3
DECRYPT padding=-----N digest=------- blockmode=G--- => count=1
SIGN padding=------ digest=--2---- blockmode=---- => count=1
SIGN padding=-S---- digest=--2---- blockmode=---- => count=2
]
KEYOP_GENERAL : [
SUCCESS 1 upgraded? N sec=TEE => count=7
]
```
Test: adb shell dumpsys android.security.maintenance (above)
Test: keystore2_client_tests
Test: keystore2_test
Bug: 344987718
Change-Id: I23a79eb564cf4a148414d5fb417f628dce3fc171
diff --git a/keystore2/src/maintenance.rs b/keystore2/src/maintenance.rs
index 7749507..4c895ae 100644
--- a/keystore2/src/maintenance.rs
+++ b/keystore2/src/maintenance.rs
@@ -309,6 +309,12 @@
}
writeln!(f)?;
+ // Display accumulated metrics.
+ writeln!(f, "Metrics information:")?;
+ writeln!(f)?;
+ write!(f, "{:?}", *crate::metrics_store::METRICS_STORE)?;
+ writeln!(f)?;
+
// Reminder: any additional information added to the `dump_state()` output needs to be
// careful not to include confidential information (e.g. key material).