Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Workaround HardwareRenderer breakage in Android 14 #52370

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

johnmccutchan
Copy link
Contributor

  • 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.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:chef_kiss

Copy link
Contributor

@reidbaker reidbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good but I would expect that we had a test at least calling clear/reset surface and one making sure that the onTrimMemory was forwarded to the PlatformViewsController.

@reidbaker
Copy link
Contributor

Failing test is a trim memory test

public void ImageReaderSurfaceProducerTrimMemoryCallback() {

@johnmccutchan johnmccutchan force-pushed the image_reader_workaround branch 3 times, most recently from 8636f6e to f3c466d Compare April 29, 2024 23:18
@gmackall
Copy link
Member

Tested the latest version of this patch with a repro app shared by @johnmccutchan, by backgrounding the app and then repeatedly opening and backgrounding the built in camera app. Looks like it is working to me! Didn't experience any instances of the breakage

- 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.
@johnmccutchan johnmccutchan force-pushed the image_reader_workaround branch from f3c466d to f0a4719 Compare April 30, 2024 04:31
@johnmccutchan johnmccutchan added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 30, 2024
@auto-submit auto-submit bot merged commit ea63438 into flutter:main Apr 30, 2024
29 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 30, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 30, 2024
…147560)

flutter/engine@c519e9d...ea63438

2024-04-30 [email protected] Workaround HardwareRenderer breakage in Android 14 (flutter/engine#52370)

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
@reidbaker reidbaker added the cp: stable cherry pick to the stable release candidate branch label Apr 30, 2024
@flutteractionsbot
Copy link

Failed to create CP due to merge conflicts.
You will need to create the PR manually. See the cherrypick wiki for more info.

reidbaker pushed a commit to reidbaker/engine that referenced this pull request Apr 30, 2024
- 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.
reidbaker pushed a commit to reidbaker/engine that referenced this pull request Apr 30, 2024
- 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.
reidbaker pushed a commit to reidbaker/engine that referenced this pull request Apr 30, 2024
- 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.
@reidbaker reidbaker added the cp: beta cherry pick to the beta release candidate branch label May 1, 2024
@flutteractionsbot
Copy link

Failed to create CP due to merge conflicts.
You will need to create the PR manually. See the cherrypick wiki for more info.

reidbaker pushed a commit to reidbaker/engine that referenced this pull request May 1, 2024
- 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.
reidbaker pushed a commit to reidbaker/engine that referenced this pull request May 1, 2024
- 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.
@reidbaker reidbaker mentioned this pull request May 1, 2024
8 tasks
auto-submit bot pushed a commit that referenced this pull request May 1, 2024
- **Replace LinkedLists that are used as a queue in android FlutterRenderer with ArrayDeques (#51494)**
- **Workaround HardwareRenderer breakage in Android 14 (#52370)**
Fixes flutter/flutter#147644

Includes #51494 to avoid merge conflicts and have a cleaner merge.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App cp: beta cherry pick to the beta release candidate branch cp: stable cherry pick to the stable release candidate branch platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TLHC platform views on Android 14/15 stop updating on resume [Android] Virtual display - Surface view blank on App Resume
7 participants