fix(android): sync upstream SystemBars fixes #8480 and #8481
What
Syncs two SystemBars fixes that are merged in ionic-team/capacitor but missing from plus:
Plus one integration fix needed to make the two work together (details below).
Why
Both were carried by the stale upstream-sync branches, bundled with the "upstream-preferred fallback" resolution that renamed @capacitor-plus/* back to @capacitor/* and wiped the fork's changelogs. Stripping that damage from #71/#83/#85/#87/#88 also dropped these two genuine fixes on the floor. CodeRabbit flagged both as out-of-diff findings while reviewing #67, which is how they resurfaced.
They are worth having on their own merits:
insetsHandling: "disable"did not work. Upstream #8424 removed theinsetHandlingEnabledguard, so the listener was installed and insets were rewritten regardless of config. #67 restored the guard on the CSS injections; #8481 finishes the job by returning early frominitWindowInsetsListener, gatingonDOMReady, and validating the config value with a warning on unknown input.- Hiding the status bar also showed the navigation bar.
setHidden(false, "StatusBar")calledshow(Type.systemBars()), which covers both bars. #8480 narrows each branch to the bar actually requested and addsSystemBarsTest.
How
Cherry-picked d4ad7ff and 4c6c321 with git cherry-pick -x, preserving upstream authorship.
d4ad7ff conflicted with #67, which had just landed and reworks the same methods. Resolved by keeping #67's structure and layering #8481's config handling on top:
insetHandlingEnabled(boolean) becomesinsetsHandling(String), with all five call sites migrated toINSETS_HANDLING_CSS.equals(insetsHandling).- Kept #67's
ViewCompat.getRootWindowInsets(v)ininitSafeAreaCSSVariablesrather than upstream'sWindowInsetsCompat.CONSUMEDfallback, which yields zeros below API 35. - Kept #67's
ViewCompat.requestApplyInsets(parentView)inonDOMReadyover upstream'sgetBridge().getWebView().requestApplyInsets().
The third commit is a fork-specific integration fix. navBarVisible (added by #67) was only updated in the per-bar branches, but #8480 restructured setHidden so bar.isEmpty() — the path initSystemBars uses for the hidden config — hides or shows every bar at once. With hidden: true the navigation bar was hidden while navBarVisible stayed true, so the API < 30 safe-area fallback reported a nav bar height for a bar that was not on screen. Upstream cannot have this bug because navBarVisible only exists here.
Testing
bun run eslintandbun run prettier --checkpass locally.SystemBarsTest.javacomes from upstream #8480 and runs intest-android.- CI (setup / lint / test-cli / test-core / test-ios / test-android) runs on this PR.
Not Tested
- No on-device verification of
insetsHandling: "disable", of hiding a single bar, or of thenavBarVisiblefix on an API < 30 device. All three are reasoned from the code and upstream's intent.
Opened by an AI agent (Cursor).


Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.