diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManager.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManager.java index caee586add25be..f3c3ede01a5348 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManager.java @@ -14,7 +14,6 @@ import androidx.annotation.Nullable; import androidx.annotation.UiThread; import com.facebook.infer.annotation.ThreadConfined; -import java.util.List; public interface UIManager extends JSIModule, PerformanceCounter { @@ -153,15 +152,4 @@ void updateRootLayoutSpecs( @Deprecated @Nullable String resolveCustomDirectEventName(@Nullable String eventName); - - /** - * Helper method to pre-initialize view managers. When using Native ViewConfigs this method will - * also pre-compute the constants for a view manager. The purpose is to ensure that we don't block - * for getting the constants for view managers during initial rendering of a surface. - * - * @deprecated this method will be removed in the future - * @param viewManagerNames {@link List } names of ViewManagers - */ - @Deprecated - void preInitializeViewManagers(List viewManagerNames); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java index 7097692e4e577a..8139a36b68c7ef 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -84,7 +84,6 @@ import com.facebook.react.views.text.TextLayoutManager; import com.facebook.react.views.text.TextLayoutManagerMapBuffer; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Queue; import java.util.concurrent.CopyOnWriteArrayList; @@ -276,13 +275,6 @@ public ReadableMap getInspectorDataForInstance(final int surfaceId, final View v return mBinding.getInspectorDataForInstance(eventEmitter); } - @Override - public void preInitializeViewManagers(List viewManagerNames) { - for (String viewManagerName : viewManagerNames) { - mMountingManager.initializeViewManager(viewManagerName); - } - } - @Override @AnyThread @ThreadConfined(ANY) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java index f602b2a4f8377d..269a911467e32c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java @@ -420,10 +420,6 @@ public long measureMapBuffer( attachmentsPositions); } - public void initializeViewManager(String componentName) { - mViewManagerRegistry.get(componentName); - } - public void enqueuePendingEvent(int reactTag, ViewEvent viewEvent) { @Nullable SurfaceMountingManager smm = getSurfaceManagerForView(reactTag); if (smm == null) { diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java index c4635ffcad73a0..78b174f0250429 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java @@ -17,7 +17,6 @@ import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.collection.ArrayMap; import com.facebook.common.logging.FLog; import com.facebook.debug.holder.PrinterHolder; import com.facebook.debug.tags.ReactDebugOverlayTags; @@ -49,7 +48,6 @@ import com.facebook.systrace.Systrace; import com.facebook.systrace.SystraceMessage; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; @@ -109,8 +107,6 @@ public interface CustomEventNamesResolver { private final List mListeners = new ArrayList<>(); private final CopyOnWriteArrayList mUIManagerListeners = new CopyOnWriteArrayList<>(); - private @Nullable Map mViewManagerConstantsCache; - private volatile int mViewManagerConstantsCacheSize; private int mBatchId = 0; @@ -250,50 +246,8 @@ private static Map createConstants( } } - /** - * Helper method to pre-compute the constants for a view manager. This method ensures that we - * don't block for getting the constants for view managers during TTI - * - * @deprecated this method will be removed in the future - * @param viewManagerNames {@link List} names of ViewManagers - */ - @Deprecated - @Override - public void preInitializeViewManagers(List viewManagerNames) { - Map constantsMap = new ArrayMap<>(); - for (String viewManagerName : viewManagerNames) { - WritableMap constants = computeConstantsForViewManager(viewManagerName); - if (constants != null) { - constantsMap.put(viewManagerName, constants); - } - } - - // To ensure that this is thread safe, we return an unmodifiableMap - // We use mViewManagerConstantsCacheSize to count the times we access the contents of the map - // Once we have accessed all the values, we free this cache - // Assumption is that JS gets the constants only once for each viewManager. - // Using this mechanism prevents expensive synchronized blocks, due to the nature of how this is - // accessed - write one, read multiple times, and then throw the data away. - mViewManagerConstantsCacheSize = viewManagerNames.size(); - mViewManagerConstantsCache = Collections.unmodifiableMap(constantsMap); - } - @ReactMethod(isBlockingSynchronousMethod = true) public @Nullable WritableMap getConstantsForViewManager(@Nullable String viewManagerName) { - if (mViewManagerConstantsCache != null - && mViewManagerConstantsCache.containsKey(viewManagerName)) { - WritableMap constants = mViewManagerConstantsCache.get(viewManagerName); - if (--mViewManagerConstantsCacheSize <= 0) { - // Looks like we have read all the values from the cache, so we may as well free this cache - mViewManagerConstantsCache = null; - } - return constants; - } else { - return computeConstantsForViewManager(viewManagerName); - } - } - - private @Nullable WritableMap computeConstantsForViewManager(@Nullable String viewManagerName) { ViewManager targetView = viewManagerName != null ? mUIImplementation.resolveViewManager(viewManagerName) : null; if (targetView == null) {