Skip to content

Android platform views sometimes render previously drawn content after a screen rotation #155787

@jason-simmons

Description

@jason-simmons

After a screen rotation, an Android platform view will sometimes show the results of a previous onDraw call instead of the most recent onDraw.

To reproduce:

Then run the app with:

  • cd dev/integration_tests/native_driver_test
  • flutter run -t lib/platform_view_blue_orange_gradient_main.dart

This app instantiates a platform view that fills the view's canvas with a LinearGradient shader. The parameters of the shader are updated after a screen rotation or other size change.

With this patch, the app should show a red gradient in portrait mode and a blue gradient in landscape mode. But if I rotate the app many times on some devices, then the screen will sometimes render the red gradient after a rotation into landscape mode.

I've been able to reproduce this on a Pixel 6a (API level 32) and an Android API 33 emulator.

The platform_view_blue_orange_gradient_portrait_post_rotation Skia Gold test uses this app. That test has had some flakes where the screenshot looks like it rendered landscape content when the test expected portrait.

@johnmccutchan @matanlurey

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: layoutSystemChrome and Framework's Layout Issuesa: platform-viewsEmbedding Android/iOS views in Flutter appsfound in release: 3.24Found to occur in 3.24found in release: 3.26Found to occur in 3.26has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-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