Skip to content

Add didInjectView callback to PrebidMobilePluginRenderer - #941

Open
MattMur wants to merge 3 commits into
prebid:masterfrom
MattMur:rendering_final_pass
Open

Add didInjectView callback to PrebidMobilePluginRenderer#941
MattMur wants to merge 3 commits into
prebid:masterfrom
MattMur:rendering_final_pass

Conversation

@MattMur

@MattMur MattMur commented Apr 27, 2026

Copy link
Copy Markdown

Summary

This PR addresses a few issues I ran into while working with the plugin renderer system.

1. getPreferredPluginRendererName() returns null by default
When a bid response doesn't include a renderer key in its meta, getPreferredPluginRendererName() is returning null. This leads to a live production bug where the if condition in BannerView.displayPrebidView that can never be hit, since by default it will always evaluate to false.

Fix: Set PrebidRenderer as the default for getPreferredPluginRendererName()

2. Final layout responsibility should be given to chosen PluginRenderer
Layout parameters for the injected ad view are being set directly inside BannerView. Since BannerView doesn't have visibility into how a given renderer intends to display its content, this feels like the wrong place for this logic. The renderer itself is best positioned to own those decisions — it knows the ad format, creative dimensions, and any renderer-specific requirements.

Fix: Add new callback to the PrebidMobilePluginRenderer to notify it once the ad has been injected so it can manage the final layout.

3. MATCH_PARENT is the wrong default for fixed-size banner ads
Due to the bug from issue#1, MATCH_PARENT is always being set on the injected view. This is a potential source of issues since ideally the PrebidRenderer wants the size to be controlled by logic in PrebidWebView, and the outer DisplayView should simply WRAP_CONTENT.

Fix: Use the new didInjectView method on PrebidRenderer to set WRAP_CONTENT with center gravity.

Testing

I've tested these fixes on the PrebidInternalTestApp using every "Banner" "In-app" variant, and each one looks and behaves as expected.

Parallel PR for iOS PR 1261

@MattMur MattMur changed the title Rendering final pass Give final rendering pass to plugin renderer Apr 27, 2026
@MattMur MattMur changed the title Give final rendering pass to plugin renderer Add didInjectView callback to PrebidMobilePluginRenderer Apr 27, 2026

@postindustria-code postindustria-code left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please, add unit tests covering updated behaviour. Everything else LGTM

@YuriyVelichkoPI

Copy link
Copy Markdown
Contributor

@MattMur will you be able to add tests? If you don't have time for it now, let me know and we create follow-up ticket and merge this one

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.

3 participants