Repository navigation
Commit 0cd6107
authored
[stable] Fix AccessibilityBridge startup crash on vendor-modified Android (#189759)
Cherry-picks #184630 (fixes #184286) to `flutter-3.44-candidate.0`.
## Impacted Users
Devices on vendor-modified Android 11 ROMs that report `SDK_INT >= 31` but ship a `Configuration` class without the API-31 `fontWeightAdjustment` field. Confirmed in production on OnePlus 8 Pro (Android 11); the OnePlus/Oppo/Realme ROM family is the likely blast radius. #184286 cited 95 fatal events, 100% OnePlus 8 Pro / Android 11.
## Impact Description
Hard crash at startup. `NoSuchFieldError` is thrown from `AccessibilityBridge.setBoldTextFlag` inside the `AccessibilityBridge` constructor during `FlutterActivity.onCreate`, so the process dies before any Dart runs — the app never opens on affected devices.
## Workaround
None from app code. The field read happens inside the engine's `AccessibilityBridge` constructor before the Dart isolate starts, so the embedding app cannot guard or catch it.
## Risk
Low. +20/-4 in a single file (`AccessibilityBridge.java`): moves the `fontWeightAdjustment` read into an `@RequiresApi(31)` `Api31Impl` inner class so ART's class verifier no longer eagerly resolves the field at class-load time on older or vendor-modified runtimes. Mirrors the hardening AndroidX Compose applied for the same crash (AOSP b/353988277). Only touches the already-failing path.
## Test Coverage
No automated test — the trigger is a device/ROM-specific `NoSuchFieldError` that isn't reproducible in CI. The change is defensive and validated against the production crash signature in #184286.
## Validation Steps
Launch the app on an affected device (OnePlus 8 Pro / Android 11). Before: immediate startup crash. After: app launches normally; bold-text accessibility is simply treated as unavailable.1 parent 7c42df0 commit 0cd6107
1 file changed
Lines changed: 20 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
658 | 659 | | |
659 | 660 | | |
660 | 661 | | |
661 | | - | |
662 | | - | |
663 | 662 | | |
664 | | - | |
665 | | - | |
| 663 | + | |
666 | 664 | | |
667 | 665 | | |
668 | 666 | | |
| |||
3256 | 3254 | | |
3257 | 3255 | | |
3258 | 3256 | | |
| 3257 | + | |
| 3258 | + | |
| 3259 | + | |
| 3260 | + | |
| 3261 | + | |
| 3262 | + | |
| 3263 | + | |
| 3264 | + | |
| 3265 | + | |
| 3266 | + | |
| 3267 | + | |
| 3268 | + | |
| 3269 | + | |
| 3270 | + | |
| 3271 | + | |
| 3272 | + | |
| 3273 | + | |
| 3274 | + | |
3259 | 3275 | | |
0 commit comments