Align creation of FabricUIManager with bridge

Summary:
- Bridgeless is using a deprecated FabricUIManager constructor which bridge doesn't use, and is the only one using it, this diff migrated bridgeless to use the same FabricUIManager constructor as bridge
- Remove static view config check (mShouldDeallocateEventDispatcher), instead use Bridgeless check since SVC is enabled in Bridgeless but not in Bridge.

Changelog:
[Android][Changed] - Align creation of FabricUIManager with bridge

Reviewed By: javache

Differential Revision: D42681489

fbshipit-source-id: b9c7c4a81a98db52e881138cc85be0e85df636d9
This commit is contained in:
Lulu Wu
2023-02-02 05:35:47 -08:00
committed by Facebook GitHub Bot
parent 1e53f88b72
commit 6d45e49dc7
@@ -182,9 +182,6 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
*/
private volatile boolean mDestroyed = false;
// TODO T83943316: Delete this variable once StaticViewConfigs are enabled by default
private volatile boolean mShouldDeallocateEventDispatcher = false;
private boolean mDriveCxxAnimations = false;
private long mDispatchViewUpdatesTime = 0l;
@@ -209,28 +206,6 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
}
};
// TODO T83943316: Deprecate and delete this constructor once StaticViewConfigs are enabled by
// default
@Deprecated
public FabricUIManager(
ReactApplicationContext reactContext,
ViewManagerRegistry viewManagerRegistry,
EventDispatcher eventDispatcher,
EventBeatManager eventBeatManager) {
mDispatchUIFrameCallback = new DispatchUIFrameCallback(reactContext);
mReactApplicationContext = reactContext;
mMountingManager = new MountingManager(viewManagerRegistry, mMountItemExecutor);
mMountItemDispatcher =
new MountItemDispatcher(mMountingManager, new MountItemDispatchListener());
mEventDispatcher = eventDispatcher;
mShouldDeallocateEventDispatcher = false;
mEventBeatManager = eventBeatManager;
mReactApplicationContext.addLifecycleEventListener(this);
mViewManagerRegistry = viewManagerRegistry;
mReactApplicationContext.registerComponentCallbacks(viewManagerRegistry);
}
public FabricUIManager(
ReactApplicationContext reactContext,
ViewManagerRegistry viewManagerRegistry,
@@ -241,7 +216,6 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
mMountItemDispatcher =
new MountItemDispatcher(mMountingManager, new MountItemDispatchListener());
mEventDispatcher = new EventDispatcherImpl(reactContext);
mShouldDeallocateEventDispatcher = true;
mEventBeatManager = eventBeatManager;
mReactApplicationContext.addLifecycleEventListener(this);
@@ -467,10 +441,11 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
ViewManagerPropertyUpdater.clear();
// When using StaticViewConfigs is enabled, FabriUIManager is
// responsible for initializing and deallocating EventDispatcher.
// When StaticViewConfigs is enabled, FabriUIManager is
// responsible for initializing and deallocating EventDispatcher. StaticViewConfigs is enabled
// only in Bridgeless for now.
// TODO T83943316: Remove this IF once StaticViewConfigs are enabled by default
if (mShouldDeallocateEventDispatcher) {
if (!ReactFeatureFlags.enableBridgelessArchitecture) {
mEventDispatcher.onCatalystInstanceDestroyed();
}
}