Skip to content

[CP] Use PorterDuff blend mode when below Android 29 #108136

@bparrishMines

Description

@bparrishMines

issue_link

#104686

Commit Hash

092481d

Target

beta

pr_link

#108135

Impacted Users

Customers and plugins using Android Platform Views

Impact Description

On Android versions below 29, platform views struggle to render when the background is transparent:
something

Workaround

Any plugin or app that uses platform views could switch to Hybrid Composition when the background is made transparent.

Risk

low

Test Coverage

yes

Validation Steps

  1. Build a custom engine that changes:

https://github.com/flutter/engine/blob/main/shell/platform/android/io/flutter/plugin/platform/PlatformViewWrapper.java#L172

canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);

to

canvas.drawColor(Color.TRANSPARENT);
  1. Create a Flutter app with webview_flutter. The example app from the plugin also works: webview_flutter example app

  2. Set the background to transparent: https://github.com/flutter/plugins/blob/main/packages/webview_flutter/webview_flutter_android/example/lib/main.dart#L137

  3. Create and start an Android emulator as Nexus 4 API 28.

  4. Run the app and navigate through any webpage.

  5. Compare the result to adding the PorterDuff.Mode.CLEAR parameter in step 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cp: approvedApproved cherry-pick request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions