Kronos-Android
Kronos-Android copied to clipboard
Use boot count to detect reboot if it exists
to fix #61 related to https://github.com/lyft/Kronos-Android/issues/61#issuecomment-1035936886
Using the difference between deviceCurrentTime and deviceElapsedTime can trigger false negative on isFromSameBoot
.
To avoid this false-negative case, this PR uses boot count from Settings.Global.BOOT_COUNT.
For case when bootCount is not available to the device (e.g. without Android or android sdk below 24) this PR uses bootCount only when it's available. When there is no bootCount, it uses the same algorithm that has been used before this PR.
This is a great find! I never knew this setting existed. Curious to know how well this might be working with testing.