Skip to content

Commit

Permalink
Remove deprecated UIImplementationProvider
Browse files Browse the repository at this point in the history
Summary:
UIImplementation(Provider) is not compatible with the new renderer (Fabric) and the relevant constructors have been marked deprecated for a while. While ReactInstanceManagerBuilder creates a default instance, it's not even used by CoreModulesPackage.

Changelog: [Android][Removed] Removed deprecated UIImplementationProvider

Reviewed By: NickGerleman

Differential Revision: D39271916

fbshipit-source-id: 20a3b02843ea9a2ba4bfc1352037239febbafc64
  • Loading branch information
javache authored and facebook-github-bot committed Sep 8, 2022
1 parent 7b79dfc commit e7d7563
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import com.facebook.react.modules.deviceinfo.DeviceInfoModule;
import com.facebook.react.modules.systeminfo.AndroidInfoModule;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import com.facebook.react.uimanager.UIImplementationProvider;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.uimanager.ViewManagerResolver;
Expand Down Expand Up @@ -70,7 +69,6 @@ public class CoreModulesPackage extends TurboReactPackage implements ReactPackag
public CoreModulesPackage(
ReactInstanceManager reactInstanceManager,
DefaultHardwareBackBtnHandler hardwareBackBtnHandler,
@Nullable UIImplementationProvider uiImplementationProvider,
boolean lazyViewManagersEnabled,
int minTimeLeftInFrameForNonBatchedOperationMs) {
mReactInstanceManager = reactInstanceManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
import com.facebook.react.turbomodule.core.interfaces.TurboModuleRegistry;
import com.facebook.react.uimanager.DisplayMetricsHolder;
import com.facebook.react.uimanager.ReactRoot;
import com.facebook.react.uimanager.UIImplementationProvider;
import com.facebook.react.uimanager.UIManagerHelper;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.views.imagehelper.ResourceDrawableIdHelper;
Expand Down Expand Up @@ -225,7 +224,6 @@ public static ReactInstanceManagerBuilder builder() {
boolean requireActivity,
@Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
LifecycleState initialLifecycleState,
@Nullable UIImplementationProvider mUIImplementationProvider,
JSExceptionHandler jSExceptionHandler,
@Nullable RedBoxHandler redBoxHandler,
boolean lazyViewManagersEnabled,
Expand Down Expand Up @@ -282,7 +280,6 @@ public void invokeDefaultOnBackPressed() {
ReactInstanceManager.this.invokeDefaultOnBackPressed();
}
},
mUIImplementationProvider,
lazyViewManagersEnabled,
minTimeLeftInFrameForNonBatchedOperationMs));
if (mUseDeveloperSupport) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.facebook.react.jscexecutor.JSCExecutorFactory;
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
import com.facebook.react.packagerconnection.RequestHandler;
import com.facebook.react.uimanager.UIImplementationProvider;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand All @@ -52,7 +51,6 @@ public class ReactInstanceManagerBuilder {
private @Nullable DevSupportManagerFactory mDevSupportManagerFactory;
private boolean mRequireActivity;
private @Nullable LifecycleState mInitialLifecycleState;
private @Nullable UIImplementationProvider mUIImplementationProvider;
private @Nullable JSExceptionHandler mJSExceptionHandler;
private @Nullable Activity mCurrentActivity;
private @Nullable DefaultHardwareBackBtnHandler mDefaultHardwareBackBtnHandler;
Expand All @@ -70,13 +68,6 @@ public class ReactInstanceManagerBuilder {

/* package protected */ ReactInstanceManagerBuilder() {}

/** Sets a provider of {@link UIImplementation}. Uses default provider if null is passed. */
public ReactInstanceManagerBuilder setUIImplementationProvider(
@Nullable UIImplementationProvider uiImplementationProvider) {
mUIImplementationProvider = uiImplementationProvider;
return this;
}

public ReactInstanceManagerBuilder setJSIModulesPackage(
@Nullable JSIModulePackage jsiModulePackage) {
mJSIModulesPackage = jsiModulePackage;
Expand Down Expand Up @@ -325,11 +316,6 @@ public ReactInstanceManager build() {
mJSMainModulePath != null || mJSBundleAssetUrl != null || mJSBundleLoader != null,
"Either MainModulePath or JS Bundle File needs to be provided");

if (mUIImplementationProvider == null) {
// create default UIImplementationProvider if the provided one is null.
mUIImplementationProvider = new UIImplementationProvider();
}

// We use the name of the device and the app for debugging & metrics
//noinspection ConstantConditions
String appName = mApplication.getPackageName();
Expand All @@ -355,7 +341,6 @@ public ReactInstanceManager build() {
mRequireActivity,
mBridgeIdleDebugListener,
Assertions.assertNotNull(mInitialLifecycleState, "Initial lifecycle state was not set"),
mUIImplementationProvider,
mJSExceptionHandler,
mRedBoxHandler,
mLazyViewManagersEnabled,
Expand Down
12 changes: 0 additions & 12 deletions ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.facebook.react.common.SurfaceDelegateFactory;
import com.facebook.react.devsupport.DevSupportManagerFactory;
import com.facebook.react.devsupport.interfaces.RedBoxHandler;
import com.facebook.react.uimanager.UIImplementationProvider;
import java.util.List;

/**
Expand Down Expand Up @@ -77,7 +76,6 @@ protected ReactInstanceManager createReactInstanceManager() {
.setLazyViewManagersEnabled(getLazyViewManagersEnabled())
.setRedBoxHandler(getRedBoxHandler())
.setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
.setUIImplementationProvider(getUIImplementationProvider())
.setJSIModulesPackage(getJSIModulePackage())
.setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
.setReactPackageTurboModuleManagerDelegateBuilder(
Expand Down Expand Up @@ -117,16 +115,6 @@ protected final Application getApplication() {
return mApplication;
}

/**
* Get the {@link UIImplementationProvider} to use. Override this method if you want to use a
* custom UI implementation.
*
* <p>Note: this is very advanced functionality, in 99% of cases you don't need to override this.
*/
protected UIImplementationProvider getUIImplementationProvider() {
return new UIImplementationProvider();
}

protected @Nullable JSIModulePackage getJSIModulePackage() {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.facebook.yoga.YogaConstants;
import com.facebook.yoga.YogaDirection;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
Expand Down Expand Up @@ -65,30 +64,6 @@ public interface LayoutUpdateListener {
void onLayoutUpdated(ReactShadowNode root);
}

public UIImplementation(
ReactApplicationContext reactContext,
ViewManagerResolver viewManagerResolver,
EventDispatcher eventDispatcher,
int minTimeLeftInFrameForNonBatchedOperationMs) {
this(
reactContext,
new ViewManagerRegistry(viewManagerResolver),
eventDispatcher,
minTimeLeftInFrameForNonBatchedOperationMs);
}

public UIImplementation(
ReactApplicationContext reactContext,
List<ViewManager> viewManagers,
EventDispatcher eventDispatcher,
int minTimeLeftInFrameForNonBatchedOperationMs) {
this(
reactContext,
new ViewManagerRegistry(viewManagers),
eventDispatcher,
minTimeLeftInFrameForNonBatchedOperationMs);
}

UIImplementation(
ReactApplicationContext reactContext,
ViewManagerRegistry viewManagers,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -115,44 +115,18 @@ public interface CustomEventNamesResolver {
private int mBatchId = 0;
private int mNumRootViews = 0;

@SuppressWarnings("deprecated")
public UIManagerModule(
ReactApplicationContext reactContext,
ViewManagerResolver viewManagerResolver,
int minTimeLeftInFrameForNonBatchedOperationMs) {
this(
reactContext,
viewManagerResolver,
new UIImplementationProvider(),
minTimeLeftInFrameForNonBatchedOperationMs);
}

@SuppressWarnings("deprecated")
public UIManagerModule(
ReactApplicationContext reactContext,
List<ViewManager> viewManagersList,
int minTimeLeftInFrameForNonBatchedOperationMs) {
this(
reactContext,
viewManagersList,
new UIImplementationProvider(),
minTimeLeftInFrameForNonBatchedOperationMs);
}

@Deprecated
public UIManagerModule(
ReactApplicationContext reactContext,
ViewManagerResolver viewManagerResolver,
UIImplementationProvider uiImplementationProvider,
int minTimeLeftInFrameForNonBatchedOperationMs) {
super(reactContext);
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(reactContext);
mEventDispatcher = new EventDispatcherImpl(reactContext);
mModuleConstants = createConstants(viewManagerResolver);
mCustomDirectEvents = UIManagerModuleConstants.getDirectEventTypeConstants();
mViewManagerRegistry = new ViewManagerRegistry(viewManagerResolver);
mUIImplementation =
uiImplementationProvider.createUIImplementation(
new UIImplementation(
reactContext,
mViewManagerRegistry,
mEventDispatcher,
Expand All @@ -161,11 +135,9 @@ public UIManagerModule(
reactContext.addLifecycleEventListener(this);
}

@Deprecated
public UIManagerModule(
ReactApplicationContext reactContext,
List<ViewManager> viewManagersList,
UIImplementationProvider uiImplementationProvider,
int minTimeLeftInFrameForNonBatchedOperationMs) {
super(reactContext);
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(reactContext);
Expand All @@ -174,7 +146,7 @@ public UIManagerModule(
mModuleConstants = createConstants(viewManagersList, null, mCustomDirectEvents);
mViewManagerRegistry = new ViewManagerRegistry(viewManagersList);
mUIImplementation =
uiImplementationProvider.createUIImplementation(
new UIImplementation(
reactContext,
mViewManagerRegistry,
mEventDispatcher,
Expand Down Expand Up @@ -927,7 +899,7 @@ public void runGuarded() {
}

/** Listener that drops the CSSNode pool on low memory when the app is backgrounded. */
private class MemoryTrimCallback implements ComponentCallbacks2 {
private static class MemoryTrimCallback implements ComponentCallbacks2 {

@Override
public void onTrimMemory(int level) {
Expand Down

0 comments on commit e7d7563

Please sign in to comment.