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
This commit is contained in:
David Vacca 2020-05-01 00:17:38 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 919554f2c6
Коммит 09487e4e95
1 изменённых файлов: 15 добавлений и 43 удалений

Просмотреть файл

@ -94,29 +94,19 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
private int mLastWidth = 0; private int mLastWidth = 0;
private int mLastHeight = 0; private int mLastHeight = 0;
private @UIManagerType int mUIManagerType = DEFAULT; private @UIManagerType int mUIManagerType = DEFAULT;
private final boolean mUseSurface;
public ReactRootView(Context context) { public ReactRootView(Context context) {
super(context); super(context);
mUseSurface = false;
init();
}
public ReactRootView(Context context, boolean useSurface) {
super(context);
mUseSurface = useSurface;
init(); init();
} }
public ReactRootView(Context context, AttributeSet attrs) { public ReactRootView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
mUseSurface = false;
init(); init();
} }
public ReactRootView(Context context, AttributeSet attrs, int defStyle) { public ReactRootView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
mUseSurface = false;
init(); init();
} }
@ -126,13 +116,6 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 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"); Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "ReactRootView.onMeasure");
try { try {
boolean measureSpecsUpdated = boolean measureSpecsUpdated =
@ -307,9 +290,6 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
@Override @Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) { 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. // No-op since UIManagerModule handles actually laying out children.
} }
@ -393,10 +373,6 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
mAppProperties = initialProperties; mAppProperties = initialProperties;
mInitialUITemplate = initialUITemplate; mInitialUITemplate = initialUITemplate;
if (mUseSurface) {
// TODO initialize surface here
}
mReactInstanceManager.createReactContextInBackground(); mReactInstanceManager.createReactContextInBackground();
attachToReactInstanceManager(); attachToReactInstanceManager();
@ -534,26 +510,22 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
CatalystInstance catalystInstance = reactContext.getCatalystInstance(); CatalystInstance catalystInstance = reactContext.getCatalystInstance();
String jsAppModuleName = getJSModuleName(); String jsAppModuleName = getJSModuleName();
if (mUseSurface) { if (mWasMeasured) {
// TODO call surface's runApplication updateRootLayoutSpecs(mWidthMeasureSpec, mHeightMeasureSpec);
} 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);
} }
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 { } finally {
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE); Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
} }