VPN-6629: Fix debug daemon timer on Android #9951
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
There is a debug setting for short session timers - sending pings every 3 minutes when a VPN session is active, rather than the typical every 3 hours.
History of this:
lazy var
, which caused a crash in some situations. (VPN-6629)false
- as themConfig
wasn't saved when the computed var was trying to use it. (VPN-5766 - Fix CountdownTimer generation timing #8555)In this PR, I change the timer to use
onTick
for debug timer pings. I had initially tried to just move the timer setup work to right before the timer is started, as then we'd havemConfig
already set. However, that requires being on a UI thread (it's a CountDownTimer thing). I'm confident there is a way to do this, but I'm not an expert on Android - and I spent a while testing stuff out to get this UI thread from a background daemon, getting nothing working. This alternative way of handling it should suffice, and tests okay for both the debug option being active and not active.Reference
VPN-6629
Checklist