diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/ReactHost.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/ReactHost.java index a40610aeac4..0ad53f4f53c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/ReactHost.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/ReactHost.java @@ -80,11 +80,9 @@ public class ReactHost { // TODO T61403233 Make this configurable by product code private static final boolean DEV = ReactBuildConfig.DEBUG; - + private static final String TAG = "ReactHost"; private static final int BRIDGELESS_MARKER_INSTANCE_KEY = 1; - public static final String TAG = "ReactHost"; - private final Context mContext; private final ReactInstanceDelegate mReactInstanceDelegate; private final ComponentFactory mComponentFactory; @@ -99,7 +97,7 @@ public class ReactHost { private final boolean mAllowPackagerServerAccess; private final boolean mUseDevSupport; private final Collection mReactInstanceEventListeners = - Collections.synchronizedList(new ArrayList()); + Collections.synchronizedList(new ArrayList<>()); private final BridgelessAtomicRef> mReactInstanceTaskRef = new BridgelessAtomicRef<>( @@ -108,7 +106,7 @@ public class ReactHost { null, "forResult parameter supports null, but is not annotated as @Nullable"))); private final BridgelessAtomicRef mBridgelessReactContextRef = - new BridgelessAtomicRef<>(null); + new BridgelessAtomicRef<>(); private final AtomicReference mActivity = new AtomicReference<>(); private @Nullable DefaultHardwareBackBtnHandler mDefaultHardwareBackBtnHandler; @@ -401,7 +399,7 @@ public class ReactHost { * * @return The {@link BridgelessReactContext} associated with ReactInstance. */ - public @Nullable BridgelessReactContext getCurrentReactContext() { + public @Nullable ReactContext getCurrentReactContext() { return mBridgelessReactContextRef.getNullable(); } @@ -409,7 +407,8 @@ public class ReactHost { return assertNotNull(mDevSupportManager); } - public @Nullable Activity getCurrentActivity() { + @Nullable + /* package */ Activity getCurrentActivity() { return mActivity.get(); } @@ -421,7 +420,7 @@ public class ReactHost { * @return The real {@link EventDispatcher} if the instance is alive; otherwise, a {@link * BlackHoleEventDispatcher}. */ - public EventDispatcher getEventDispatcher() { + /* package */ EventDispatcher getEventDispatcher() { final ReactInstance reactInstance = mReactInstanceTaskRef.get().getResult(); if (reactInstance == null) { return BlackHoleEventDispatcher.get(); @@ -430,7 +429,8 @@ public class ReactHost { return reactInstance.getEventDispatcher(); } - public @Nullable FabricUIManager getUIManager() { + /* package */ @Nullable + FabricUIManager getUIManager() { final ReactInstance reactInstance = mReactInstanceTaskRef.get().getResult(); if (reactInstance == null) { return null; @@ -482,7 +482,7 @@ public class ReactHost { return mMemoryPressureRouter; } - public boolean isInstanceInitialized() { + /* package */ boolean isInstanceInitialized() { final ReactInstance reactInstance = mReactInstanceTaskRef.get().getResult(); return reactInstance != null; } @@ -552,7 +552,7 @@ public class ReactHost { }); } - /*package */ void handleException(Exception e) { + /* package */ void handleException(Exception e) { final String method = "handleException(message = \"" + e.getMessage() + "\")"; log(method); @@ -596,13 +596,13 @@ public class ReactHost { } } - boolean isSurfaceAttached(ReactSurface surface) { + /* package */ boolean isSurfaceAttached(ReactSurface surface) { synchronized (mAttachedSurfaces) { return mAttachedSurfaces.contains(surface); } } - boolean isSurfaceWithModuleNameAttached(String moduleName) { + /* package */ boolean isSurfaceWithModuleNameAttached(String moduleName) { synchronized (mAttachedSurfaces) { for (ReactSurface surface : mAttachedSurfaces) { if (surface.getModuleName().equals(moduleName)) { @@ -613,7 +613,7 @@ public class ReactHost { } } - interface VeniceThenable { + /* package */ interface VeniceThenable { void then(T t); }