Skip to content

fix(android): don't crash when launched in restricted backup mode - #3185

Merged
bajrangCoder merged 2 commits into
mainfrom
fix/restricted-backup-launch
Dec 6, 2026
Merged

bajrangCoder merged 2 commits into
mainfrom
fix/restricted-backup-launch

Conversation

@bajrangCoder

Copy link
Copy Markdown
Member

Fixes the startup crash IllegalStateException: AppPreferences requires RuntimeBaseApplication to be initialized in SystemBarPlugin.initialize. It happens when the app is opened while Android is running a backup or restore in its process, which starts with the base Application class.

  • AppPreferences is initialized from the activity too, so it no longer depends on RuntimeBaseApplication.instance.
  • The bridge and Host/FTP thread pools no longer go through instance!!, which would have crashed on the first native call in the same situation.

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.
@greptile-apps

greptile-apps Bot commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge.

Summary

The PR removes startup dependencies on the custom Android application:

  • Android startup and native calls work without the custom application instance.

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

@bajrangCoder

This comment was marked as outdated.

@bajrangCoder
bajrangCoder added this pull request to the merge queue Dec 6, 2026
Merged via the queue into main with commit 22d3e15 Dec 6, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Dec 6, 2026
@bajrangCoder
bajrangCoder deleted the fix/restricted-backup-launch branch December 6, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants