Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Fixed crash when MainActivity was destroyed when selecting a file #207

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

philips77
Copy link
Member

When "Don't keep Activities" is enabled in Developer Settings Android is killing all Activities when switchin to a new one. This is very useful when testing proper closing and restoration of state.

In mRFCDM app, when the user has selected a device and is navigating to a File Browser to select a file the system is killing MainActivity. The app closing the McuMgrTransport object in onCleared() in the view model, which was also stopping the HandlerThread. On restoration, the app was crashing, as a closed thread doesn't have a looper anymore.

The PR changes when the transport gets closed. Not it happens from the MainActivity in onDestroy() when isFinishing() is returning true, that is only when the user is moving back to the scanner.

@philips77
Copy link
Member Author

I think this also simplifies the code.

@philips77 philips77 closed this Nov 14, 2024
@philips77 philips77 reopened this Nov 14, 2024
@philips77 philips77 merged commit de9f189 into main Nov 14, 2024
1 check passed
@philips77 philips77 deleted the bugfix/thread-closed branch November 14, 2024 10:38
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.

1 participant