Refactor android view observation

Summary:
The previous approach was designed for a world that didnt happen and was extremely confusing and allowed for states that didnt make a lot of sense. E.g it was possible we were snapshotting multiple views.

The new model is much simpler. we still depend on the root view resolver to tell us about root decor views but now we just attach a predraw listener to the top most view and push out the updates. This is handled by the new class decor view tracker which is a replacement for all the observer business

Additionally we use a conflated chanel in the update queue, this means if the background processing is slow we wont keep adding new frames to the queue, we just keep 1 and the most recent frame

Partial layout traversal -> Layout traversal as traversal is now always from top to bottom of the whole application

Reviewed By: lblasa

Differential Revision: D50791527

fbshipit-source-id: 43640723aefa775aa7b74065f405cc08224ed8b8
This commit is contained in:
Luke De Feo
2023-11-02 12:29:07 -07:00
committed by Facebook GitHub Bot
parent 87cb9bd77a
commit c93c494ef4
16 changed files with 359 additions and 615 deletions

View File

@@ -26,7 +26,6 @@ import com.facebook.flipper.plugins.uidebugger.UIDebuggerFlipperPlugin;
import com.facebook.flipper.plugins.uidebugger.core.UIDContext;
import com.facebook.flipper.plugins.uidebugger.descriptors.DescriptorRegister;
import com.facebook.flipper.plugins.uidebugger.litho.UIDebuggerLithoSupport;
import com.facebook.flipper.plugins.uidebugger.observers.TreeObserverFactory;
import com.facebook.litho.config.ComponentsConfiguration;
import com.facebook.litho.editor.flipper.LithoFlipperDescriptors;
import java.util.Arrays;
@@ -63,7 +62,6 @@ public final class FlipperInitializer {
client.addPlugin(NavigationFlipperPlugin.getInstance());
DescriptorRegister descriptorRegister = DescriptorRegister.Companion.withDefaults();
TreeObserverFactory treeObserverFactory = TreeObserverFactory.Companion.withDefaults();
UIDContext uidContext = UIDContext.Companion.create((Application) context);
UIDebuggerLithoSupport.INSTANCE.enable(uidContext);
UIDebuggerComposeSupport.INSTANCE.enable(uidContext);