Add ReactMarkerConstants.CONTENT_APPEARED support on Android (#43620)

Summary:
Add the `ReactMarkerConstants.CONTENT_APPEARED` support on Android in bridgeless mode. This is an important marker for TTI measurement.

## Changelog:

[ANDROID] [ADDED] - Add the `ReactMarkerConstants.CONTENT_APPEARED` support on Android in bridgeless mode.

Pull Request resolved: https://github.com/facebook/react-native/pull/43620

Test Plan:
adding this on RNTesterActivity to see if the log is executed

```kotlin
ReactMarker.addListener { name, tag, instanceKey ->
  if (name == ReactMarkerConstants.CONTENT_APPEARED) {
    Log.i("XXX", "XXX")
  }
}
```

Reviewed By: cortinico

Differential Revision: D58459930

Pulled By: rubennorte

fbshipit-source-id: 4498a3623c506d228aea995c8aeafdb51fcc5b96
This commit is contained in:
Kudo Chien
2024-06-13 03:57:16 -07:00
committed by Facebook GitHub Bot
parent 1cb587c620
commit 5da9fdf8f1
3 changed files with 7 additions and 5 deletions
@@ -434,10 +434,8 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
if (mShouldLogContentAppeared) {
mShouldLogContentAppeared = false;
if (mJSModuleName != null) {
ReactMarker.logMarker(ReactMarkerConstants.CONTENT_APPEARED, mJSModuleName, mRootViewTag);
}
String jsModuleName = getJSModuleName();
ReactMarker.logMarker(ReactMarkerConstants.CONTENT_APPEARED, jsModuleName, mRootViewTag);
}
}
@@ -375,7 +375,9 @@ public class ReactHostImpl implements ReactHost {
public ReactSurface createSurface(
Context context, String moduleName, @Nullable Bundle initialProps) {
ReactSurfaceImpl surface = new ReactSurfaceImpl(context, moduleName, initialProps);
surface.attachView(new ReactSurfaceView(context, surface));
ReactSurfaceView surfaceView = new ReactSurfaceView(context, surface);
surfaceView.setShouldLogContentAppeared(true);
surface.attachView(surfaceView);
surface.attach(this);
return surface;
}
@@ -134,6 +134,8 @@ public class ReactSurfaceView(context: Context?, private val surface: ReactSurfa
// This surface view is always on Fabric.
@UIManagerType override fun getUIManagerType(): Int = UIManagerType.FABRIC
override fun getJSModuleName(): String = surface.moduleName
override fun dispatchJSTouchEvent(event: MotionEvent) {
val eventDispatcher = surface.eventDispatcher
if (eventDispatcher != null) {