Skip to content

Conversation

@gmackall
Copy link
Member

@gmackall gmackall commented Jun 25, 2025

Fixes the version of #162147 that repros on 3.32 (but not the version that the original submitter experiences on 3.27 - I've not been able to reproduce that issue). See #162147 (comment)

Result of bisecting #162147 to #165942

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added platform-android Android applications specifically engine flutter/engine related. See also e: labels. team-android Owned by Android platform team labels Jun 25, 2025
@gmackall
Copy link
Member Author

cc @matanlurey - I expect I'll request your review on this as you reviewed the original #165942. Do you happen to have any idea of what a test would look like for this?

I can go figure it out if not, but I'm not sure what type of tests we've commonly written in these device specific cases (for devices we don't have on ci).

@gmackall
Copy link
Member Author

gmackall commented Jun 27, 2025

Also, I expected this to break background video playing on <14, as #165942 is listed as fixing it. But I'm still able to run background video on android 10, from what I can tell (unless I don't understand the way in which it was broken):

background_play.webm

@emakar
Copy link
Contributor

emakar commented Jun 27, 2025

One of the scenarios where video disappears is to quickly pause and resume (within 700ms)
see discussion in #163520, #156488

@gmackall
Copy link
Member Author

gmackall commented Jul 2, 2025

One of the scenarios where video disappears is to quickly pause and resume (within 700ms) see discussion in #163520, #156488

Thanks, WTAL and try to repro

@matanlurey
Copy link
Contributor

I'd have to spend more time reloading the full context, but as far as I remember it:

  • We used to never release background image readers
  • McCutch added a (hack/feature/fix) to release background image readers due to the Android 14 PM (Android SDK bug)
  • I (with @camsim99 and Jonah) realized that releasing background image readers, while potentially critical for platform views (that was the source of the Android 14 PM), caused a number of other problems, and decided to instead only release background image readers for (a) Platform Views (b) on the specific version that caused the PM.

The confusing part of this PR is that you're changing how/when platform views are released (private static PlatformViewRenderTarget makePlatformViewRenderTarget), but testing image textures (i.e. Video Player). Video Player, at least on Android, does not use platform views - so I don't understand the connection between this PR and the bug it's supposed to be fixing.

I would get an initial review and potentially pair with @camsim99 on this first, or @reidbaker for platform views - Camille has been working diligently on trying to fix bugs / improve functionality related to SurfaceProducer, and at first glance it's a surprise (to me) that we'd want to go back to releasing image readers again, or how this is related to the bugs mentioned (or video player).

@gmackall
Copy link
Member Author

gmackall commented Jul 7, 2025

I'd have to spend more time reloading the full context, but as far as I remember it:

  • We used to never release background image readers
  • McCutch added a (hack/feature/fix) to release background image readers due to the Android 14 PM (Android SDK bug)
  • I (with @camsim99 and Jonah) realized that releasing background image readers, while potentially critical for platform views (that was the source of the Android 14 PM), caused a number of other problems, and decided to instead only release background image readers for (a) Platform Views (b) on the specific version that caused the PM.

The confusing part of this PR is that you're changing how/when platform views are released (private static PlatformViewRenderTarget makePlatformViewRenderTarget), but testing image textures (i.e. Video Player). Video Player, at least on Android, does not use platform views - so I don't understand the connection between this PR and the bug it's supposed to be fixing.

Hmm, I'm not testing for Image textures though, am I? If you look at the video I'm testing for video players platform view mode, which makes a platform view https://github.com/flutter/packages/blob/2c52f245e232d6722530e5538bc61b12e5cbf6cd/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/platformview/PlatformVideoView.java
unless I'm misunderstanding how the plugin works.

I would get an initial review and potentially pair with @camsim99 on this first, or @reidbaker for platform views - Camille has been working diligently on trying to fix bugs / improve functionality related to SurfaceProducer, and at first glance it's a surprise (to me) that we'd want to go back to releasing image readers again, or how this is related to the bugs mentioned (or video player).

This is related because the linked bug is related to platform views, and also because it is a direct bisect of Jonah's original PR which caused the regression. It was also Jonah's suggestion when I mentioned the regression to him.

The video here is just to make sure that in fixing the regression from Jonah's change, we aren't also introducing a new regression (because the initial change Jonah made was intended to fix background video playing)

@gmackall gmackall marked this pull request as ready for review July 7, 2025 19:21
@gmackall gmackall requested a review from a team as a code owner July 7, 2025 19:21
@gmackall gmackall requested a review from matanlurey July 7, 2025 19:21
Copy link
Contributor

@mboetger mboetger left a comment

Choose a reason for hiding this comment

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

In the @config annotations - use the minSDK and maxSDK where you can.

@gmackall gmackall requested a review from mboetger July 7, 2025 20:01
Copy link
Contributor

@mboetger mboetger left a comment

Choose a reason for hiding this comment

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

LGTM

@gmackall gmackall added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 7, 2025
@reidbaker
Copy link
Contributor

@gmackall can you include in the pr description the bisected change that was at fault and the issue that pr was attempting to solve?

private static PlatformViewRenderTarget makePlatformViewRenderTarget(
TextureRegistry textureRegistry) {
if (enableSurfaceProducerRenderTarget && Build.VERSION.SDK_INT >= API_LEVELS.API_29) {
TextureRegistry.SurfaceLifecycle lifecycle =
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider a comment with what information you used to determine that manual surface lifecycle made sense on api 35 and above.

Copy link
Member Author

@gmackall gmackall Jul 7, 2025

Choose a reason for hiding this comment

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

I didn't make any decision on >= 35 here, but there have been no crashes on that level those levels so I'd prefer to leave it alone, considering this is likely to be cherry picked

@gmackall
Copy link
Member Author

gmackall commented Jul 7, 2025

@gmackall can you include in the pr description the bisected change that was at fault and the issue that pr was attempting to solve?

added the original pr to the description

@gmackall gmackall added autosubmit Merge PR when tree becomes green via auto submit App and removed autosubmit Merge PR when tree becomes green via auto submit App labels Jul 7, 2025
@gmackall gmackall added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 7, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Jul 7, 2025
Merged via the queue into flutter:master with commit df21e0b Jul 7, 2025
177 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 7, 2025
@gmackall gmackall added cp: beta cherry pick this pull request to beta release candidate branch cp: stable cherry pick this pull request to stable release candidate branch labels Jul 7, 2025
@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.

1 similar comment
@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.

@gmackall
Copy link
Member Author

gmackall commented Jul 7, 2025

One of the scenarios where video disappears is to quickly pause and resume (within 700ms) see discussion in #163520, #156488

Thanks, WTAL and try to repro

Also (I realized I forgot to reply here) FYI I did try but did not encounter this issue, so I hopefully that means the fix did not regress what the original change was meant to fix.

auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jul 8, 2025
flutter/flutter@28a4e85...adffe24

2025-07-08 [email protected] Roll Skia from 0669913308d3 to e159882c6ce0 (1 revision) (flutter/flutter#171766)
2025-07-08 [email protected] Roll Skia from 36b1f71fc14f to 0669913308d3 (4 revisions) (flutter/flutter#171756)
2025-07-08 [email protected] Roll Skia from f35536730dea to 36b1f71fc14f (3 revisions) (flutter/flutter#171751)
2025-07-08 [email protected] Roll Skia from 05374bbe5377 to f35536730dea (1 revision) (flutter/flutter#171744)
2025-07-08 [email protected] Roll Skia from 4968a30d721c to 05374bbe5377 (2 revisions) (flutter/flutter#171742)
2025-07-08 [email protected] Roll Skia from ad5c330487f7 to 4968a30d721c (8 revisions) (flutter/flutter#171739)
2025-07-08 [email protected] feat: Use engine_stamp.json in flutter tool (flutter/flutter#171454)
2025-07-08 [email protected] [ Tool ] Remove long-deprecated `make-host-app-editable` (flutter/flutter#171715)
2025-07-07 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Bump warn and error versions of agp, kotlin and gradle versions in preparation for gradle 9 (#171399)" (flutter/flutter#171736)
2025-07-07 [email protected] Bump warn and error versions of agp, kotlin and gradle versions in preparation for gradle 9 (flutter/flutter#171399)
2025-07-07 [email protected] [android] release background image readers on <= Android 14 (flutter/flutter#171193)
2025-07-07 [email protected] [ Tool ] Fix crash when SIGQUIT is sent to enable the VM service for `flutter analyze --watch` (flutter/flutter#171713)
2025-07-07 [email protected] Roll Skia from 47a5693d191a to ad5c330487f7 (2 revisions) (flutter/flutter#171716)
2025-07-07 [email protected] Run hot_reload_web_test.dart on Mac/Windows (flutter/flutter#171279)
2025-07-07 [email protected] Roll Fuchsia Linux SDK from 2DeZD1utFrnSwUfVT... to AinHuT0vgOelA1g7_... (flutter/flutter#171700)
2025-07-07 [email protected] [ Tool ] Prepare for enabling `omit_obvious_*_types` and `specify_nonobvious_*_types` (flutter/flutter#171651)
2025-07-07 [email protected] Roll Packages from e4fd6c0 to 2c52f24 (1 revision) (flutter/flutter#171705)

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 [email protected],[email protected] 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
auto-submit bot pushed a commit that referenced this pull request Jul 8, 2025
…171737)

CP of #171193. 

Template:

- Impacted Users (Approximately who will hit this issue, ex. all Flutter devs, Windows developers, all end-customers, apps using X framework feature).

All end users on Android 10-13 (inclusive) using an app with platform views.

- Impact Description (What is the impact? ex. visual jank on Samsung phones, app crash, cannot ship an iOS app. Does it impact development? ex. flutter doctor crashes when Android Studio is installed. Or shipping a production app? ex. the app crashes on launch).

Full app crash when backgrounding and then bringing the app back up.

- Workaround (Is there a workaround for this issue?)

No workaround.

- Risk (What is the risk level of this cherry-pick?)

Medium

- Test Coverage (Are you confident that your fix is well-tested by automated tests?)

No

- Validation Steps (What are the steps to validate that this fix works?)

Launch an app with platform views on these api levels and background them, and then bring the app back up.
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
…171193)

Fixes the version of flutter#162147
that repros on 3.32 (but not the version that the original submitter
experiences on 3.27 - I've not been able to reproduce that issue). See
flutter#162147 (comment)

Result of bisecting flutter#162147 to
flutter#165942

## 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].

<!-- 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

---------

Co-authored-by: Gray Mackall <[email protected]>
azatech pushed a commit to azatech/flutter that referenced this pull request Jul 28, 2025
…171193)

Fixes the version of flutter#162147
that repros on 3.32 (but not the version that the original submitter
experiences on 3.27 - I've not been able to reproduce that issue). See
flutter#162147 (comment)

Result of bisecting flutter#162147 to
flutter#165942

## 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].

<!-- 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

---------

Co-authored-by: Gray Mackall <[email protected]>
vashworth pushed a commit to vashworth/packages that referenced this pull request Jul 30, 2025
…r#9580)

flutter/flutter@28a4e85...adffe24

2025-07-08 [email protected] Roll Skia from 0669913308d3 to e159882c6ce0 (1 revision) (flutter/flutter#171766)
2025-07-08 [email protected] Roll Skia from 36b1f71fc14f to 0669913308d3 (4 revisions) (flutter/flutter#171756)
2025-07-08 [email protected] Roll Skia from f35536730dea to 36b1f71fc14f (3 revisions) (flutter/flutter#171751)
2025-07-08 [email protected] Roll Skia from 05374bbe5377 to f35536730dea (1 revision) (flutter/flutter#171744)
2025-07-08 [email protected] Roll Skia from 4968a30d721c to 05374bbe5377 (2 revisions) (flutter/flutter#171742)
2025-07-08 [email protected] Roll Skia from ad5c330487f7 to 4968a30d721c (8 revisions) (flutter/flutter#171739)
2025-07-08 [email protected] feat: Use engine_stamp.json in flutter tool (flutter/flutter#171454)
2025-07-08 [email protected] [ Tool ] Remove long-deprecated `make-host-app-editable` (flutter/flutter#171715)
2025-07-07 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Bump warn and error versions of agp, kotlin and gradle versions in preparation for gradle 9 (#171399)" (flutter/flutter#171736)
2025-07-07 [email protected] Bump warn and error versions of agp, kotlin and gradle versions in preparation for gradle 9 (flutter/flutter#171399)
2025-07-07 [email protected] [android] release background image readers on <= Android 14 (flutter/flutter#171193)
2025-07-07 [email protected] [ Tool ] Fix crash when SIGQUIT is sent to enable the VM service for `flutter analyze --watch` (flutter/flutter#171713)
2025-07-07 [email protected] Roll Skia from 47a5693d191a to ad5c330487f7 (2 revisions) (flutter/flutter#171716)
2025-07-07 [email protected] Run hot_reload_web_test.dart on Mac/Windows (flutter/flutter#171279)
2025-07-07 [email protected] Roll Fuchsia Linux SDK from 2DeZD1utFrnSwUfVT... to AinHuT0vgOelA1g7_... (flutter/flutter#171700)
2025-07-07 [email protected] [ Tool ] Prepare for enabling `omit_obvious_*_types` and `specify_nonobvious_*_types` (flutter/flutter#171651)
2025-07-07 [email protected] Roll Packages from e4fd6c0 to 2c52f24 (1 revision) (flutter/flutter#171705)

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 [email protected],[email protected] 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
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
…171193)

Fixes the version of flutter#162147
that repros on 3.32 (but not the version that the original submitter
experiences on 3.27 - I've not been able to reproduce that issue). See
flutter#162147 (comment)

Result of bisecting flutter#162147 to
flutter#165942

## 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].

<!-- 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

---------

Co-authored-by: Gray Mackall <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cp: beta cherry pick this pull request to beta release candidate branch cp: stable cherry pick this pull request to stable release candidate branch engine flutter/engine related. See also e: labels. platform-android Android applications specifically team-android Owned by Android platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants