Added debugOtaKeyboxFallbackDuration property.

[ Cherry-pick of http://ag/16064434 ]
[ Merge of http://go/wvgerrit/136330 ]

This changes adds a custom debug property for changing the fallback
policy used for the system.  Depending on the value set, the device
will either use a "fast" fallback (30 seconds) or "default" fallback
(~1 day with exponential backoff).  Setting this property to either
"fast" or "default" will end the current fallback if it has been
triggered.

Bug: 187646550
Test: Android unit tests
Change-Id: I5271f96139c1e468242f7fa742668cc791ffcf91
This commit is contained in:
Alex Dale
2021-10-15 19:54:02 -07:00
parent 28b45c4f1b
commit 8b12e5acc9
6 changed files with 77 additions and 0 deletions

View File

@@ -21,6 +21,7 @@
#include "device_files.h"
#include "file_store.h"
#include "log.h"
#include "okp_fallback_policy.h"
#include "ota_keybox_provisioner.h"
#include "properties.h"
#include "string_conversions.h"
@@ -2154,4 +2155,26 @@ void CdmEngine::OkpCleanUp() {
}
okp_provisioner_.reset();
}
void CdmEngine::SetDefaultOtaKeyboxFallbackDurationRules() {
OkpCheck();
std::unique_lock<std::mutex> lock(okp_mutex_);
auto* system_fallback_policy = CryptoSession::GetOkpFallbackPolicy();
if (!system_fallback_policy) {
LOGW("No system fallback policy available");
return;
}
system_fallback_policy->SetDefaultBackoffDurationRules();
}
void CdmEngine::SetFastOtaKeyboxFallbackDurationRules() {
OkpCheck();
std::unique_lock<std::mutex> lock(okp_mutex_);
auto* system_fallback_policy = CryptoSession::GetOkpFallbackPolicy();
if (!system_fallback_policy) {
LOGW("No system fallback policy available");
return;
}
system_fallback_policy->SetFastBackoffDurationRules();
}
} // namespace wvcdm