Commit Graph

660 Commits

Author SHA1 Message Date
Nikita Lutsenko
b66bff3837 sonar | Replace global static variables within jni/sonar.cpp with local static.
Summary: Replacing global static varaibles with local static. No cost at startup time, and also fixes any potential static initialization order fiasco.

Differential Revision: D45900844

fbshipit-source-id: 4ff05cbefe2f0c00199f40b9127e28c355d1819e
2023-05-16 18:56:17 -07:00
Luke De Feo
23ebd8b865 Change logic for generating debug wrapper for nodes
Summary:
Previously we would only generate debug wrapper for render core layout result when uidebugger was currently connected.

This meant if you navigate to a bloks screen *before* having the ui debugger open at render time it would read ui debugger as disconnected since the ui debugger is not a background plugin. The result is the user would see the native nodes instead of the bound tree, it was extra confusing since the layout result was cached so going forward and back doesnt solve it.

The ideal solution would be to have a global flipper is connected on the client but this isnt available yet, lorenzo said he would work on it later.

As a work around we use the fact that the uidebugger has ever been connected in this session.

It can still be confusing since the initial load of a bloks screen migt not generate the debug nodes until you navigate to the plugin once. I will add a note to the docs so say that you need to have open the uidebugger once before nodes will appear

Reviewed By: mweststrate

Differential Revision: D45605120

fbshipit-source-id: 970943b9f8f98221b7fc5e20bb1caf18c2266474
2023-05-10 05:05:34 -07:00
Luke De Feo
70cdc9bedc Android start sending frame scan event instead of subtree update
Summary: Cosmetic change to make the events more inline with what they are

Reviewed By: lblasa

Differential Revision: D42999134

fbshipit-source-id: e026e38da7e50e8f5520271246f9627eb22e8965
2023-05-04 04:12:01 -07:00
Luke De Feo
98b94d62cf Add bloks integration infra + Layout result wrapper
Summary:
This adds the base infra for the UIDebugger bloks integration as well as an implementation for the Layout result wrapper for bloks. When theUIDebugger is connected we wrap the original layout result with a debug varient that delegates all methods to the original layout result but also provides access to the bloks model.

This allows the UIDebugger to inspect the Layout result and bloks model together

Reviewed By: pasqualeanatriello

Differential Revision: D43444444

fbshipit-source-id: ac531a0c7491c05db1d6f7671e3ab09c73c213b9
2023-05-03 07:51:29 -07:00
Lorenzo Blasa
8657bcba64 Report payload size
Summary: Android changes to send payload size

Reviewed By: passy

Differential Revision: D45121791

fbshipit-source-id: 2cdf8f7b8849bce06949d3f7db6bdc5674fe15b7
2023-04-21 04:09:23 -07:00
Luke De Feo
53aca9a661 Hidden attributes
Summary:
These are attributes that are:
1.  Not common across frameworks
2. Not in every node
3. Will not be visualised via inspectable attribute mechansism

Currently we will use them for bloks but they should be useful for other features down the road

Reviewed By: lblasa

Differential Revision: D45048025

fbshipit-source-id: c258d0a384a2b09abb642778e68da178899fa9eb
2023-04-18 08:01:50 -07:00
Luke De Feo
c2fc54057a Make metadata tags a map and rename to custom attributes
Summary: This will allow a lot more flexibility and will be essential for making bloks work

Reviewed By: lblasa

Differential Revision: D44871256

fbshipit-source-id: 59d9fdccea7b18406eac532080e80a69a251267b
2023-04-18 08:01:50 -07:00
Luke De Feo
eee74044ff Start sending parent id
Summary: Since subtree update is effectively a frame dump its a lot easier to send the parent ID. This will save having figure it out on the client which is somewhat expensive and is needed for bloks

Reviewed By: lblasa

Differential Revision: D45048023

fbshipit-source-id: 90c4888df063de0aa69c9b93c86d9891e30becbe
2023-04-18 08:01:50 -07:00
Razvan Racasanu
c3381a3c9f Add Flipper support for secondary processes
Summary: Allow callers to pass id, deviceName, processName, and packageName when initializing Flipper. Since these are used to create the connection id, callers can use these to configure Flipper to work for secondary processes.

Reviewed By: calebgomer

Differential Revision: D44719389

fbshipit-source-id: 3df6d47855c113f454f37031df32c4891626aa66
2023-04-07 12:58:52 -07:00
generatedunixname89002005232357
452154802f Revert D44566060: Multisect successfully blamed D44566060 for test or build failures
Summary:
This diff is reverting D44566060
D44566060: Add Flipper support for secondary processes in Messenger VR by rra has been identified to be causing the following test or build failures:

Tests affected:
- [//fbandroid/javatests/com/facebook/messenger:no_sonar_in_production - main](https://www.internalfb.com/intern/test/281474996792449/)

Here's the Multisect link:
https://www.internalfb.com/multisect/1809753
Here are the tasks that are relevant to this breakage:

We're generating a revert to back out the changes in this diff, please note the backout may land if someone accepts it.

If you believe this diff has been generated in error you may Commandeer and Abandon it.

Reviewed By: passy

Differential Revision: D44682510

fbshipit-source-id: c0ae489bc5ae22c5339edd2c8988126b0adedd7f
2023-04-05 10:15:57 -07:00
Razvan Racasanu
2c12166b54 Add Flipper support for secondary processes in Messenger VR
Summary: Allow callers to pass id, deviceName, processName, and packageName when initializing Flipper. Since these are used to create the connection id, callers can use these to configure Flipper to work for secondary processes.

Reviewed By: passy

Differential Revision: D44566060

fbshipit-source-id: 605264c230956f4c9643c95c610ec40d736547ac
2023-04-04 11:25:23 -07:00
Lorenzo Blasa
8f9bf978e1 Ignore OverlayHandlerView as active child
Summary:
On foldable devices, there's an issue whereas the topmost root view is of type `OverlayHandlerView`.

This doesn't seem to be related in any way to the running app's UI. Or at least is not something of interest when debugging the running app's UI (for example, ig4a).

This change effectively ignores the `OverlayHandlerView` instance as active child and instead returns the next to last root view.

Reviewed By: LukeDefeo

Differential Revision: D44579223

fbshipit-source-id: cea52289c5ba1e6a96817232ac54725b8d2f48d9
2023-03-31 10:11:06 -07:00
Ruslan Shestopalyuk
aa6f04815b Add option to allow debugging Android services as well (#4631)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/4631

In React Native for VR we use `FlipperUtils.shouldEnableFlipper()` to determine whether Flipper should be enabled for the given app build.

The problem is that some of our apps are legitimately running as services (e.g. `com.oculus.explore:explore`), so the check added inside Flipper in D5126205 which only enables Flipper for "main application's process".

This diff adds an ability to relax this requirement (as we do want to do it for the RN VR applications)

Reviewed By: passy

Differential Revision: D44511667

fbshipit-source-id: 673912b204391799a9e8821b737681d1f44bd6a8
2023-03-30 04:17:43 -07:00
Lorenzo Blasa
76bfd67cd9 PerformanceStatsEvent
Summary: ^

Reviewed By: aigoncharov

Differential Revision: D44062826

fbshipit-source-id: 3f66411a8648e635b75dfea29a6256e64cfbf5d5
2023-03-16 07:35:44 -07:00
Luke De Feo
914b32c383 Add framework event infra
Summary:
Added infra for collecting events from UI frameworks.
1. Framework event metadata captures all the static metadata around the event. This allows to us to not send the same metadata in every event as well as populate the monitoring drop down immediately. This is sent in init since this information is static
2. Framework event itself is quite bare at the moment. It will have thread and more attributes in the future

The UIdebugger litho support ulitity has been simplified now there are 3 extension points.

Context renamed to UIDContext since it is referenced in app initialisers where the android context is also imported and it create a naming collision

Reviewed By: lblasa

Differential Revision: D42606933

fbshipit-source-id: a419f3fd424c533d586813004c40b68feafd9a2e
2023-03-01 08:49:49 -08:00
Fabio Carballo
fa74ebba68 Restore TimeMachine in Flipper
Summary:
The goal is to restore the *TimeMachine* functionality in Flipper while the new UI Debugger is working in a revamped version. This version was previously removed in D42573698 (b31f8c8755).

This time machine functionality will only be available for *LithoView* that are backed by a *ComponentTree*.

Below you can find a high-level overview of the current schema:

{F884011465}

Reviewed By: LukeDefeo, adityasharat

Differential Revision: D43574130

fbshipit-source-id: fe9d661e5fcce9655e70be4785652e7048dade54
2023-02-27 12:19:37 -08:00
Lorenzo Blasa
b6f3be01f9 Remove client connection timeout
Summary: Having a timeout of 10 seconds can create a connection loop if Desktop is slow and doesn't provide a client certificate within the timeframe.

Reviewed By: antonk52

Differential Revision: D43405793

fbshipit-source-id: b1eebb4d2d66f02000f15a9889992ed0cc79bde2
2023-02-24 07:20:54 -08:00
Sachin Tewari
2e31247486 Move flipper-fresco-plugin to fresco's repo from flipper's repo (#4546)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/4546

Move flipper-fresco-plugin to fresco's repo from flipper's repo

Reviewed By: passy

Differential Revision: D43467895

fbshipit-source-id: efea88563cf931baf4bda0c8bbdfbe41d0f769c5
2023-02-23 04:44:41 -08:00
Luke De Feo
ec7bd16439 Fix bounds for android view
Summary: Fixes: https://fb.workplace.com/groups/443457641253219/permalink/522116393387343/

Reviewed By: richkzad

Differential Revision: D43313031

fbshipit-source-id: b1f97632131cb4e71323b2c3e8cd36dfe7b0f78e
2023-02-15 10:23:42 -08:00
Luke De Feo
9540ea579c Remove attributes from layout panel
Summary: The additional panel was confusing. We can add a search filter box later if needed

Reviewed By: lblasa

Differential Revision: D42801264

fbshipit-source-id: 4b2ecb44c5bc4751564a5cac3716f5af4a951f58
2023-01-27 04:39:43 -08:00
Luke De Feo
f996f90cf4 Fix Interactions with TreeObserver Manager moved to main thread
Reviewed By: lblasa

Differential Revision: D42608384

fbshipit-source-id: 20c074eeac1372405f44edc8eb8ab41cb7dd2be9
2023-01-25 04:47:11 -08:00
Luke De Feo
73afa391f8 Introduce shared throttle
Summary:
Even with batching, updates can get split in half due to fact that each litho view has its own independant throttle. Eventually they will drift and and a traversal will get scheduled past the current frame for some of the views. It results in artifacts in the visualiser and will make time travelling wonky
The

Reviewed By: lblasa

Differential Revision: D42606932

fbshipit-source-id: c4cdf729302a380928b4d8720a59d5f7f6ff645a
2023-01-25 04:47:11 -08:00
Luke De Feo
b5392fb818 Batch subtree updates sent on the same frame
Summary:
This is needed in preperation for the next diff where we will introduce an observer per litho view. Without batching we end up with really poor performance for a few reasons:
1. There are some operations on the desktop plugin that are o(nodes) so even sending small batches
2. Flipper isnt really a high performance message bus, it seems to prefer fewer larger messages
3. Queuing time on the client builds up as you spend more time waiting on the socket

In a future diff will address:
The name of subtree update event. It should probably be called something like FrameUpdate since they are always full frames
The performance monitoring, will more to timing methods and summing the result rather than the current appraoch of time markers

Reviewed By: lblasa

Differential Revision: D42453229

fbshipit-source-id: eda9830b4420e82874717cc69b241e1689f20029
2023-01-25 04:47:11 -08:00
Luke De Feo
3b65994ca6 Interactions with TreeObserverManager moved to main thread
Summary: Needed for next diff

Reviewed By: lblasa

Differential Revision: D42453228

fbshipit-source-id: 29e2655bf08376cd12a98ab61fe95b804b0c7ba1
2023-01-25 04:47:11 -08:00
Luke De Feo
a6ab3f5649 Remove Coordinate update event
Summary: This idea did not pan out

Reviewed By: lblasa

Differential Revision: D42453231

fbshipit-source-id: 1feac79b8655f4249e84b64cdce9fded6e5f5718
2023-01-25 04:47:11 -08:00
Luke De Feo
412d10b280 Make sure pending metadata is reset and is thread safe
Summary: We have gotton concurrent modification crashes from this

Reviewed By: lblasa

Differential Revision: D42343224

fbshipit-source-id: 9cf4046da63d40cbe6632c3ae24d95abd21081ba
2023-01-25 04:47:11 -08:00
Pasquale Anatriello
b31f8c8755 Delete Litho timeMachine
Summary:
This plugin is rarely used and would need to be re-worked to work in a world where ComponentTree is not the only way of rendering a Litho hierarchy.
Deleting for now for simplicity

Reviewed By: adityasharat, passy

Differential Revision: D42573698

fbshipit-source-id: 0d9cd713b668e6fc79cd5cddcdcb9f24ed98f927
2023-01-20 10:19:06 -08:00
Luke De Feo
6deedabfb2 Remove UI Debugger litho components from open source build
Summary:
I created a separate folder under src called facedbook, which
1.  isnt synced to github
2.  isnt build by gradle

I also needed to exclude the file with the duplicate symbol from buck. I seemed to have to move both the src/facebook and src/main under one buck file to get the exclude to work

Reviewed By: lblasa

Differential Revision: D41612114

fbshipit-source-id: a8386e1b1eabdeca2a800d98d8732b2ca694836b
2022-12-19 09:20:27 -08:00
Luke De Feo
0414e145a9 Port visibility and mount state for litho mountables
Summary: Based off D41224546

Reviewed By: mihaelao

Differential Revision: D41582451

fbshipit-source-id: 8792d40e47b2049e63a22a51363c093be310fe78
2022-12-19 09:20:27 -08:00
generatedunixname89002005325672
ecae770824 Daily arc lint --take KTFMT
Reviewed By: adamjernst

Differential Revision: D41833756

fbshipit-source-id: 0ecc95aff3bdadadb0769dec55d27fb84fe50e95
2022-12-12 07:51:03 -08:00
Luke De Feo
1a9724d790 Added inline tree attributes
Summary:
This is temporary solution to get to parity with the old plugin. In future would like to make this more flexible on the desktop side

Additionally getData was renamed to getAttributes for consistency

Reviewed By: lblasa

Differential Revision: D41845248

fbshipit-source-id: 50e94a7712f5d42938229134e212cef5d379475d
2022-12-12 07:28:37 -08:00
Luke De Feo
97cca42822 Remove native scan
Summary: This is obsolete and maintaining it as the protocol changes no longer makes sense

Reviewed By: lblasa

Differential Revision: D41845247

fbshipit-source-id: c4ead597ca66223ccfa091ac79a6a80784a3c8e4
2022-12-12 07:28:37 -08:00
Luke De Feo
c238740af1 Add support for non support libarry scroll views
Summary: we had special handling previously for nested scrollview and we previously used the indirect approach of asking for the local visible rect. New approach is to get the scroll x from the parent and apply it, will work for all scrolling view and it is a lot clearer what the intention is.

Reviewed By: lblasa

Differential Revision: D41772106

fbshipit-source-id: 04b5e68ecabd70548e788ed18423a360ce6c3fa7
2022-12-07 04:31:56 -08:00
Luke De Feo
e195c7c3fd Dont show non visible fragments
Summary: On messenger they use fragments heavily and for navigation. The hide some views via the fragment but we were using that so we saw a lot of overlapping boxes. Ive added a check for if the fragment isVisible as well as exported some more fragment state

Reviewed By: lblasa

Differential Revision: D41800223

fbshipit-source-id: fde33c7542f5fa98d8b98e0722d4292f2d1b67d0
2022-12-07 04:27:25 -08:00
Luke De Feo
faac3dddfb Android activity tracking uses root view resolver as sole source of truth
Summary:
The previous approach was to append any 'extra/floating' root view to the end of the childrens for the application descriptor. But the active child was always the last view so if there was a 'floating' decor view with no activity it would always be the active child, even if you opened a real activity from it. This was possible to do in FB4a and you could get into a situation where you couldn't see the top most activity.

New approach is to only iterate the root views from the resolver since it contains everything and map to activity if possible.

Reviewed By: lblasa

Differential Revision: D41731951

fbshipit-source-id: 9ef3fcfdaa41e9b07606ca6781cf22482b54e072
2022-12-05 07:07:44 -08:00
Luke De Feo
00334acb2b Fixing issue where certain activities not tracked
Summary:
The root view resolver will always find all root views but there was a bug in the listrootviews method. The code was very complex and most of the code seemed to be unneeded. Its now working. The listrootviews method now just returns teh contents of the observable array.

The reason we needed this is that Certain activities dont seem to tracked by the listener we add to `registerActivityLifecycleCallbacks` Its as if there is a floating decor with no activity. One example in FB4a is clicking on a notification in the notifications panel

Reviewed By: lblasa

Differential Revision: D41522791

fbshipit-source-id: b49b0104ddf758f097e1fd3f9ac6588de2d3646e
2022-12-05 07:07:44 -08:00
Lorenzo Blasa
d954828bbc Remove concept of dynamic metadata
Summary:
Although conceptually it made sense, it creates an issue with registration.

### Let me explain

Effectively, as an engineer, what constitutes static and dynamic metadata and how can I ensure that is treated as such?

It may be trivial to answer those questions but there was a fundamental assumption for static metadata that no longer holds true.  Static metadata was registered when descriptors were first referenced, which most of the times happens when added to the descriptors registry.

This used worked fine until we introduced the concept of deferred attributes.
Deferred attributes, even though static, may register its metadata only when requested to.

The issue is even more fundamental as not all the objects that declare static metadata will be loaded into memory by the time the plugin is connected and sends this.

### Solution

To simplify, as the concept was never really used, there's only metadata.

There's only pending metadata which is metadata that is yet to be sent to Flipper Desktop.

Reviewed By: LukeDefeo

Differential Revision: D41614186

fbshipit-source-id: 85d62eeff81ff22ae6e969d7b5aed8628b336258
2022-11-30 07:23:29 -08:00
Luke De Feo
26a7ad7952 Summary: In an earlier diff we moved the retreival of litho props to back ground thread. Fetching the props also creates dynamic metadata, and the computation was deferred after the metadata was sent meaning we were sending data down without associated metadata.
Reviewed By: lblasa

Differential Revision: D41581345

fbshipit-source-id: c17a57d811025c3716bc3bd26d119b273f1603aa
2022-11-29 08:54:58 -08:00
Luke De Feo
d0a05ad1a9 Use global id for debugcomponent id
Summary: Global Id is stable as the component is rerendered. It is not stable if the whole component tree updates so we might want to deal with this in the future

Reviewed By: lblasa

Differential Revision: D41581346

fbshipit-source-id: 0c2834ba452ddcfc3e0a7392672825fc040901d9
2022-11-29 08:54:58 -08:00
Luke De Feo
cffe42a93a Litho state support
Reviewed By: lblasa

Differential Revision: D41581347

fbshipit-source-id: 262670053c586676be4f9465854ec79f95699d33
2022-11-29 08:54:58 -08:00
Lorenzo Blasa
76b1673d15 Basic array support
Summary:
Attributes Inspector didn't have support for inspectable arrays.

This change addresses an issue with the inspectable itself and adds basic support to it in the visualiser.

Reviewed By: LukeDefeo

Differential Revision: D41522879

fbshipit-source-id: f9cad42470541039c8157477b0fe9bc58f18f1ba
2022-11-28 10:19:20 -08:00
Lorenzo Blasa
43f44652f4 Change snapshots format to png
Summary:
There was an issue whereas snapshots were not properly rendered on retina devices.

After running a few tests, the issue seems to be solved by changing the snapshot format from jpeg to png.

Reviewed By: antonk52

Differential Revision: D41520939

fbshipit-source-id: 1563fe89162e41f71418357a7e58caaf46581f04
2022-11-24 07:14:55 -08:00
Lorenzo Blasa
ef64abb495 Improve color inspector
Summary:
Before this change, color inspector used a color picker that showed: color, rgba, hex.

The problem is that engineers have to click on it to see these values.

This change leaves the picker as is, but presents both hex and rgba inlined within the inspector thus avoiding extra interactions.

Reviewed By: antonk52

Differential Revision: D41495740

fbshipit-source-id: c8af01e3060d2e6725295418293b1e30679c1b1f
2022-11-23 08:31:13 -08:00
Luke De Feo
7ec09b4f95 Shift fetching litho attributes to background thread
Summary: Due to litho component instances being immutable we are able to process them later if we hold on to the instance. We have added a Maybe deferred type which sort of resembles a Monad. It wraps a value which may or may not be calculated later.

Reviewed By: lblasa

Differential Revision: D41474251

fbshipit-source-id: 2ba6e688518dba55cf4aa5ba53f390a92cf0921f
2022-11-23 03:45:26 -08:00
Lorenzo Blasa
5b3e110821 Remove Enumeration type
Summary:
Enumeration used to be a type containing a single property value of type string.

The InspectableEnum is a type that had an Enumeration value and possible values.

As we removed possible values from the enum value, this structure no longer serves its purpose.

Reviewed By: antonk52

Differential Revision: D41400874

fbshipit-source-id: e5c2d1e15ee9b3074ddd69f75ee9b8150d44379f
2022-11-21 05:30:18 -08:00
Lorenzo Blasa
6268c7b455 Litho margins
Summary:
Litho margins/padding/borders have the following attributes:

- left, top, right, bottom
- horizontal, vertical
- all
- start, end

This change processes these attributes and creates a SpaceBox inspectable which enables the margin visualiser in Flipper Desktop.

Reviewed By: LukeDefeo

Differential Revision: D41375299

fbshipit-source-id: be8bac1819f2b17c2fd1b1b86678aa0559278609
2022-11-18 02:34:33 -08:00
Lorenzo Blasa
0ac8c2a6b3 Migrate enum possible values to metadata
Summary:
Before this change, possible values for an enumeration were embedded within the attribute value itself.

After this change, possible values are located within the attribute metadata.

Reviewed By: LukeDefeo

Differential Revision: D41337003

fbshipit-source-id: cef5654a679e9b961e82993abb201b518fcbcd00
2022-11-17 04:42:22 -08:00
Luke De Feo
0ebedc9c49 Add Id to node descriptor interface
Summary:
There were 2 situations where the UI hadn't changed but we were sending a nodes with a different Id accross traversals which confuses things on the desktop

1. By removing the litho observer we are repeatidly scanning the entire hierachy on scroll or when a video plays. The debug component that represents litho views are not stable, they are generated each time even if the underlying component is the same
2. Offset child is generated by us each time and the old id refered to the generated offset child not the underlying object

This diff addresses these 2 cases by allowing a descriptor to choose the ID.

The nodeId convience method was used in a lot of places. For the places where the id ended up in the protocol we have migrated to the descriptors getID. In some other places it is only used internally or for logging.  In this case I have renamed the method and changed the return type from Id to int so it cant be accidently used in the protocol

Reviewed By: lblasa

Differential Revision: D41307239

fbshipit-source-id: 655b230180a6d02d66888e86b2293eead3385455
2022-11-16 10:38:23 -08:00
Luke De Feo
f6060d0046 Fragment return 0 bounds
Summary: In a previous diff the Bounds was made mandatory and the fragment bounds was set to be the same as the underlying view. this caused the offset to be doubled since the underlying view would also apply that offset. Since fragments dont contribute to layout and are purely for lifecycle we can set it to 0 and handle it on the desktop

Reviewed By: lblasa

Differential Revision: D41304500

fbshipit-source-id: 39591b3ef0c746bd7a4ec8d61fed623cc7c94944
2022-11-16 10:38:23 -08:00
Luke De Feo
53c15b2e59 Remove litho observer
Summary:
There seem to be a number of issues with registering to all changes properly for litho observer.

Removing it and allowing the decor view to do a full traversal fixes a number of problems. The performance with hardware rendering seems to be fine. This should be  stopgap untill we tackle time travel properly

Reviewed By: lblasa

Differential Revision: D41304501

fbshipit-source-id: 5b7cdbd0dac04ba0dbf8dd5e449c99f0db4d0863
2022-11-16 10:38:23 -08:00