From e09c56af970ba76a928117194d198200dc48e3f0 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 5 Jun 2018 13:13:03 -0700 Subject: [PATCH] Enable proguard for Fabric in release builds Reviewed By: shergin Differential Revision: D8247814 fbshipit-source-id: 94ed8a767fcf4f6093646618a5691ff17753ffe0 --- .../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 91098711e..588d7bc59 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -15,6 +15,7 @@ import static com.facebook.react.uimanager.common.UIManagerType.FABRIC; import android.util.Log; import android.view.View; import com.facebook.infer.annotation.Assertions; +import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.react.bridge.JavaScriptContextHolder; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReadableArray; @@ -51,6 +52,7 @@ import javax.annotation.Nullable; * API. */ @SuppressWarnings("unused") // used from JNI +@DoNotStrip public class FabricUIManager implements UIManager, JSHandler { private static final String TAG = FabricUIManager.class.getSimpleName(); @@ -94,6 +96,7 @@ public class FabricUIManager implements UIManager, JSHandler { /** Creates a new {@link ReactShadowNode} */ @Nullable + @DoNotStrip public ReactShadowNode createNode( int reactTag, String viewName, int rootTag, ReadableNativeMap props, long instanceHandle) { if (DEBUG) { @@ -145,6 +148,7 @@ public class FabricUIManager implements UIManager, JSHandler { * including its children set (note that the children nodes will not be cloned). */ @Nullable + @DoNotStrip public ReactShadowNode cloneNode(ReactShadowNode node, long instanceHandle) { if (DEBUG) { Log.d(TAG, "cloneNode \n\tnode: " + node); @@ -165,6 +169,7 @@ public class FabricUIManager implements UIManager, JSHandler { * children set will be empty. */ @Nullable + @DoNotStrip public ReactShadowNode cloneNodeWithNewChildren(ReactShadowNode node, long instanceHandle) { if (DEBUG) { Log.d(TAG, "cloneNodeWithNewChildren \n\tnode: " + node); @@ -185,6 +190,7 @@ public class FabricUIManager implements UIManager, JSHandler { * props will be overridden with the {@link ReadableMap} received by parameter. */ @Nullable + @DoNotStrip public ReactShadowNode cloneNodeWithNewProps( ReactShadowNode node, @Nullable ReadableNativeMap newProps, long instanceHandle) { if (DEBUG) { @@ -208,6 +214,7 @@ public class FabricUIManager implements UIManager, JSHandler { * children set will be empty. */ @Nullable + @DoNotStrip public ReactShadowNode cloneNodeWithNewChildrenAndProps( ReactShadowNode node, ReadableNativeMap newProps, long instanceHandle) { if (DEBUG) { @@ -242,6 +249,7 @@ public class FabricUIManager implements UIManager, JSHandler { * ReactShadowNode}. */ @Nullable + @DoNotStrip public void appendChild(ReactShadowNode parent, ReactShadowNode child) { if (DEBUG) { Log.d(TAG, "appendChild \n\tparent: " + parent + "\n\tchild: " + child); @@ -263,6 +271,7 @@ public class FabricUIManager implements UIManager, JSHandler { * @return an empty {@link List} that will be used to append the {@link * ReactShadowNode} elements of the root. Typically this List will contain one element. */ + @DoNotStrip public List createChildSet(int rootTag) { if (DEBUG) { Log.d(TAG, "createChildSet rootTag: " + rootTag); @@ -273,10 +282,12 @@ public class FabricUIManager implements UIManager, JSHandler { /** * Adds the {@link ReactShadowNode} to the {@link List} received by parameter. */ + @DoNotStrip public void appendChildToSet(List childList, ReactShadowNode child) { childList.add(child); } + @DoNotStrip public synchronized void completeRoot(int rootTag, @Nullable List childList) { try { childList = childList == null ? new LinkedList() : childList; @@ -383,6 +394,7 @@ public class FabricUIManager implements UIManager, JSHandler { } @Override + @DoNotStrip public int addRootView( final T rootView) { final int rootTag = ReactRootViewTagGenerator.getNextRootViewTag(); @@ -409,6 +421,7 @@ public class FabricUIManager implements UIManager, JSHandler { } @Override + @DoNotStrip public void updateRootLayoutSpecs(int rootViewTag, int widthMeasureSpec, int heightMeasureSpec) { ReactShadowNode rootNode = mRootShadowNodeRegistry.getNode(rootViewTag); if (rootNode == null) { @@ -458,7 +471,7 @@ public class FabricUIManager implements UIManager, JSHandler { * Updates the styles of the {@link ReactShadowNode} based on the Measure specs received by * parameters. */ - public void updateRootView( + private void updateRootView( ReactShadowNode node, int widthMeasureSpec, int heightMeasureSpec) { int widthMode = View.MeasureSpec.getMode(widthMeasureSpec); int widthSize = View.MeasureSpec.getSize(widthMeasureSpec); @@ -502,6 +515,7 @@ public class FabricUIManager implements UIManager, JSHandler { } @Nullable + @DoNotStrip public long createEventTarget(int reactTag) { long instanceHandle = mNativeViewHierarchyManager.getInstanceHandle(reactTag); long context = mJSContext.get(); @@ -514,19 +528,23 @@ public class FabricUIManager implements UIManager, JSHandler { return eventTarget; } + @DoNotStrip public void registerEventHandler(long eventHandlerPointer) { mEventHandlerPointer = eventHandlerPointer; } + @DoNotStrip public void releaseEventTarget(long eventTargetPointer) { mBinding.releaseEventTarget(mJSContext.get(), eventTargetPointer); } + @DoNotStrip public void releaseEventHandler(long eventHandlerPointer) { mBinding.releaseEventHandler(mJSContext.get(), eventHandlerPointer); } @Override + @DoNotStrip public void invoke(long eventTarget, String name, WritableMap params) { if (DEBUG) { Log.d(