android: allow registering custom packager command handlers

Summary:
@public
Apps may need to listen for custom commands via the packager connection. This allows registering such listeners.

Reviewed By: raluca-elena

Differential Revision: D8654477

fbshipit-source-id: 5f17298a88fec31b8939236fef48ee46c0ba2ee8
This commit is contained in:
Kevin Gozali
2018-06-27 15:17:50 -07:00
committed by Facebook Github Bot
parent bc2f12c68c
commit b3ef1c3a56
6 changed files with 55 additions and 9 deletions

View File

@@ -78,6 +78,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.modules.core.ReactChoreographer;
import com.facebook.react.modules.debug.interfaces.DeveloperSettings;
import com.facebook.react.modules.fabric.ReactFabric;
import com.facebook.react.packagerconnection.RequestHandler;
import com.facebook.react.uimanager.DisplayMetricsHolder;
import com.facebook.react.uimanager.UIManagerHelper;
import com.facebook.react.uimanager.ViewManager;
@@ -90,6 +91,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
@@ -205,7 +207,8 @@ public class ReactInstanceManager {
@Nullable DevBundleDownloadListener devBundleDownloadListener,
int minNumShakes,
int minTimeLeftInFrameForNonBatchedOperationMs,
@Nullable JSIModulePackage jsiModulePackage) {
@Nullable JSIModulePackage jsiModulePackage,
@Nullable Map<String, RequestHandler> customPackagerCommandHandlers) {
Log.d(ReactConstants.TAG, "ReactInstanceManager.ctor()");
initializeSoLoaderIfNecessary(applicationContext);
@@ -227,7 +230,8 @@ public class ReactInstanceManager {
useDeveloperSupport,
redBoxHandler,
devBundleDownloadListener,
minNumShakes);
minNumShakes,
customPackagerCommandHandlers);
mBridgeIdleDebugListener = bridgeIdleDebugListener;
mLifecycleState = initialLifecycleState;
mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);