Update fallback policy for fast fallback.
[ Cherry-pick of http://ag/16064433 ] [ Merge of http://go/wvgerrit/136329 ] CDM core has been updated to support very short fallback durations in the case of failures during OTA keybox provisioning. This is intended to be used during testing via specialized developer apps or GTS tests. Bug: 187646550 Test: Android unit tests Change-Id: I8a75d2e1c404d6caed535b087e8dd29da5c21b83
This commit is contained in:
@@ -22,13 +22,14 @@ static constexpr int64_t kSecondsPerDay = kSecondsPerHour * 24;
|
||||
// Initial backoff duration. Subsequent backoff durations for the
|
||||
// same engine will double its previous duration.
|
||||
static constexpr int64_t kAverageInitialBackoffDuration = kSecondsPerDay;
|
||||
static constexpr int64_t kInitalBackoffDurationDelta = kSecondsPerHour * 12;
|
||||
static constexpr int64_t kFastBackoffDuration = 30; // 30 seconds.
|
||||
static constexpr int64_t kInitialBackoffDurationDelta = kSecondsPerHour * 12;
|
||||
// Minimum backoff duration which an device will be required to
|
||||
// backoff the first time.
|
||||
static constexpr int64_t kMinInitialBackoffDuration =
|
||||
kAverageInitialBackoffDuration - kInitalBackoffDurationDelta;
|
||||
kAverageInitialBackoffDuration - kInitialBackoffDurationDelta;
|
||||
static constexpr int64_t kMaxInitialBackoffDuration =
|
||||
kAverageInitialBackoffDuration + kInitalBackoffDurationDelta;
|
||||
kAverageInitialBackoffDuration + kInitialBackoffDurationDelta;
|
||||
|
||||
// SystemFallbackPolicy is a centralized OKP state manager which allows
|
||||
// multiple CDM engines to communicate between each other. In a production
|
||||
@@ -70,6 +71,9 @@ class SystemFallbackPolicy {
|
||||
bool IsProvisioned();
|
||||
bool IsInFallbackMode();
|
||||
|
||||
void SetDefaultBackoffDurationRules();
|
||||
void SetFastBackoffDurationRules();
|
||||
|
||||
~SystemFallbackPolicy();
|
||||
|
||||
private:
|
||||
@@ -81,6 +85,8 @@ class SystemFallbackPolicy {
|
||||
|
||||
void StoreInfo();
|
||||
|
||||
int64_t GenerateInitialBackoffDuration();
|
||||
|
||||
int64_t GetSecondsSinceBackoffStart() const;
|
||||
void EndBackoffPeriod();
|
||||
|
||||
@@ -93,6 +99,10 @@ class SystemFallbackPolicy {
|
||||
|
||||
SystemFallbackInfo info_;
|
||||
|
||||
// When |fast_fallback_| is true, falling back only lasts a few
|
||||
// seconds, and exponential backoff is disabled.
|
||||
bool fast_fallback_ = false;
|
||||
|
||||
// Handle for the DeviceFiles instance used to store the OKP
|
||||
// information.
|
||||
// Not set for test instances.
|
||||
|
||||
@@ -45,6 +45,7 @@ class SystemFallbackInfo {
|
||||
backoff_duration_ = (duration > 0 ? duration : 0);
|
||||
}
|
||||
void DoubleBackoffDuration() { backoff_duration_ *= 2; }
|
||||
void ClearBackoffDuration() { backoff_duration_ = 0; }
|
||||
|
||||
bool HasProvisioningTime() const { return provisioning_time_ != 0; }
|
||||
int64_t provisioning_time() const { return provisioning_time_; }
|
||||
|
||||
Reference in New Issue
Block a user