-
Notifications
You must be signed in to change notification settings - Fork 6k
[Android] Fix the issue of blank or frozen pages in shared engine scenarios #50947
Conversation
3a106f4 to
9dc2f82
Compare
|
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. |
johnmccutchan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expected behavior is: When a Flutter view detaches from the shared engine, the associated surface should be released. When the Flutter view re-attaches, a new surface should be created.
After #47358, no new surface is created when the Flutter view is attached again. This results in the Flutter view having no underlying surface, which causes the page to appear blank or freeze without responding.
Given your description, I would expect you to fix the bug that no new surface is created when the view is attached again. It looks like you've just removed calls to pause() which isn't addressing the root problem.
shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java
Show resolved
Hide resolved
It works fine after removing the call to pause() in the |
shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java
Show resolved
Hide resolved
8e998c3 to
508dc92
Compare
Why can't you just move the |
On one hand, I believe the call to As stated in the comments of the /**
* Invoked by the owner of this {@code FlutterSurfaceView} when it no longer wants to render a
* Flutter UI to this {@code FlutterSurfaceView}.
*
* <p>This method will cease any on-going rendering from Flutter to this {@code
* FlutterSurfaceView}.
*/
public void detachFromRenderer() {
...
}Calling On the other hand, if public void resume() {
if (flutterRenderer == null) {
Log.w(TAG, "resume() invoked when no FlutterRenderer was attached.");
return;
}
this.flutterRenderer.addIsDisplayingFlutterUiListener(flutterUiDisplayListener);
// If we're already attached to an Android window then we're now attached to both a renderer
// and the Android window. We can begin rendering now.
if (isSurfaceAvailableForRendering()) {
Log.v(
TAG,
"Surface is available for rendering. Connecting FlutterRenderer to Android surface.");
connectSurfaceToRenderer();
}
isPaused = false;
} |
|
Thanks for your patience and explanations. I believe you're correct and will land this PR soon |
…145581) flutter/engine@5a12de1...f9a34ae 2024-03-22 [email protected] [Android] Fix the issue of blank or frozen pages in shared engine scenarios (flutter/engine#50947) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
|
Failed to create CP due to merge conflicts. |
…narios (flutter#50947) Consider this scenario: In an add-to-app context, where multiple Flutter activities share the same engine, a situation occurs. When navigating from FlutterActivity1 to FlutterActivity2, the Flutter view associated with FlutterActivity1 is detached from the engine. Then, the Flutter view of FlutterActivity2 is attached. Upon navigating back to FlutterActivity1, its Flutter view is re-attached to the shared engine. The expected behavior is: When a Flutter view detaches from the shared engine, the associated surface should be released. When the Flutter view re-attaches, a new surface should be created. After flutter#47358, no new surface is created when the Flutter view is attached again. This results in the Flutter view having no underlying surface, which causes the page to appear blank or freeze without responding. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Consider this scenario: In an add-to-app context, where multiple Flutter activities share the same engine, a situation occurs. When navigating from FlutterActivity1 to FlutterActivity2, the Flutter view associated with FlutterActivity1 is detached from the engine. Then, the Flutter view of FlutterActivity2 is attached. Upon navigating back to FlutterActivity1, its Flutter view is re-attached to the shared engine.
The expected behavior is: When a Flutter view detaches from the shared engine, the associated surface should be released. When the Flutter view re-attaches, a new surface should be created.
After #47358, no new surface is created when the Flutter view is attached again. This results in the Flutter view having no underlying surface, which causes the page to appear blank or freeze without responding.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.