Repository navigation
Commit e6da335
[android] Guard the HCPP pending transaction list against the raster/platform race (OLYM-5308)
With EnableSurfaceControl (HCPP) on Android 14+, the raster thread appends
a SurfaceControl.Transaction to PlatformViewsController2.pendingTransactions
for every presented frame (FlutterJNI.createTransaction), while the platform
thread drains the same unsynchronized ArrayList after every frame that has no
platform view (applyTransaction -> applyTransactions). An append that races
the drain leaves a null slot; merge(null) throws a NullPointerException on
the main thread, and FML_CHECK(CheckException) after the JNI call in
PlatformViewAndroidJNIImpl::applyTransaction (line 2298) aborts the app.
A race on any frame, so an app left on screen dies within minutes.
Every access to pendingTransactions now holds one lock; applyTransactions
drains a snapshot and merges outside the lock. Same idea as upstream
flutter#192606, kept minimal because this branch still calls
applyTransaction from the no-platform-view frame path.
Co-Authored-By: Claude Opus 5.5 <[email protected]>1 parent 76aeb9e commit e6da335
1 file changed
Lines changed: 23 additions & 10 deletions
File tree
- engine/src/flutter/shell/platform/android/io/flutter/plugin/platform
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
70 | 76 | | |
| 77 | + | |
71 | 78 | | |
72 | 79 | | |
73 | 80 | | |
| |||
546 | 553 | | |
547 | 554 | | |
548 | 555 | | |
549 | | - | |
| 556 | + | |
550 | 557 | | |
551 | 558 | | |
552 | | - | |
553 | | - | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
554 | 562 | | |
555 | | - | |
556 | 563 | | |
557 | 564 | | |
558 | | - | |
| 565 | + | |
559 | 566 | | |
560 | 567 | | |
561 | 568 | | |
562 | | - | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
563 | 572 | | |
564 | 573 | | |
565 | 574 | | |
566 | | - | |
| 575 | + | |
567 | 576 | | |
568 | 577 | | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
569 | 583 | | |
570 | | - | |
571 | | - | |
| 584 | + | |
| 585 | + | |
572 | 586 | | |
573 | 587 | | |
574 | | - | |
575 | 588 | | |
576 | 589 | | |
577 | 590 | | |
| |||
0 commit comments