Fix race condition in FabricUIManager.StartSurface method

Summary:
This diff fixes a race condition in the execution of FabricUIManager.StartSurface method.
The rootcause is that startSurface is executing getViewportOffset from a background thread.

changelog: [internal]

Reviewed By: shergin

Differential Revision: D25617154

fbshipit-source-id: 9351201088164e74bb0b9454e30651e1de0da912
This commit is contained in:
David Vacca
2020-12-17 16:15:55 -08:00
committed by Facebook GitHub Bot
parent d51cc6b5e6
commit 5a37773e53
2 changed files with 8 additions and 1 deletions
@@ -27,6 +27,7 @@ import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
import com.facebook.infer.annotation.ThreadConfined;
@@ -418,6 +419,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
return mState;
}
@UiThread
public static Point getViewportOffset(View v) {
int[] locationInWindow = new int[2];
v.getLocationInWindow(locationInWindow);