fix(android): defer wakelock toggle when no activity is attached W…#134
Open
sadaqatdev wants to merge 1 commit into
Open
fix(android): defer wakelock toggle when no activity is attached W…#134sadaqatdev wants to merge 1 commit into
sadaqatdev wants to merge 1 commit into
Conversation
…lock.toggle()/isEnabled() threw NoActivityException whenever they were called with no foreground activity attached (e.g. the app is backgrounded or mid lifecycle transition), surfacing as non-fatal crashes in apps that toggle the wakelock off the foreground path. Instead of throwing, the requested wakelock state is now tracked in Kotlin and re-applied once an activity (re)attaches — matching how the Windows/Linux/web implementations track state. The activity setter only re-asserts FLAG_KEEP_SCREEN_ON when wakelock was actually enabled, so it won't clear the flag for apps that set it on their own window. The now-unused NoActivityException class is removed. Bumps wakelock_plus to 1.6.2 and updates the CHANGELOG. Fixes fluttercommunity#131, fluttercommunity#102, fluttercommunity#6. fix(android): defer wakelock toggle when no activity is attached Wakelock.toggle()/isEnabled() threw NoActivityException whenever they were called with no foreground activity attached (e.g. the app is backgrounded or mid lifecycle transition), surfacing as non-fatal crashes in apps that toggle the wakelock off the foreground path. Instead of throwing, the requested wakelock state is now tracked in Kotlin and re-applied once an activity (re)attaches — matching how the Windows/Linux/web implementations track state. The activity setter only re-asserts FLAG_KEEP_SCREEN_ON when wakelock was actually enabled, so it won't clear the flag for apps that set it on their own window. The now-unused NoActivityException class is removed. Bumps wakelock_plus to 1.6.2 and updates the CHANGELOG. Fixes fluttercommunity#131, fluttercommunity#102, fluttercommunity#6.
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.
…akelock.toggle()/isEnabled() threw NoActivityException whenever they were called with no foreground activity attached (e.g. the app is backgrounded or mid lifecycle transition), surfacing as non-fatal crashes in apps that toggle the wakelock off the foreground path. Instead of throwing, the requested wakelock state is now tracked in Kotlin and re-applied once an activity (re)attaches — matching how the Windows/Linux/web implementations track state. The activity setter only re-asserts FLAG_KEEP_SCREEN_ON when wakelock was actually enabled, so it won't clear the flag for apps that set it on their own window. The now-unused NoActivityException class is removed. Bumps wakelock_plus to 1.6.2 and updates the CHANGELOG. Fixes #131, #102, #6.
fix(android): defer wakelock toggle when no activity is attached
Wakelock.toggle()/isEnabled() threw NoActivityException whenever they
were called with no foreground activity attached (e.g. the app is
backgrounded or mid lifecycle transition), surfacing as non-fatal
crashes in apps that toggle the wakelock off the foreground path.
Instead of throwing, the requested wakelock state is now tracked in
Kotlin and re-applied once an activity (re)attaches — matching how the
Windows/Linux/web implementations track state. The activity setter only
re-asserts FLAG_KEEP_SCREEN_ON when wakelock was actually enabled, so it
won't clear the flag for apps that set it on their own window. The
now-unused NoActivityException class is removed.
Bumps wakelock_plus to 1.6.2 and updates the CHANGELOG.
Fixes #131, #102, #6.