From 42e35b3b56141892c6218cbc018dc914a678bc67 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Fri, 21 Jun 2019 11:36:56 -0700 Subject: [PATCH] Add extra logs in FabricUIManager Summary: This diff adds extra logging in FabricUIManager, this will be useful to debug production issues Reviewed By: JoshuaGross Differential Revision: D15907520 fbshipit-source-id: 94e16444af3c023b6c4837c4797404d3debe8e95 --- .../react/fabric/FabricUIManager.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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 f1622661c1a..82e0e22730e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -131,11 +131,16 @@ public class FabricUIManager implements UIManager, LifecycleEventListener { public int addRootView( final T rootView, final WritableMap initialProps, final @Nullable String initialUITemplate) { final int rootTag = ReactRootViewTagGenerator.getNextRootViewTag(); + //TODO T31905686: Refactor both addRootView methods into one method ThemedReactContext reactContext = new ThemedReactContext(mReactApplicationContext, rootView.getContext()); mMountingManager.addRootView(rootTag, rootView); mReactContextForRootTag.put(rootTag, reactContext); - mBinding.startSurface(rootTag, ((ReactRoot) rootView).getJSModuleName(), (NativeMap) initialProps); + String moduleName = ((ReactRoot) rootView).getJSModuleName(); + if (DEBUG) { + FLog.d(TAG, "Starting surface for module: %s and reactTag: %d", moduleName, rootTag); + } + mBinding.startSurface(rootTag, moduleName, (NativeMap) initialProps); if (initialUITemplate != null) { mBinding.renderTemplateToSurface(rootTag, initialUITemplate); } @@ -147,6 +152,9 @@ public class FabricUIManager implements UIManager, LifecycleEventListener { final int rootTag = ReactRootViewTagGenerator.getNextRootViewTag(); ThemedReactContext reactContext = new ThemedReactContext(mReactApplicationContext, rootView.getContext()); + if (DEBUG) { + FLog.d(TAG, "Starting surface for module: %s and reactTag: %d", moduleName, rootTag); + } mMountingManager.addRootView(rootTag, rootView); mReactContextForRootTag.put(rootTag, reactContext); mBinding.startSurfaceWithConstraints( @@ -172,6 +180,9 @@ public class FabricUIManager implements UIManager, LifecycleEventListener { // TODO T31905686: integrate with the unmounting of Fabric React Renderer. mMountingManager.removeRootView(reactRootTag); mReactContextForRootTag.remove(reactRootTag); + if (DEBUG) { + FLog.d(TAG, "Removing surface for reactTag: ", reactRootTag); + } } @Override @@ -182,6 +193,9 @@ public class FabricUIManager implements UIManager, LifecycleEventListener { @Override public void onCatalystInstanceDestroy() { + if (DEBUG) { + FLog.d(TAG, "Destroying Catalyst Instance" ); + } mEventDispatcher.removeBatchEventDispatchedListener(mEventBeatManager); mEventDispatcher.unregisterEventEmitter(FABRIC); mBinding.unregister(); @@ -421,6 +435,10 @@ public class FabricUIManager implements UIManager, LifecycleEventListener { public void updateRootLayoutSpecs( final int rootTag, final int widthMeasureSpec, final int heightMeasureSpec) { + if (DEBUG) { + FLog.d(TAG, "Updating Root Layout Specs"); + } + mReactApplicationContext.runOnJSQueueThread(new Runnable() { @Override public void run() {