Skip to content

Commit

Permalink
DisabledDevSupportManager -> ReleaseDevSupportManager (#43667)
Browse files Browse the repository at this point in the history
Summary:
allow-large-files

Pull Request resolved: #43667

Renaming `DisabledDevSupportManager` -> `ReleaseDevSupportManager` to avoid confusion since this is only initialized in Release variant
https://github.com/facebook/react-native/blob/bb02049a6af2c83c3fa633a5eb098bae1135b4a4/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java#L181-L187

Changelog:
[Internal] Internal

Reviewed By: fkgozali, cortinico

Differential Revision: D55388403

fbshipit-source-id: 984b54f1666ad39301cb94d2b8c19b7504c997f6
  • Loading branch information
arushikesarwani94 authored and facebook-github-bot committed Mar 28, 2024
1 parent 2af1da4 commit 41a9664
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 60 deletions.
94 changes: 47 additions & 47 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -2143,52 +2143,6 @@ public abstract interface class com/facebook/react/devsupport/DevSupportManagerF
public abstract fun create (Landroid/content/Context;Lcom/facebook/react/devsupport/ReactInstanceDevHelper;Ljava/lang/String;ZLcom/facebook/react/devsupport/interfaces/RedBoxHandler;Lcom/facebook/react/devsupport/interfaces/DevBundleDownloadListener;ILjava/util/Map;Lcom/facebook/react/common/SurfaceDelegateFactory;Lcom/facebook/react/devsupport/interfaces/DevLoadingViewManager;)Lcom/facebook/react/devsupport/interfaces/DevSupportManager;
}

public class com/facebook/react/devsupport/DisabledDevSupportManager : com/facebook/react/devsupport/interfaces/DevSupportManager {
public fun <init> ()V
public fun addCustomDevOption (Ljava/lang/String;Lcom/facebook/react/devsupport/interfaces/DevOptionHandler;)V
public fun createRootView (Ljava/lang/String;)Landroid/view/View;
public fun createSurfaceDelegate (Ljava/lang/String;)Lcom/facebook/react/common/SurfaceDelegate;
public fun destroyRootView (Landroid/view/View;)V
public fun downloadBundleResourceFromUrlSync (Ljava/lang/String;Ljava/io/File;)Ljava/io/File;
public fun getCurrentActivity ()Landroid/app/Activity;
public fun getDevSettings ()Lcom/facebook/react/modules/debug/interfaces/DeveloperSettings;
public fun getDevSupportEnabled ()Z
public fun getDownloadedJSBundleFile ()Ljava/lang/String;
public fun getJSBundleURLForRemoteDebugging ()Ljava/lang/String;
public fun getLastErrorCookie ()I
public fun getLastErrorStack ()[Lcom/facebook/react/devsupport/interfaces/StackFrame;
public fun getLastErrorTitle ()Ljava/lang/String;
public fun getLastErrorType ()Lcom/facebook/react/devsupport/interfaces/ErrorType;
public fun getRedBoxHandler ()Lcom/facebook/react/devsupport/interfaces/RedBoxHandler;
public fun getSourceMapUrl ()Ljava/lang/String;
public fun getSourceUrl ()Ljava/lang/String;
public fun handleException (Ljava/lang/Exception;)V
public fun handleReloadJS ()V
public fun hasUpToDateJSBundleInCache ()Z
public fun hideRedboxDialog ()V
public fun isPackagerRunning (Lcom/facebook/react/devsupport/interfaces/PackagerStatusCallback;)V
public fun loadSplitBundleFromServer (Ljava/lang/String;Lcom/facebook/react/devsupport/interfaces/DevSplitBundleCallback;)V
public fun onNewReactContextCreated (Lcom/facebook/react/bridge/ReactContext;)V
public fun onReactInstanceDestroyed (Lcom/facebook/react/bridge/ReactContext;)V
public fun processErrorCustomizers (Landroid/util/Pair;)Landroid/util/Pair;
public fun registerErrorCustomizer (Lcom/facebook/react/devsupport/interfaces/ErrorCustomizer;)V
public fun reloadJSFromServer (Ljava/lang/String;)V
public fun reloadJSFromServer (Ljava/lang/String;Lcom/facebook/react/devsupport/interfaces/BundleLoadCallback;)V
public fun reloadSettings ()V
public fun setDevSupportEnabled (Z)V
public fun setFpsDebugEnabled (Z)V
public fun setHotModuleReplacementEnabled (Z)V
public fun setPackagerLocationCustomizer (Lcom/facebook/react/devsupport/interfaces/DevSupportManager$PackagerLocationCustomizer;)V
public fun setRemoteJSDebugEnabled (Z)V
public fun showDevOptionsDialog ()V
public fun showNewJSError (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;I)V
public fun showNewJavaError (Ljava/lang/String;Ljava/lang/Throwable;)V
public fun startInspector ()V
public fun stopInspector ()V
public fun toggleElementInspector ()V
public fun updateJSError (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;I)V
}

public class com/facebook/react/devsupport/DoubleTapReloadRecognizer {
public fun <init> ()V
public fun didDoubleTapR (ILandroid/view/View;)Z
Expand Down Expand Up @@ -2263,7 +2217,7 @@ public class com/facebook/react/devsupport/PackagerStatusCheck {
public fun run (Ljava/lang/String;Lcom/facebook/react/devsupport/interfaces/PackagerStatusCallback;)V
}

public final class com/facebook/react/devsupport/PerftestDevSupportManager : com/facebook/react/devsupport/DisabledDevSupportManager {
public final class com/facebook/react/devsupport/PerftestDevSupportManager : com/facebook/react/devsupport/ReleaseDevSupportManager {
public fun <init> (Landroid/content/Context;)V
public fun getDevSettings ()Lcom/facebook/react/devsupport/DevInternalSettings;
public synthetic fun getDevSettings ()Lcom/facebook/react/modules/debug/interfaces/DeveloperSettings;
Expand Down Expand Up @@ -2292,6 +2246,52 @@ public class com/facebook/react/devsupport/RedBoxContentView : android/widget/Li
public fun setRedBoxHandler (Lcom/facebook/react/devsupport/interfaces/RedBoxHandler;)Lcom/facebook/react/devsupport/RedBoxContentView;
}

public class com/facebook/react/devsupport/ReleaseDevSupportManager : com/facebook/react/devsupport/interfaces/DevSupportManager {
public fun <init> ()V
public fun addCustomDevOption (Ljava/lang/String;Lcom/facebook/react/devsupport/interfaces/DevOptionHandler;)V
public fun createRootView (Ljava/lang/String;)Landroid/view/View;
public fun createSurfaceDelegate (Ljava/lang/String;)Lcom/facebook/react/common/SurfaceDelegate;
public fun destroyRootView (Landroid/view/View;)V
public fun downloadBundleResourceFromUrlSync (Ljava/lang/String;Ljava/io/File;)Ljava/io/File;
public fun getCurrentActivity ()Landroid/app/Activity;
public fun getDevSettings ()Lcom/facebook/react/modules/debug/interfaces/DeveloperSettings;
public fun getDevSupportEnabled ()Z
public fun getDownloadedJSBundleFile ()Ljava/lang/String;
public fun getJSBundleURLForRemoteDebugging ()Ljava/lang/String;
public fun getLastErrorCookie ()I
public fun getLastErrorStack ()[Lcom/facebook/react/devsupport/interfaces/StackFrame;
public fun getLastErrorTitle ()Ljava/lang/String;
public fun getLastErrorType ()Lcom/facebook/react/devsupport/interfaces/ErrorType;
public fun getRedBoxHandler ()Lcom/facebook/react/devsupport/interfaces/RedBoxHandler;
public fun getSourceMapUrl ()Ljava/lang/String;
public fun getSourceUrl ()Ljava/lang/String;
public fun handleException (Ljava/lang/Exception;)V
public fun handleReloadJS ()V
public fun hasUpToDateJSBundleInCache ()Z
public fun hideRedboxDialog ()V
public fun isPackagerRunning (Lcom/facebook/react/devsupport/interfaces/PackagerStatusCallback;)V
public fun loadSplitBundleFromServer (Ljava/lang/String;Lcom/facebook/react/devsupport/interfaces/DevSplitBundleCallback;)V
public fun onNewReactContextCreated (Lcom/facebook/react/bridge/ReactContext;)V
public fun onReactInstanceDestroyed (Lcom/facebook/react/bridge/ReactContext;)V
public fun processErrorCustomizers (Landroid/util/Pair;)Landroid/util/Pair;
public fun registerErrorCustomizer (Lcom/facebook/react/devsupport/interfaces/ErrorCustomizer;)V
public fun reloadJSFromServer (Ljava/lang/String;)V
public fun reloadJSFromServer (Ljava/lang/String;Lcom/facebook/react/devsupport/interfaces/BundleLoadCallback;)V
public fun reloadSettings ()V
public fun setDevSupportEnabled (Z)V
public fun setFpsDebugEnabled (Z)V
public fun setHotModuleReplacementEnabled (Z)V
public fun setPackagerLocationCustomizer (Lcom/facebook/react/devsupport/interfaces/DevSupportManager$PackagerLocationCustomizer;)V
public fun setRemoteJSDebugEnabled (Z)V
public fun showDevOptionsDialog ()V
public fun showNewJSError (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;I)V
public fun showNewJavaError (Ljava/lang/String;Ljava/lang/Throwable;)V
public fun startInspector ()V
public fun stopInspector ()V
public fun toggleElementInspector ()V
public fun updateJSError (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;I)V
}

public class com/facebook/react/devsupport/StackTraceHelper {
public static final field COLUMN_KEY Ljava/lang/String;
public static final field LINE_NUMBER_KEY Ljava/lang/String;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import androidx.annotation.Nullable;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.react.devsupport.DisabledDevSupportManager;
import com.facebook.react.devsupport.DoubleTapReloadRecognizer;
import com.facebook.react.devsupport.ReleaseDevSupportManager;
import com.facebook.react.devsupport.interfaces.DevSupportManager;
import com.facebook.react.interfaces.fabric.ReactSurface;
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
Expand Down Expand Up @@ -230,7 +230,7 @@ public void reload() {
DevSupportManager devSupportManager = getDevSupportManager();
if (devSupportManager != null) {
// With Bridgeless enabled, reload in RELEASE mode
if (devSupportManager instanceof DisabledDevSupportManager
if (devSupportManager instanceof ReleaseDevSupportManager
&& ReactFeatureFlags.enableBridgelessArchitecture
&& mReactHost != null) {
// Do not reload the bundle from JS as there is no bundler running in release mode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* A simple factory that creates instances of {@link DevSupportManager} implementations. Uses
* reflection to create BridgeDevSupportManager if it exists. This allows ProGuard to strip that
* class and its dependencies in release builds. If the class isn't found, {@link
* DisabledDevSupportManager} is returned instead.
* ReleaseDevSupportManager} is returned instead.
*/
@Nullsafe(Nullsafe.Mode.LOCAL)
public class DefaultDevSupportManagerFactory implements DevSupportManagerFactory {
Expand Down Expand Up @@ -68,7 +68,7 @@ public DevSupportManager create(
@Nullable SurfaceDelegateFactory surfaceDelegateFactory,
@Nullable DevLoadingViewManager devLoadingViewManager) {
if (!enableOnCreate) {
return new DisabledDevSupportManager();
return new ReleaseDevSupportManager();
}
// Developer support is enabled, we now must choose whether to return a DevSupportManager,
// or a more lean profiling-only PerftestDevSupportManager. We make the choice by first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Communication is enabled via the Inspector, but everything else is disabled.
*/
@Nullsafe(Nullsafe.Mode.LOCAL)
public final class PerftestDevSupportManager extends DisabledDevSupportManager {
public final class PerftestDevSupportManager extends ReleaseDevSupportManager {
private final DevServerHelper mDevServerHelper;
private final DevInternalSettings mDevSettings;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
* A dummy implementation of {@link DevSupportManager} to be used in production mode where
* development features aren't needed.
*/
public class DisabledDevSupportManager implements DevSupportManager {
public class ReleaseDevSupportManager implements DevSupportManager {

private final DefaultJSExceptionHandler mDefaultJSExceptionHandler;

public DisabledDevSupportManager() {
public ReleaseDevSupportManager() {
mDefaultJSExceptionHandler = new DefaultJSExceptionHandler();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* Interface for accessing and interacting with development features. In dev mode, use the
* implementation {@link BridgeDevSupportManager}. In production mode, use the dummy implementation
* {@link DisabledDevSupportManager}.
* {@link ReleaseDevSupportManager}.
*/
public interface DevSupportManager extends JSExceptionHandler {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
import com.facebook.react.common.LifecycleState;
import com.facebook.react.common.build.ReactBuildConfig;
import com.facebook.react.devsupport.DevSupportManagerBase;
import com.facebook.react.devsupport.DisabledDevSupportManager;
import com.facebook.react.devsupport.InspectorFlags;
import com.facebook.react.devsupport.ReleaseDevSupportManager;
import com.facebook.react.devsupport.interfaces.DevSupportManager;
import com.facebook.react.fabric.ComponentFactory;
import com.facebook.react.fabric.FabricUIManager;
Expand Down Expand Up @@ -183,7 +183,7 @@ public ReactHostImpl(
new BridgelessDevSupportManager(
ReactHostImpl.this, mContext, mReactHostDelegate.getJsMainModulePath());
} else {
mDevSupportManager = new DisabledDevSupportManager();
mDevSupportManager = new ReleaseDevSupportManager();
}
mUseDevSupport = useDevSupport;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import com.facebook.react.bridge.MemoryPressureListener
import com.facebook.react.bridge.UIManager
import com.facebook.react.common.LifecycleState
import com.facebook.react.common.annotations.UnstableReactNativeAPI
import com.facebook.react.devsupport.DisabledDevSupportManager
import com.facebook.react.devsupport.ReleaseDevSupportManager
import com.facebook.react.devsupport.interfaces.PackagerStatusCallback
import com.facebook.react.fabric.ComponentFactory
import com.facebook.react.interfaces.TaskInterface
Expand Down Expand Up @@ -121,13 +121,13 @@ class ReactHostTest {
@Test
fun testGetDevSupportManager() {
// BridgelessDevSupportManager is created only for debug
// we check if it was instantiated or if DisabledDevSupportManager was created (for release).
// we check if it was instantiated or if ReleaseDevSupportManager was created (for release).
if (mockedDevSupportManagerCtor.constructed().isNotEmpty()) {
val devSupportManager = mockedDevSupportManagerCtor.constructed().first()
Assertions.assertThat(reactHost.devSupportManager).isEqualTo(devSupportManager)
} else {
Assertions.assertThat(reactHost.devSupportManager)
.isInstanceOf(DisabledDevSupportManager::class.java)
.isInstanceOf(ReleaseDevSupportManager::class.java)
}
}

Expand Down

0 comments on commit 41a9664

Please sign in to comment.