Skip to content

[WIP] Fix background flicker when toBack is true#336

Open
Codex wants to merge 2 commits intomainfrom
codex/fix-background-flicker-issue
Open

[WIP] Fix background flicker when toBack is true#336
Codex wants to merge 2 commits intomainfrom
codex/fix-background-flicker-issue

Conversation

@Codex
Copy link
Copy Markdown
Contributor

@Codex Codex AI commented Apr 10, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>bug: toBack: true makes background to flicker</issue_title>
<issue_description>## Bug Report

Capacitor Version

 Capacitor Doctor

Latest Dependencies:

  @capacitor/cli: 8.3.0
  @capacitor/core: 8.3.0
  @capacitor/android: 8.3.0
  @capacitor/ios: 8.3.0

Installed Dependencies:

  @capacitor/cli: 8.3.0
  @capacitor/core: 8.3.0
  @capacitor/ios: 8.3.0
  @capacitor/android: 8.3.0

[success] Android looking great! 👌

Plugin Version

│
▲   💊   Capgo Doctor  💊
│
●   App Name: test
│
●   App ID: test.app
│
●   App Version: 1.0.0
│
●   Web Dir: dist
│
●   OS: win32 Windows 11 IoT Enterprise LTSC 2024
│
●   Node: v24.14.1
│
●   Installed Dependencies:
│
●     @capgo/cli: 7.91.0
│
●     @capgo/camera-preview: 8.3.0
│
◇  Latest Dependencies:
│
●     @capgo/cli: 7.91.0
│
●     @capgo/camera-preview: 8.3.0
│
◆  ✅ All dependencies are up to date

context(s)

ManualModel: false
AutoMode: false
CapgoCloud: false
OnPremise: false

Platform(s)

Android 16, Google Pixel 9

Current Behavior

When CameraPreview.start() is called with toBack: true, the system status bar and bottom navigation bar flicker rapidly and change background colors. Setting toBack to false, makes the flicker go away.

Expected Behavior

System status bar and bottom navigation bar should not flicker with toBack: true.

Code Reproduction

I used Capacitor's template (pnpm create @capacitor/app@latest) and just added CameraPreview.start() to JS file.

https://github.com/dBaliukynas/capgo-camera-preview-bug

Other Technical Details

pnpm --version output: 10.33.0

node --version output: v24.14.1

pod --version output (iOS issues only):

Additional Context

capgo.mp4

</issue_description>

Comments on the Issue (you are @codex[agent] in this section)

@Codex Codex AI assigned Codex and riderx Apr 10, 2026
@Codex Codex AI linked an issue Apr 10, 2026 that may be closed by this pull request
Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>
@Codex Codex AI requested a review from riderx April 10, 2026 17:34
@riderx riderx marked this pull request as ready for review April 23, 2026 08:06
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6e95932406

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1548 to +1550
if (!toBack) {
return;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore system UI before returning on non-toBack start

This early return skips cleanup when a previous session already locked system bars for toBack=true. In a valid flow like start({ force: true, toBack: false }), the old session is stopped without calling stop(), so originalStatusBarColor/originalNavigationBarColor remain cached and the status/navigation bars stay forced to opaque colors (and contrast disabled on Android Q+) even though the new session is not toBack; this leaves the app UI in an incorrect state until a later explicit restore path runs.

Useful? React with 👍 / 👎.

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.

bug: toBack: true makes background to flicker

2 participants