Add battery optimization exemption setting#54
Closed
Xitee1 wants to merge 1 commit into
Closed
Conversation
Adds an "Ignore battery optimization" toggle under a new System section in settings. The row reflects live system state via PowerManager (not a persisted preference): toggling on launches the exemption request dialog, toggling off opens the system's battery optimization list since Android offers no way to re-optimize programmatically. State refreshes on resume and on return from the system UI, mirroring the device-admin row. The exemption is never requested automatically — some devices don't need it, so it stays fully opt-in from settings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SqqopAw7r7eu5BrrvHFMau
Xitee1
force-pushed
the
claude/zen-keller-cyf07f
branch
from
July 17, 2026 21:42
88cc3f2 to
fad047d
Compare
Owner
Author
|
Closing as it's useless. The users can just go into android settings and disable it there if it's a problem. |
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.
Summary
Adds an opt-in settings row to request exemption from battery optimization (Doze/App-Standby), which can defer or kill the foreground service on aggressive OEM builds and cause the timer to silently stop mid-countdown.
Changes
BatteryOptimizationHelper(core:service): Singleton that queries the battery-optimization exemption status viaPowerManager.isIgnoringBatteryOptimizations()and provides intents to request exemption or access the system battery-optimization settings list.adminRefreshTickertosystemStateRefreshTickerto cover both device-admin and battery-exemption state.refreshDeviceAdminState()torefreshSystemState()and bumped it onON_RESUMEto reflect changes made in system Settings.batteryExemptionRequestIntent()andbatteryOptimizationSettingsIntent()methods.REQUEST_IGNORE_BATTERY_OPTIMIZATIONSpermission withBatteryLifelint suppression (justified because the app ships via F-Droid/GitHub, not Play Store, and the request is only triggered from an opt-in settings row).Implementation Details
refreshSystemState()once the user returns from the system UI, ensuring the UI reflects the actual OS state.batteryLauncher) is used to detect when the user returns from the exemption dialog or settings, triggering a refresh.https://claude.ai/code/session_01SqqopAw7r7eu5BrrvHFMau