-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TLHC platform views on Android 14/15 stop updating on resume #146499
Comments
Thanks for the report @evil159 #139630 (comment) for your reference. |
@darshankawar Indeed the issue on Samsung can be explained by that, but there is a separate bug on Pixels then. |
@darshankawar I've updated this issue accordingly, could you take a look at this again? I don't believe that the fix that Samsung is preparing for Galaxy will fix the issue on Pixel phones. |
I can reproduce the issue using the code sample and steps provided above. I turned on On the stable channel, the screen becomes unresponsive but on the master channel, nothing is rendered on the screen after returning from the background. The screen recordings were taking from the app running in release mode.
flutter doctor -v
|
I've been able to reproduce this issue on a Pixel 7 Pro. |
I added a lot of traces to the engine and this is my current understanding of the bug: After we resume the ImageReader.OnImageAvailableListener callback never fires again. We continue to render frames and notify the engine that a frame is available but the image reader is never notified and when we ask the imagereader for its latest frame null is returned. |
Another note: The difference between stable and master is because flutter/engine#50792 removed the cached first frame. That is, When stable resumes we use the last frame rendered before we were backgrounded. Both stable and master would be fixed if |
Was not able to reproduce with a pixel fold running an unreleased version of android 14. pipit-userdebug UpsideDownCake MASTER 93172441 dev-keys |
Was not able to reproduce with Nexus 6 running android 7.1.2 build number n2g47w |
I was able to reproduce on a pixel 6 running android 14 build number AP1A.240405.002 |
Today's update: We've tried versions of Flutter back to 2022 and none of them work correctly on Android 14 (to be more precise: there are some Android 14 builds that work and some that do not, early Android 15 builds are broken too). We have not reproduced this issue on Android < 14. Simplest reproduction steps:
We are trying to bisect on the Android side to understand more. |
Also, it does not appear related to having a cached engine. |
Also, rotating the phone will fix the app. |
A coworker bisected this issue using an emulator and was able to find that the problematic android change happened between between build 10480234 (from 7/11/2023) and build 10488473 (from 7/12/2023). Links for googlers
For the second build I can't find any records. |
Build names appear to be I think this url will let us search for changes but there were 1000 that landed. |
From the android team a better way to search commits. |
- Destroy ImageReaders on memory trim. - Unset the VirtualDisplay's surface on memory trim. - On resume, recreate ImageReaders. - On resume, do a dumb little dance and then set the VirtualDisplay's surface Fixes: flutter/flutter#146499 Fixes: flutter/flutter#144219 Internal bug: b/335646931 Android Fix: https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/27015418 Unclear when the Android fix will be available in phones.
- Destroy ImageReaders on memory trim. - Unset the VirtualDisplay's surface on memory trim. - On resume, recreate ImageReaders. - On resume, do a dumb little dance and then set the VirtualDisplay's surface Fixes: flutter/flutter#146499 Fixes: flutter/flutter#144219 Internal bug: b/335646931 Android Fix: https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/27015418 Unclear when the Android fix will be available in phones.
- Destroy ImageReaders on memory trim. - Unset the VirtualDisplay's surface on memory trim. - On resume, recreate ImageReaders. - On resume, do a dumb little dance and then set the VirtualDisplay's surface Fixes: flutter/flutter#146499 Fixes: flutter/flutter#144219 Internal bug: b/335646931 Android Fix: https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/27015418 Android 15 will include the fix. Unclear if Android 14 will be patched.
That’s a great effort from your team, people should see how the team is squeezing their brains to solve the flutter issues and make it a better framework |
- Destroy ImageReaders on memory trim. - Unset the VirtualDisplay's surface on memory trim. - On resume, recreate ImageReaders. - On resume, do a dumb little dance and then set the VirtualDisplay's surface Fixes: flutter/flutter#146499 Fixes: flutter/flutter#144219 Internal bug: b/335646931 Android Fix: https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/27015418 Android 15 will include the fix. Unclear if Android 14 will be patched.
- Destroy ImageReaders on memory trim. - Unset the VirtualDisplay's surface on memory trim. - On resume, recreate ImageReaders. - On resume, do a dumb little dance and then set the VirtualDisplay's surface Fixes: flutter/flutter#146499 Fixes: flutter/flutter#144219 Internal bug: b/335646931 Android Fix: https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/27015418 Android 15 will include the fix. Unclear if Android 14 will be patched.
- Destroy ImageReaders on memory trim. - Unset the VirtualDisplay's surface on memory trim. - On resume, recreate ImageReaders. - On resume, do a dumb little dance and then set the VirtualDisplay's surface Fixes: flutter/flutter#146499 Fixes: flutter/flutter#144219 Internal bug: b/335646931 Android Fix: https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/27015418 Android 15 will include the fix. Unclear if Android 14 will be patched.
- Destroy ImageReaders on memory trim. - Unset the VirtualDisplay's surface on memory trim. - On resume, recreate ImageReaders. - On resume, do a dumb little dance and then set the VirtualDisplay's surface Fixes: flutter/flutter#146499 Fixes: flutter/flutter#144219 Internal bug: b/335646931 Android Fix: https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/27015418 Android 15 will include the fix. Unclear if Android 14 will be patched.
- Destroy ImageReaders on memory trim. - Unset the VirtualDisplay's surface on memory trim. - On resume, recreate ImageReaders. - On resume, do a dumb little dance and then set the VirtualDisplay's surface Fixes: flutter/flutter#146499 Fixes: flutter/flutter#144219 Internal bug: b/335646931 Android Fix: https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/27015418 Android 15 will include the fix. Unclear if Android 14 will be patched.
This is a great job and thanks all for making this progress so far. |
@reidbaker I see this problem on both Pixel 4 and Pixel 7 Pro. However, my symptoms are somewhat different than this description.
Update: the Pixel 4 is actually running Android 13, not Android 14. The Pixel 7 Pro is running Android 14. Both exhibit the issue. So either this issue is not limited to Android 14, or there is another similar but not identical issue lurking that affects Android <14 too. |
Thank you to Flutter team for their hard work. |
3.22 has had the fix pr cherry picked into the engine. We are working on creating a new framework build that has the updated engine code. 3.22 is scheduled to land as stable sometime around the Google IO timeframe (next week). Standard response below. This issue has been fixed by flutter/engine#52370 To determine what versions of Flutter contain the fix, please see where’s my commit. If the commit has no release tag, it is currently only available in the master channel. |
Is this fixed in 3.22.0? Cannot find anything about flutter/engine#52370 in the release notes. |
I think the fix is merged in 3793869. I found that under flutter/engine/3.22.0. Also the fix was mentioned in What’s new in Flutter 3.22: Platform views improvements. |
I see that this issue is fixed with Flutter 3.22.0 for the mentioned steps, but I see this happening following different steps instead. Now if the platform view is your initial page and you press back button to move app to background, on launching again, you will see that the blank issue is reproducible. (Steps are similar to #148347) Another interesting thing is that after this, if you follow the steps for old issue i.e - switch from another recent app to sample app from recent apps launcher, the platform view starts working again. Edit: |
Promised update on the android fix. |
Steps to reproduce
I've created a new project with flutter create and integrated a simple test view on Android side as per https://docs.flutter.dev/platform-integration/android/platform-views.
Set up
FlutterEngine
cache as per Step 3 of this guide https://docs.flutter.dev/add-to-app/android/add-flutter-screen#step-3-optional-use-a-cached-flutterengine.Steps to reproduce
Developer option > Don't keep activities
is enabledEnvironment
Sample project: platform_view_test 3.zip
Expected results
The platform view hosted by Flutter app is displayed and interactive.
Actual results
Code sample
Code sample
Dart:
Platform side:
Screenshots or Video
Screenshots / Video demonstration
Screen_recording_20240409_135855.mp4
Logs
Logs
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: