-
Notifications
You must be signed in to change notification settings - Fork 29.8k
[Android] Refactor ImageReaderSurfaceProducer restoration after app resumes
#175937
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
Conversation
ImageReaderSurfaceProducer restoration post-onResumeImageReaderSurfaceProducer restoration after app resumes
...src/flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java
Show resolved
Hide resolved
|
@camsim99 request here can you add an entry to the blog post for the next stable about android fixing a memory leak? |
Yes, I'll make sure to do that! |
|
autosubmit label was removed for flutter/flutter/175937, because - The status or check suite Linux linux_unopt has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
autosubmit label was removed for flutter/flutter/175937, because - The status or check suite Linux linux_unopt has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
Ok this Linux linux_unopt test keeps failing and it says it's an infra error which might be true. Seems like there's a time out running engine Android tests: https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20Engine%20Drone/3620423/overview. I wonder if anyone else is running into this. But also in the tests it is able to run, there's a failure: |
|
Turns out the tests here were failing because of this PR. There was a test that relied on a |
…fter app resumes (flutter/flutter#175937)
…fter app resumes (flutter/flutter#175937)
…fter app resumes (flutter/flutter#175937)
…fter app resumes (flutter/flutter#175937)
… resumes (flutter#175937) Refactors `FlutterRenderer` callback on app resume to restore its `ImageReaderSurfaceProducer`s to a public API that Flutter activities and fragments can call themselves `onResume` to fix a memory leak caused by a potentially infinite number of callbacks being created as new instances of the `FlutterEngine` are created. Fixes flutter#173770. Directly follows the @/jason-simmons recommendation in flutter#173770 (comment). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
… resumes (flutter#175937) Refactors `FlutterRenderer` callback on app resume to restore its `ImageReaderSurfaceProducer`s to a public API that Flutter activities and fragments can call themselves `onResume` to fix a memory leak caused by a potentially infinite number of callbacks being created as new instances of the `FlutterEngine` are created. Fixes flutter#173770. Directly follows the @/jason-simmons recommendation in flutter#173770 (comment). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…fter app resumes (flutter/flutter#175937)
… resumes (flutter#175937) Refactors `FlutterRenderer` callback on app resume to restore its `ImageReaderSurfaceProducer`s to a public API that Flutter activities and fragments can call themselves `onResume` to fix a memory leak caused by a potentially infinite number of callbacks being created as new instances of the `FlutterEngine` are created. Fixes flutter#173770. Directly follows the @/jason-simmons recommendation in flutter#173770 (comment). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Manual roll requested by tarrinneal@google.com flutter/flutter@7cd821c...a873a27 2025-10-16 30870216+gaaclarke@users.noreply.github.com [tool] makes listing a shader also as an asset a build failure (flutter/flutter#176866) 2025-10-16 engine-flutter-autoroll@skia.org Roll Packages from d062181 to 835dccb (7 revisions) (flutter/flutter#177100) 2025-10-16 jason-simmons@users.noreply.github.com Handle the new location of Perfetto in create_updated_flutter_deps.py (flutter/flutter#177099) 2025-10-16 matt.kosarek@canonical.com Implement dialog windows for the win32 platform (flutter/flutter#176309) 2025-10-16 rmolivares@renzo-olivares.dev `SelectableRegion` should not show flutter rendered context menu when web context menu is enabled (flutter/flutter#176855) 2025-10-16 jason-simmons@users.noreply.github.com Manual roll Skia to 2d9df7c70b6f (flutter/flutter#177074) 2025-10-16 31685655+SalehTZ@users.noreply.github.com feat: add `OptionsViewOpenDirection.mostSpace` to `RawAutocomplete` (flutter/flutter#172997) 2025-10-16 43054281+camsim99@users.noreply.github.com [Android] Refactor `ImageReaderSurfaceProducer` restoration after app resumes (flutter/flutter#175937) 2025-10-15 34465683+rkishan516@users.noreply.github.com Refactor: migrate fade upwards page transition builder to widgets (flutter/flutter#175560) 2025-10-15 fluttergithubbot@gmail.com Marks Windows windowing_test to be unflaky (flutter/flutter#176701) 2025-10-15 72062416+Yash-Dhrangdhariya@users.noreply.github.com fix: 🐛 Add equality and hashCode implementations to ScrollAwareImageProvider (flutter/flutter#175038) 2025-10-15 mohellebiabdessalem@gmail.com Updates `sliver_tree.1.dart` to use `MediaQuery.widthOf(context)` (flutter/flutter#176888) 2025-10-15 mdebbar@google.com [web] Fix focus issues in newer versions of Chrome (flutter/flutter#176938) 2025-10-15 jessiewong401@gmail.com [Android 16] Update `android_engine_vulkan_tests` to Test Against SDK 36 Emulator (flutter/flutter#176985) 2025-10-15 sokolovskyi.konstantin@gmail.com Fix key events interception by RadioGroup when no Radio is focused. (flutter/flutter#176335) 2025-10-15 21270878+elliette@users.noreply.github.com Update cherry-pick instructions to include instructions for pre-release CPs (flutter/flutter#177020) 2025-10-15 jason-simmons@users.noreply.github.com Manual roll Skia to c501c727a007 (flutter/flutter#177015) 2025-10-15 robert.ancell@canonical.com Update examples to latest Linux runner style (flutter/flutter#177033) 2025-10-15 59215665+davidhicks980@users.noreply.github.com [material/menu_anchor.dart] Create internal menu controller if external controller is changed to null. (flutter/flutter#176375) 2025-10-15 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fix - TalkBack does not announce list information (#174374)" (flutter/flutter#177062) 2025-10-14 robert.ancell@canonical.com Implement Regular Windows for Linux (flutter/flutter#176187) 2025-10-14 31510811+jwlilly@users.noreply.github.com Fix - TalkBack does not announce list information (flutter/flutter#174374) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC stuartmorgan@google.com,tarrinneal@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: 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
Fixes `SettingsChannelTest` failure that occurs when other Android embedding tests touch the singleton queue that the `SettingsChannel` manages. Instead of the test making assertions based on the theoretical generation number of `SentConfiguration`s added to the queue, the assertions are isntead made relative to the exaction generation number of those `SentConfiguration`s. Fixes #176413. I tested this fix in #175937; an example passing build: https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20Engine%20Drone/3641486/overview. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
… resumes (flutter#175937) Refactors `FlutterRenderer` callback on app resume to restore its `ImageReaderSurfaceProducer`s to a public API that Flutter activities and fragments can call themselves `onResume` to fix a memory leak caused by a potentially infinite number of callbacks being created as new instances of the `FlutterEngine` are created. Fixes flutter#173770. Directly follows the @/jason-simmons recommendation in flutter#173770 (comment). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Fixes `SettingsChannelTest` failure that occurs when other Android embedding tests touch the singleton queue that the `SettingsChannel` manages. Instead of the test making assertions based on the theoretical generation number of `SentConfiguration`s added to the queue, the assertions are isntead made relative to the exaction generation number of those `SentConfiguration`s. Fixes flutter#176413. I tested this fix in flutter#175937; an example passing build: https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20Engine%20Drone/3641486/overview. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Refactors
FlutterRenderercallback on app resume to restore itsImageReaderSurfaceProducers to a public API that Flutter activities and fragments can call themselvesonResumeto fix a memory leak caused by a potentially infinite number of callbacks being created as new instances of theFlutterEngineare created.Fixes #173770. Directly follows the @/jason-simmons recommendation in #173770 (comment).
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.