DeviceStateTracker: Use exact alarms for the time schedule#97
Open
chenxiaolong wants to merge 1 commit intomasterfrom
Open
DeviceStateTracker: Use exact alarms for the time schedule#97chenxiaolong wants to merge 1 commit intomasterfrom
chenxiaolong wants to merge 1 commit intomasterfrom
Conversation
Inexact alarms would be preferable, but there is no way to set the maximum deviance from the desired time. For the default 1h cycle + 5m sync interval, AOSP will add a 3m45s delay to the 5m portion, but a 41m15s delay to the 55m portion. The latter is so wildly different from what the user configured that the number has no meaning anymore. Instead, we'll just use exact alarms. The ability to do this is automatically granted when the user disables battery optimizations, but this commit also adds the SCHEDULE_EXACT_ALARM permission for users who don't do that. They will need to manually grant the permission from Android's settings because disabling battery optimizations is the (strongly) recommended setup. If exact alarms are not allowed, then inexact alarms will be used as a fallback. The user will now be responsible for choosing values that are sane and don't wake up the device too often because these alarms will interrupt doze mode. Fixes: #83 Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Inexact alarms would be preferable, but there is no way to set the maximum deviance from the desired time. For the default 1h cycle + 5m sync interval, AOSP will add a 3m45s delay to the 5m portion, but a 41m15s delay to the 55m portion. The latter is so wildly different from what the user configured that the number has no meaning anymore.
Instead, we'll just use exact alarms. The ability to do this is automatically granted when the user disables battery optimizations, but this commit also adds the
SCHEDULE_EXACT_ALARMpermission for users who don't do that. They will need to manually grant the permission from Android's settings because disabling battery optimizations is the (strongly) recommended setup. If exact alarms are not allowed, then inexact alarms will be used as a fallback.The user will now be responsible for choosing values that are sane and don't wake up the device too often because these alarms will interrupt doze mode.
Fixes: #83