Commit 3aa8a04
Fix onHostPause crash in ReactInstanceManager without feature flag (#55986)
Summary:
Pull Request resolved: #55986
This fixes the `java.lang.AssertionError` crash in `ReactInstanceManager.onHostPause()` for third-party React Native apps (primarily Discord at 95.9% of crashes) using the deprecated bridge mode.
## Problem
When VROS triggers Activity lifecycle transitions that cause two Activity instances to exist simultaneously, the reference equality assertion in `onHostPause()` crashes. D95309454 attempted to fix this by gating behind `ReactNativeFeatureFlags.skipActivityIdentityAssertionOnHostPause()`, but that flag has `ossReleaseStage: 'none'`, meaning OSS users can't benefit from the fix.
## Solution
Instead of gating behind a feature flag, always log a warning instead of crashing with an assertion. This is safe because:
- `ReactInstanceManager` is deprecated bridge-mode code
- The flag's `expectedReleaseValue` is `true` (intended to always skip the assertion)
- The bridgeless architecture (`ReactHostImpl.kt`) already has the same behavior
- This avoids the GitHub export issue where the flag defaults to `false` for OSS
## Stats
- 365 crashes in 14 days across 8 third-party apps
- All Quest devices affected (Q2, Q3, Q3S)
- All active branches (v85, v201, v83)
## Changes
- Modified `onHostPause()` to log a warning via `FLog.w()` instead of crashing via `Assertions.assertCondition()` when the paused activity doesn't match the current activity
- Added null safety for the activity parameter in the log message
- No new imports needed (removed dependency on `ReactNativeFeatureFlags`)
Reviewed By: cortinico
Differential Revision: D95570941
fbshipit-source-id: 2fc377c3ace97d328e8b8cc195e3a30069d0c2aa1 parent c0b1057 commit 3aa8a04
1 file changed
Lines changed: 10 additions & 7 deletions
File tree
- packages/react-native/ReactAndroid/src/main/java/com/facebook/react
Lines changed: 10 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
593 | 594 | | |
594 | 595 | | |
595 | 596 | | |
596 | | - | |
597 | | - | |
598 | | - | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
599 | 601 | | |
600 | 602 | | |
601 | 603 | | |
| 604 | + | |
602 | 605 | | |
603 | 606 | | |
604 | 607 | | |
| |||
612 | 615 | | |
613 | 616 | | |
614 | 617 | | |
615 | | - | |
616 | | - | |
617 | | - | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
618 | 621 | | |
619 | 622 | | |
620 | 623 | | |
621 | 624 | | |
622 | 625 | | |
623 | | - | |
| 626 | + | |
624 | 627 | | |
625 | 628 | | |
626 | 629 | | |
| |||
0 commit comments