Reset UsageTableHeader when re-init for tests.

[ Merge of http://go/wvgerrit/149130 ]

When re-initializing OEMCrypto for testing purposes, the
UsageTableHeader must be reset as well.  This is to inform future
sessions to load or create a new header before creating new entries.

Bug: 219075437
Test: request_license_test and MediaDrmTests GTS
Change-Id: Ie8bc72bc7ea079d21587e114223fcb67547c756a
This commit is contained in:
Alex Dale
2022-03-30 13:53:28 -07:00
parent a9828a7168
commit 8091ed239e

View File

@@ -374,15 +374,18 @@ void CryptoSession::Init() {
void CryptoSession::ReinitializeForTest() {
if (initialized_) {
initialized_ = false;
OEMCryptoResult status = OEMCrypto_Terminate();
const OEMCryptoResult status = OEMCrypto_Terminate();
if (OEMCrypto_SUCCESS != status) {
LOGE("OEMCrypto_Terminate failed: %d", status);
return;
}
initialized_ = false;
// Tables will be reinitialized by tests when needed.
usage_table_header_l1_.reset();
usage_table_header_l3_.reset();
}
// Give up if we cannot initialize at all.
OEMCryptoResult status = OEMCrypto_Initialize();
const OEMCryptoResult status = OEMCrypto_Initialize();
if (OEMCrypto_SUCCESS != status) {
LOGE("OEMCrypto_Initialize failed: %d", status);
return;