Stop all surfaces when tearing down FabricUIManager

Summary:
Teardown any remaining surfaces when tearing down FabricUIManager.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21774541

fbshipit-source-id: cfd544f1721599521e0fd6677d45208e51b8340d
This commit is contained in:
Joshua Gross
2020-05-29 15:44:39 -07:00
committed by Facebook GitHub Bot
parent 983b0a0903
commit 8a02450fbb
2 changed files with 12 additions and 0 deletions
@@ -89,4 +89,7 @@ public class ReactFeatureFlags {
/** Feature flag to configure initialization of Fabric surfaces. */
public static boolean enableFabricStartSurfaceWithLayoutMetrics = true;
/** Feature flag to have FabricUIManager teardown stop all active surfaces. */
public static boolean enableFabricStopAllSurfacesOnTeardown = false;
}
@@ -286,6 +286,15 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
// memory immediately.
mDispatchUIFrameCallback.stop();
// Stop all attached surfaces
if (ReactFeatureFlags.enableFabricStopAllSurfacesOnTeardown) {
FLog.e(TAG, "stop all attached surfaces");
for (int surfaceId : mReactContextForRootTag.keySet()) {
FLog.e(TAG, "stop attached surface: " + surfaceId);
stopSurface(surfaceId);
}
}
mBinding.unregister();
mBinding = null;