Skip to content

Eliminate the need to conditionalize context wrapping in Android platform views #113449

@stuartmorgan-g

Description

@stuartmorgan-g

In flutter/engine#35233 I unified the platform view creation flow for the different Android platform view modes, since fallback requires inspecting the returned view hierarchy before deciding on a mode. The only difference prior to that change was that HC passed the actual Context, whereas VD and TLHC wrapped the context in a MutableContextWrapper and passed that, since VD mode requires modifying the context later.

I expected this to be a no-op, since it should just proxy everything to the initial context. In practice, this isn't the case; it caused b/249389618, which is a case of HC showing a platform view sometimes in cases when it shouldn't actually be on screen. The non-internal repro steps for that bug are:

With the MutableContextWrapper, the map is covering most of the resulting screen even though it's no longer part of the widget hierarchy. Without it, the screen is (correctly) mostly empty.

As a short-term fix for the regression, I'm going to stop wrapping the context when HC mode is explicitly requested, since that restores the pre-flutter/engine#35233 behavior for the HC codepath. That's not the right long-term fix though:

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsengineflutter/engine related. See also e: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions