Repository navigation
fix(android): don't crash when launched in restricted backup mode - #3185
Merged
Merged
Conversation
When Android starts the process for a backup or restore, it uses the base Application class, so RuntimeBaseApplication.onCreate never runs. Opening the app in that process crashed in SystemBarPlugin because AppPreferences and the bridge thread pools required the static instance. Initialize AppPreferences from the activity as well as the application, and make the thread pools lazy companion singletons.
Contributor
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge. SummaryThe PR removes startup dependencies on the custom Android application:
The added test addresses the previous review finding. No new actionable issues were found. Reviews (2) · Last reviewed commit: "test(android): cover startup and native ..." · Reviewed by Greptile |
This comment was marked as outdated.
This comment was marked as outdated.
RohitKushvaha01
approved these changes
Dec 6, 2026
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.
Fixes the startup crash
IllegalStateException: AppPreferences requires RuntimeBaseApplication to be initializedinSystemBarPlugin.initialize. It happens when the app is opened while Android is running a backup or restore in its process, which starts with the baseApplicationclass.AppPreferencesis initialized from the activity too, so it no longer depends onRuntimeBaseApplication.instance.Host/FTP thread pools no longer go throughinstance!!, which would have crashed on the first native call in the same situation.