Android PlatformViews page back to non-platformview page, still glitch for one frame after this fix: https://github.com/flutter/engine/pull/30724/ #102508
Labels
a: platform-views
Embedding Android/iOS views in Flutter apps
engine
flutter/engine repository. See also e: labels.
platform-android
Android applications specifically
Steps to Reproduce
Friendly cc @blasten 😄
Screenrecord
By camera:
IMG_0176.MOV
By
adb screen record
:video.mp4
Screenshot:

Demo code:
CupertinoPageRoute Demo
Here's my diagnosis:
Firstly, the commit https://github.com/flutter/engine/pull/30724/files#diff-87fa95e503a7a95a32aee115dded76fc6f8ec76fc29c2d2c071b413df0c3a096R265
introduced the
isPaused
member, when isPaused is set to true, then thestopRenderingToSurface()
is not called any more:https://github.com/flutter/engine/pull/30724/files#diff-d3ae30246a95a9e78606b57b860941c4d74d5dfba9ecc394f202c9a62002531bR242
Let's see there's a variable named
isDisplayingFlutterUi
in FlutterRenderer.java :https://github.com/flutter/engine/blob/f6dd681d4ec88b86a80bd367e6e050ae4ef7ffc7/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java#L44
It controls the logic in
addIsDisplayingFlutterUiListener()
https://github.com/flutter/engine/blob/f6dd681d4ec88b86a80bd367e6e050ae4ef7ffc7/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java#L78
when
isDisplayingFlutterUi
is true, theaddIsDisplayingFlutterUiListener
will directly calls thelistener
on current java call stack.But in this issue's scenario, the code in
RevertImageView()
:renderSurface.attachToRenderer(renderer);
but not setisDisplayingFlutterUi
to false;addIsDisplayingFlutterUiListener
and runonDone.run()
directly on current stack.It will
onDone.run()
will call finishFrame() and will setoverlayView.setVisibility(View.GONE);
:But the gone of
FlutterImageView
is too early! And I think the first new frame rendering on SurfaceView is not ready yet. The previous image of SurfaceView shows the click state (with a gray shadow) of the button..I think the wrong stack is here:

After revert this commit, the original right stack is below:
The text was updated successfully, but these errors were encountered: