From 09487e4e95a88da7d9fa8b0b6a09f4ea5fe8c25e Mon Sep 17 00:00:00 2001 From: David Vacca Date: Fri, 1 May 2020 00:17:38 -0700 Subject: [PATCH] Cleanup ReactRootView Summary: This diff removes the variable 'useSurface' which wasn't beeing used in ReactRootView anymore changelog: [Internal][Android] Internal cleanup of ReactRootView Reviewed By: JoshuaGross Differential Revision: D21318109 fbshipit-source-id: f850b27811608d16b22b6a3964455b172705c4c7 --- .../com/facebook/react/ReactRootView.java | 58 +++++-------------- 1 file changed, 15 insertions(+), 43 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java b/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java index 26c39f9df01..6dedbf620f2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java @@ -94,29 +94,19 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot { private int mLastWidth = 0; private int mLastHeight = 0; private @UIManagerType int mUIManagerType = DEFAULT; - private final boolean mUseSurface; public ReactRootView(Context context) { super(context); - mUseSurface = false; - init(); - } - - public ReactRootView(Context context, boolean useSurface) { - super(context); - mUseSurface = useSurface; init(); } public ReactRootView(Context context, AttributeSet attrs) { super(context, attrs); - mUseSurface = false; init(); } public ReactRootView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); - mUseSurface = false; init(); } @@ -126,13 +116,6 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - // TODO: T60453649 - Add test automation to verify behavior of onMeasure - - if (mUseSurface) { - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - return; - } - Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "ReactRootView.onMeasure"); try { boolean measureSpecsUpdated = @@ -307,9 +290,6 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot { @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { - if (mUseSurface) { - super.onLayout(changed, left, top, right, bottom); - } // No-op since UIManagerModule handles actually laying out children. } @@ -393,10 +373,6 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot { mAppProperties = initialProperties; mInitialUITemplate = initialUITemplate; - if (mUseSurface) { - // TODO initialize surface here - } - mReactInstanceManager.createReactContextInBackground(); attachToReactInstanceManager(); @@ -534,26 +510,22 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot { CatalystInstance catalystInstance = reactContext.getCatalystInstance(); String jsAppModuleName = getJSModuleName(); - if (mUseSurface) { - // TODO call surface's runApplication - } else { - if (mWasMeasured) { - updateRootLayoutSpecs(mWidthMeasureSpec, mHeightMeasureSpec); - } - - WritableNativeMap appParams = new WritableNativeMap(); - appParams.putDouble("rootTag", getRootViewTag()); - @Nullable Bundle appProperties = getAppProperties(); - if (appProperties != null) { - appParams.putMap("initialProps", Arguments.fromBundle(appProperties)); - } - - mShouldLogContentAppeared = true; - - // TODO T62192299: remove this - FLog.e(TAG, "runApplication: call AppRegistry.runApplication"); - catalystInstance.getJSModule(AppRegistry.class).runApplication(jsAppModuleName, appParams); + if (mWasMeasured) { + updateRootLayoutSpecs(mWidthMeasureSpec, mHeightMeasureSpec); } + + WritableNativeMap appParams = new WritableNativeMap(); + appParams.putDouble("rootTag", getRootViewTag()); + @Nullable Bundle appProperties = getAppProperties(); + if (appProperties != null) { + appParams.putMap("initialProps", Arguments.fromBundle(appProperties)); + } + + mShouldLogContentAppeared = true; + + // TODO T62192299: remove this + FLog.e(TAG, "runApplication: call AppRegistry.runApplication"); + catalystInstance.getJSModule(AppRegistry.class).runApplication(jsAppModuleName, appParams); } finally { Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE); }