You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8baeb2d
Browse filesBrowse the repository at this point in the historyBrowse files
Summary:
# Stop re-arming the idle `DISPATCH_UI` Choreographer frame callback (Android)
Part of #58367. Split from #58368 per review feedback (one PR per pump, each behind a feature flag).
`FabricUIManager.DispatchUIFrameCallback.doFrameGuarded` re-schedules itself unconditionally in its `finally` block, so the `DISPATCH_UI` Choreographer callback runs at vsync rate forever — including while no mount items, pre-mount items or view commands are pending.
This PR makes the re-schedule demand-gated, behind `ReactNativeFeatureFlags.disableIdleMountItemFrameCallbackRearmAndroid` (default **false** = current behavior; `ossReleaseStage: 'experimental'`):
- `doFrameGuarded` only re-schedules while `mMountItemDispatcher.hasPendingItems()`.
- Items queued while the callback is idle re-arm it through `DispatchUIFrameCallback.schedule()`. The scheduler accepts calls from any thread, runs inline on the UI thread, coalesces off-thread handoffs, and skips work while paused or already armed.
- C++ animation sessions re-arm the callback for their first tick and keep it armed while animation work remains.
## Foregrounding / backgrounding
`onHostResume` → `resume()` re-schedules, while `onHostPause` → `pause()` disables scheduling. Items queued while paused are dispatched after resume. Items arriving on the UI thread during a commit keep the existing inline dispatch path; items added during a dispatch leave `hasPendingItems()` true, so the `finally` re-arms.
## Rollout
Flag: `disableIdleMountItemFrameCallbackRearmAndroid` — `defaultValue: false`, `expectedReleaseValue: true`, `ossReleaseStage: 'experimental'`. With the flag off, behavior is identical to current `main`.
Pull Request resolved: #58378
Test Plan:
- [x] `arc lint -a`
- [x] `buck2 build fbsource//xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric:fabricAndroid` — `BUILD SUCCEEDED`
- [x] `buck2 test fbsource//xplat/js/react-native-github/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric:fabricAndroid` — Pass 57, Fail 0 ([test run](https://www.internalfb.com/intern/testinfra/testrun/24769797998629457))
- [x] Flag off (`defaultValue`): both new paths are inert.
- [x] Compiles for the open-source Gradle build: `./gradlew :packages:react-native:ReactAndroid:compileReleaseKotlin :packages:react-native:ReactAndroid:compileReleaseJavaWithJavac`.
- [ ] Flag on, real app on device (OnePlus 3T, Android 9): idle `adb shell atrace` shows `DISPATCH_UI` doFrames drop to ~0 with a static UI; any render re-arms and commits land the same frame or the next; `dispatchCommand` from JS still executes promptly at idle; background/foreground round-trips keep the UI responsive.
- [ ] Flag on: RNTester rendering integration tests pass.
Reviewed By: cortinico
Differential Revision: D119071289
Pulled By: javache
fbshipit-source-id: 9e53cb6cde340e7fd501c359ed514dc4796bc308
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.kt
+19-1Lines changed: 19 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,18 @@ internal class MountItemDispatcher(
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt
+12-1Lines changed: 12 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Experimental_Android.kt
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
0 commit comments