Skip to content

fix: promote recorder services to foreground during init#160

Open
cizra wants to merge 1 commit into
Myzel394:masterfrom
cizra:alibi/fix-foreground-service-anr
Open

fix: promote recorder services to foreground during init#160
cizra wants to merge 1 commit into
Myzel394:masterfrom
cizra:alibi/fix-foreground-service-anr

Conversation

@cizra

@cizra cizra commented May 25, 2026

Copy link
Copy Markdown

Starting a recording could ANR with "Context.startForegroundService() did not then call Service.startForeground()" when camera setup or UI work ran between the startForegroundService() call and the eventual startForeground() invocation, blowing past Android's foreground-service deadline.

Promote the service during the init command, before any of the slow camera/rendering setup, so the deadline is satisfied unconditionally.

Code changes by Claude Opus running inside Pi.dev. I built and tested this commit, it works fine in my phone.
Depends on #158 to build and run.

Starting a recording could ANR with "Context.startForegroundService()
did not then call Service.startForeground()" when camera setup or UI
work ran between the startForegroundService() call and the eventual
startForeground() invocation, blowing past Android's foreground-service
deadline.

Promote the service during the init command, before any of the slow
camera/rendering setup, so the deadline is satisfied unconditionally.
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