fix(banner): add WebView version check and safe area handling - #428
fix(banner): add WebView version check and safe area handling#428luisbytes wants to merge 2 commits into
Conversation
rdlabo
left a comment
There was a problem hiding this comment.
Thank you for investigating the WebView 140 safe-area behavior and for testing this across multiple Android versions. The version-based condition looks reasonable, but one blocking issue remains.
BannerExecutor.java:113 still installs the inset listener on the Activity’s DecorView. This overrides the decor view’s own inset handling and can leave a persistent system-bar-colored artifact after rotation on Android 15 and 16. The listener is also not restored when the banner is removed.
Please attach the listener to mAdViewLayout instead, request insets after the banner container has been attached, and preserve the caller-configured banner margin when applying the top or bottom system inset. This should also be verified across rotation and banner removal.
Once the listener ownership is corrected, the WebView-version handling in this PR can be reconsidered for merge.
|
Thank you for investigating the WebView 140 safe-area behavior and for testing it across multiple Android and WebView versions. The margin regression reported in #390 has now been addressed by #431 with a narrower fix: the configured banner margins are preserved when Android system insets are applied. This PR changes the safe-area activation policy from an Android SDK check to a WebView-major-version check. That would broaden inset handling to older Android versions with WebView 140+, while disabling it on newer Android versions with older WebView releases. Since that policy change is not required to resolve #390 and needs a separate compatibility rationale and test scope, we are not including it in the margin fix. I am closing this PR as superseded by #431. Thanks again for the detailed research and contribution. |
Fixes: #390
Based on this PR ionic-team/capacitor#8384
The Capacitor plugin in System Bar (included in the @capacitor/android package) in version 8.3.0 manages the safe area based on the WebView version (140+). Historically, the safe area in the WebView never worked on Android until version 140, where it was patched. Also, based on this conversation ionic-team/capacitor#8424 (comment), I think the ideal solution would be to manage the banner's safe area based on the WebView version.
I tested the changes in this branch https://github.com/luisbytes/safe-area-admob/tree/patch/admob by patching the AdMob plugin with pnpm. I performed tests on Android 11, 14, 15, and 16 with WebView versions higher and lower than 140, and everything seems to work correctly. It might be good if someone could perform more tests, but I think this is better than the current solution.