Skip to content

Activity Leak in PermissionsControllerImpl during Configuration Change Fix#182

Merged
Alex009 merged 1 commit intoicerockdev:developfrom
0ximDigital:fix/181-activity-leak
Aug 28, 2025
Merged

Activity Leak in PermissionsControllerImpl during Configuration Change Fix#182
Alex009 merged 1 commit intoicerockdev:developfrom
0ximDigital:fix/181-activity-leak

Conversation

@0ximDigital
Copy link
Copy Markdown

This PR is a proposed fix for the issue #181

Proposed Solution

The following changes are made to the PermissionsControllerImpl:

  1. Using MutableSharedFlow to suspend while waiting for the result to emit permission request results instead of using suspendCoroutine
  2. Unregistering launcher holder if there is any, during the activity destroy lifecycle callback

Open to discussion:

At the start of the bind() method, there is an unbindActivity() method invocation to unbind previously bound Activity if developers mistakenly invoke the bind() method more times for different Activities - Android MultiWindow?

We could throw an exception there instead to signal to developers that they may be making a mistake instead.

Most Important

These changes do not change a behaviour of the PermissionControllerImpl or the API in any way to keep it backwards compatible.

@Alex009 Alex009 changed the base branch from master to develop August 20, 2025 16:28
@Alex009 Alex009 added this to the 0.20.1 milestone Aug 20, 2025
…unregistering launcher on activity destroy
@0ximDigital 0ximDigital force-pushed the fix/181-activity-leak branch from 53cfaf7 to b53fa91 Compare August 26, 2025 09:45
@Alex009 Alex009 merged commit ff49fdc into icerockdev:develop Aug 28, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] Memory Leak in PermissionsControllerImpl due to Activity reference retention during Configuration Changes

2 participants