Reduce visibility of methods that should not be public in ReactHost (#37169)

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

Reduce visibility of methods that should not be public in ReactHost

changelog: [internal] internal

Reviewed By: philIip

Differential Revision: D45378246

fbshipit-source-id: 681c8fc6e4d67b68ac7604f07b9a031d0aa840b0
This commit is contained in:
David Vacca
2023-04-29 08:52:34 -07:00
committed by Facebook GitHub Bot
parent 9cbe45bf2a
commit c4a6c3728e
@@ -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<ReactInstanceEventListener> mReactInstanceEventListeners =
Collections.synchronizedList(new ArrayList<ReactInstanceEventListener>());
Collections.synchronizedList(new ArrayList<>());
private final BridgelessAtomicRef<Task<ReactInstance>> mReactInstanceTaskRef =
new BridgelessAtomicRef<>(
@@ -108,7 +106,7 @@ public class ReactHost {
null, "forResult parameter supports null, but is not annotated as @Nullable")));
private final BridgelessAtomicRef<BridgelessReactContext> mBridgelessReactContextRef =
new BridgelessAtomicRef<>(null);
new BridgelessAtomicRef<>();
private final AtomicReference<Activity> 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<T> {
/* package */ interface VeniceThenable<T> {
void then(T t);
}