Detect startSurface race-conditions and warn silently

Summary:
Crash in debug, log a warning and continue in production.

Changelog: [Internal]

Differential Revision: D26133167

fbshipit-source-id: 60279363a3e90d592e7ddbde188c13cda89c28c6
This commit is contained in:
Joshua Gross
2021-01-28 16:22:06 -08:00
committed by Facebook GitHub Bot
parent ef765d423c
commit b0ec350568
@@ -147,7 +147,14 @@ public class SurfaceMountingManager {
return;
}
if (rootView.getId() != View.NO_ID) {
if (rootView.getId() == mSurfaceId) {
ReactSoftException.logSoftException(
TAG,
new IllegalViewOperationException(
"Race condition in addRootView detected. Trying to set an id of ["
+ mSurfaceId
+ "] on the RootView, but that id has already been set. "));
} else if (rootView.getId() != View.NO_ID) {
FLog.e(
TAG,
"Trying to add RootTag to RootView that already has a tag: existing tag: [%d] new tag: [%d]",