Repository navigation
Reland "Apply rect clipping to surface views" - #184732
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements clipping for Android SurfaceView platform views on API 34+ by calculating clipping bounds from the mutators stack and applying them through SurfaceControl.Transaction. It includes a new integration test and removes the corresponding limitation from the documentation. Feedback identifies that SurfaceControl.Transaction objects are missing required .apply() calls and suggests using the Flutter viewId in log messages for improved debugging.
|
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. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
This reverts commit 3a19325.
flutter/flutter@a0924c7...05e0ae0 2026-04-08 [email protected] Fix Android engine flags defaulting to true for malformed values (flutter/flutter#184631) 2026-04-08 [email protected] Try one more again (flutter/flutter#184767) 2026-04-08 [email protected] Remove custom `analysis_options.yaml` from `imitation_game_flutter` (flutter/flutter#184717) 2026-04-08 [email protected] Add more error handling to unawaited callsites (flutter/flutter#184526) 2026-04-08 [email protected] Refactor: remove material from absorb_ponter_test, container_test, lookup_boundary_test, page_view_test, router_test, semantics_clipping_test, semantics_merge_test, shadow_test, text_test (flutter/flutter#183309) 2026-04-08 [email protected] Remove editable_text_utils cross-imports from material and cupertino … (flutter/flutter#184519) 2026-04-08 [email protected] Replace hard coded max path length with system defined one. (flutter/flutter#184697) 2026-04-08 [email protected] [Re-land] Add Support For Built-in Kotlin (flutter/flutter#184745) 2026-04-08 [email protected] Manually stop and continue LLDB breakpoints on Xcode 26.4+ (flutter/flutter#184690) 2026-04-08 [email protected] Code freeze workflow (flutter/flutter#184246) 2026-04-08 [email protected] [Dot shorthands] Migrate examples/api/lib/widgets (flutter/flutter#183965) 2026-04-08 [email protected] [cupertino.dart] Implement CupertinoMenuAnchor and CupertinoMenuItem using RawMenuAnchor (flutter/flutter#182036) 2026-04-08 [email protected] [Semantics] clarify Android header docs (flutter/flutter#183573) 2026-04-08 [email protected] [ci] mac build_test bringup false (flutter/flutter#184738) 2026-04-08 [email protected] Reland "Apply rect clipping to surface views" (flutter/flutter#184732) 2026-04-08 [email protected] Remove bringup label for resharded Windows tool_integration_tests shards (flutter/flutter#184721) 2026-04-08 [email protected] Tool: Add search and filtering to widget preview scaffold (flutter/flutter#184023) 2026-04-08 [email protected] Update localization from translation console (flutter/flutter#184742) 2026-04-07 [email protected] Revert "Add Support For Built-in Kotlin (#184227)" (flutter/flutter#184739) 2026-04-07 [email protected] Collect HCPP adoption analytics for flutter run/build apk/build appbundle (flutter/flutter#184225) 2026-04-07 [email protected] Add a github workflow for reverting PRs. (flutter/flutter#184593) 2026-04-07 [email protected] Add Support For Built-in Kotlin (flutter/flutter#184227) 2026-04-07 [email protected] Revert "Apply rect clipping to surface views (#184471)" (flutter/flutter#184728) 2026-04-07 [email protected] [Fix-forward] Added Compose plugin to Add-to-app Integration Test (flutter/flutter#184681) 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
Relands flutter#184471 which [was reverted](flutter#184728) because of suspected skia gold bug where the triage button was not working for the created digests. I also changed the names of the output files just in case, to make sure the state doesn't collide with old.
…r#11470) flutter/flutter@a0924c7...05e0ae0 2026-04-08 [email protected] Fix Android engine flags defaulting to true for malformed values (flutter/flutter#184631) 2026-04-08 [email protected] Try one more again (flutter/flutter#184767) 2026-04-08 [email protected] Remove custom `analysis_options.yaml` from `imitation_game_flutter` (flutter/flutter#184717) 2026-04-08 [email protected] Add more error handling to unawaited callsites (flutter/flutter#184526) 2026-04-08 [email protected] Refactor: remove material from absorb_ponter_test, container_test, lookup_boundary_test, page_view_test, router_test, semantics_clipping_test, semantics_merge_test, shadow_test, text_test (flutter/flutter#183309) 2026-04-08 [email protected] Remove editable_text_utils cross-imports from material and cupertino … (flutter/flutter#184519) 2026-04-08 [email protected] Replace hard coded max path length with system defined one. (flutter/flutter#184697) 2026-04-08 [email protected] [Re-land] Add Support For Built-in Kotlin (flutter/flutter#184745) 2026-04-08 [email protected] Manually stop and continue LLDB breakpoints on Xcode 26.4+ (flutter/flutter#184690) 2026-04-08 [email protected] Code freeze workflow (flutter/flutter#184246) 2026-04-08 [email protected] [Dot shorthands] Migrate examples/api/lib/widgets (flutter/flutter#183965) 2026-04-08 [email protected] [cupertino.dart] Implement CupertinoMenuAnchor and CupertinoMenuItem using RawMenuAnchor (flutter/flutter#182036) 2026-04-08 [email protected] [Semantics] clarify Android header docs (flutter/flutter#183573) 2026-04-08 [email protected] [ci] mac build_test bringup false (flutter/flutter#184738) 2026-04-08 [email protected] Reland "Apply rect clipping to surface views" (flutter/flutter#184732) 2026-04-08 [email protected] Remove bringup label for resharded Windows tool_integration_tests shards (flutter/flutter#184721) 2026-04-08 [email protected] Tool: Add search and filtering to widget preview scaffold (flutter/flutter#184023) 2026-04-08 [email protected] Update localization from translation console (flutter/flutter#184742) 2026-04-07 [email protected] Revert "Add Support For Built-in Kotlin (#184227)" (flutter/flutter#184739) 2026-04-07 [email protected] Collect HCPP adoption analytics for flutter run/build apk/build appbundle (flutter/flutter#184225) 2026-04-07 [email protected] Add a github workflow for reverting PRs. (flutter/flutter#184593) 2026-04-07 [email protected] Add Support For Built-in Kotlin (flutter/flutter#184227) 2026-04-07 [email protected] Revert "Apply rect clipping to surface views (#184471)" (flutter/flutter#184728) 2026-04-07 [email protected] [Fix-forward] Added Compose plugin to Add-to-app Integration Test (flutter/flutter#184681) 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
) Previously, the clipping was behind by 1 frame. This is because `onDisplayPlatformView2()` was getting called after `jni_facade->swapTransaction()`, and so was adding new pending transactions after the swap from pending to active (and so the clips were lagging for a frame, waiting till next frame to be made active). We need to call `jni_facade->swapTransaction()` last. The ordering (c++ bug) was introduced in flutter#181009 in combination with flutter#184732 See videos: <table width="100%"> <thead> <tr> <th align="center">With Change (After)</th> <th align="center">Without Change (Before)</th> </tr> </thead> <tbody> <tr> <td align="center" width="50%"> <video src="https://github.com/user-attachments/assets/d9fedd3a-d7a8-4040-bc2e-dae555d1a4ad" controls="controls" style="max-width: 100%;"></video> </td> <td align="center" width="50%"> <video src="https://github.com/user-attachments/assets/118cae5f-9996-425d-b8f3-9e0f965f841d" controls="controls" style="max-width: 100%;"></video> </td> </tr> </tbody> </table>
…d FlutterView (flutter#190612) `PlatformViewsController2.onEndFrame()` dereferenced `flutterView` and the result of `flutterView.getRootSurfaceControl()` without checking either for null. `AndroidExternalViewEmbedder2::SubmitFlutterView()` posts `onEndFrame2()` from the raster thread to the platform thread on every frame, including frames with no platform layers. By the time the task runs, the `FlutterView` may have been detached from the controller, in which case `detachFromView()` has set `flutterView` to null, or detached from its window, in which case `View.getRootSurfaceControl()` returns null. The resulting `NullPointerException` is not merely logged. The JNI call ends with `FML_CHECK(fml::jni::CheckException(env))`, which converts the pending Java exception into an `abort()`. This change guards both nullable values and closes the merged `SurfaceControl.Transaction` before returning early so that it is not leaked. It also moves `flutterView.invalidate()` below the guard. Fixes flutter#190609 (cherry picked from commit 8bcda46) Cherry-pick note: the import hunk was placed by hand because this branch does not carry flutter#184732 (rect clipping for surface views); nothing else changed.
… the transaction entry points (flutter#192606) Fix the Android 14+ HCPP transaction-list race. The raster thread added to the pending transaction list while the platform thread swapped it, leaving null entries that made `merge(null)` throw and abort the engine through JNI. - Guard the pending raster transaction list with one lock shared by raster-thread additions and platform-thread draining. The active raster transaction list and both platform transaction slots are confined to the platform thread. - Split the entry points by caller: `createTransaction()` is the raster/JNI entry and always returns an isolated transaction, while a private `platformTransaction()` consolidates platform-thread mutations (overlay visibility) into one transaction per frame. - Close platform transactions once they are merged or discarded. Raster transactions are not closed here, because their native producer may still be writing through them. - Remove the unused `applyTransactions()` JNI path. Two pre-existing native ownership hazards remain (the raster thread writes through the borrowed `ASurfaceTransaction*` after publishing it to Java, and the Java cleaner can free the native transaction while native code still uses it); fixing them requires the native side to retain the transaction and publish it only after the producer has finished writing. That is a separate change. (cherry picked from commit 66afb82) Cherry-pick notes: the `android.os.Build` import and the swapTransactions/createTransaction/applyTransactions block were placed by hand (this branch's swapTransactions still used an index loop). The two hunks for maybeApplyClipToSurfaceView and surfaceCreated have no counterpart here because flutter#184732 is not carried, and were dropped.
Relands #184471 which was reverted because of suspected skia gold bug where the triage button was not working for the created digests.
I also changed the names of the output files just in case, to make sure the state doesn't collide with old.