Commit Graph

559 Commits

Author SHA1 Message Date
Luke De Feo
7deb374c1c Add initial decor view traversal
Summary: Catch the case when we mis the initial draw

Reviewed By: lblasa

Differential Revision: D39658946

fbshipit-source-id: 00a46226128e28a8753df2161d1edcd6ffa47d67
2022-09-21 07:02:48 -07:00
Luke De Feo
46824f3369 Fix flipper connect / disconnect cycle
Summary: Previously we were cancelling the entire context which meant after reconnect nothing was sent. Additionally we now close / reinitiaze the channel so that any old events are not sent on reconnect

Reviewed By: lblasa

Differential Revision: D39658945

fbshipit-source-id: bb02724434aa820d811b49ab799a4643ab7e785a
2022-09-21 07:02:48 -07:00
Lorenzo Blasa
aa801b6715 Fix bug introduced with variable rename
Summary:
^

`mutableClass` should be used instead of `clazz`

Reviewed By: LukeDefeo

Differential Revision: D39652102

fbshipit-source-id: 8ba86d39796beed79ff7cf8b37f3460facc38430
2022-09-20 06:35:48 -07:00
Lorenzo Blasa
1cc71af832 Fix typo for initialiser
Summary: ^

Reviewed By: antonk52

Differential Revision: D39575995

fbshipit-source-id: 2e95d43c37e2341e9e6f723282d829d06f1b1c5d
2022-09-20 05:15:50 -07:00
Lorenzo Blasa
d85e8a0949 TreeObserverFactory, change file name to match type
Summary: ^

Reviewed By: LukeDefeo

Differential Revision: D39575384

fbshipit-source-id: 30ca896d93c4f3641f748123af024354c10de8b8
2022-09-20 05:15:50 -07:00
Lorenzo Blasa
7f103ee293 TreeObserver tidy up
Summary:
Remove usage of '!!', it is generally discourages even though instances are guaranteed to exist.

Adjust comments

Reviewed By: LukeDefeo

Differential Revision: D39575368

fbshipit-source-id: a159a0411a913de3d1ae6236c41ea15255687433
2022-09-20 05:15:50 -07:00
Lorenzo Blasa
83f8a0675c Adjust spaces
Summary: ^

Reviewed By: LukeDefeo

Differential Revision: D39575336

fbshipit-source-id: b9c2cf75d674a3ee86dc26f918fc0d9130bc8dc0
2022-09-20 05:15:50 -07:00
Lorenzo Blasa
1744335ddd View as weak reference
Summary: Keep a weak reference of the view instead of a strong reference.

Reviewed By: LukeDefeo

Differential Revision: D39575312

fbshipit-source-id: ae8df7d089b29ea3b1cf960a6ae020ed5a9c3648
2022-09-20 05:15:50 -07:00
Lorenzo Blasa
2051359490 Unsubscribe from updates and tidy up
Summary: Remove listener on unsubscribe and tidy up comments.

Reviewed By: LukeDefeo

Differential Revision: D39575287

fbshipit-source-id: 2b4ac0bc07cfe86f5ad0e602bbba4b596230cd52
2022-09-20 05:15:50 -07:00
Lorenzo Blasa
ddc5554673 Suppress warnings for RootViewResolver
Summary:
^

There's no way to address these warnings, so suppress.

Reviewed By: LukeDefeo

Differential Revision: D39575262

fbshipit-source-id: 6703476d7637c63aa9a81b26f8cdbd0f53e3991c
2022-09-20 05:15:50 -07:00
Lorenzo Blasa
bba1275377 Traversal tidy up
Summary: This change tidies up the traversal and removes unused LayoutVisitor

Reviewed By: LukeDefeo

Differential Revision: D39575241

fbshipit-source-id: 2ab101f74ae7b2c16ddf7016abc78a03590916b0
2022-09-20 05:15:50 -07:00
Lorenzo Blasa
1fac19facc Address a few warnings and suggestions for Android sample app
Summary: ^

Reviewed By: LukeDefeo

Differential Revision: D39575170

fbshipit-source-id: 8be293fe31521531e634132e4ca454da32aad73f
2022-09-20 05:15:50 -07:00
Lorenzo Blasa
84dc95b27b Rename stetho package to util
Summary:
^

These are the last two types imported from stetho which, if anything, can be integrated as is without having to track back to Stetho

Reviewed By: LukeDefeo

Differential Revision: D39573639

fbshipit-source-id: 8009532116ec7b2fed2751fa966269ad81a7cb00
2022-09-20 05:15:50 -07:00
Lorenzo Blasa
d8e47efb81 Remove warnings
Summary: ^

Reviewed By: LukeDefeo

Differential Revision: D39573417

fbshipit-source-id: 241ecdddaf43020923046b0b5c35656bc8ffad34
2022-09-20 05:15:50 -07:00
Lorenzo Blasa
3a4286b2ba Remove stetho unused types
Summary: ^

Reviewed By: LukeDefeo

Differential Revision: D39572018

fbshipit-source-id: 437b245b7eee06392cda97eb56b4f4d0a5df23fc
2022-09-20 05:15:50 -07:00
Lorenzo Blasa
86364cbd40 Addresses fragments tracking and different bugs/warnings
Summary:
^

After this change lands, it is safe to remove most of the Stetho fragment support types.

Reviewed By: LukeDefeo

Differential Revision: D39460121

fbshipit-source-id: 0e7d4ce71e828ee7bc9c6e945b8fe27dbd6f08f8
2022-09-20 05:15:50 -07:00
Luke De Feo
2090120cda Descriptor clean up
Summary:
1. The base class descriptor was removed, this was given that we have chained descriptor there is no need for this anymore
2. The Base interface node descriptor no longer has a mutable list based api. You simply return a list. The mutable list based api was specifically to allow chaining and this quirk is isoltated to the chained descriptor
3. AbstractChainedDescriptor and ChainedDescriptor were merged

Reviewed By: lblasa

Differential Revision: D39496073

fbshipit-source-id: fb3ec629ec3b27f587bdbd0b323624a4bc4ebea3
2022-09-14 05:07:51 -07:00
Luke De Feo
f5a5e1b19d Split Tree Observer into multiple files
Summary: Tree observer had multiple components, now their usage is clearer they are moved to separate files

Reviewed By: lblasa

Differential Revision: D39469078

fbshipit-source-id: 4d4c03aff229fd2cc0eace216144b37694637691
2022-09-13 11:05:42 -07:00
Luke De Feo
868ae9e36a Added dialogs to sample app
Summary: This is to allow us to test dialogs from the UI debugger

Reviewed By: lblasa

Differential Revision: D39468653

fbshipit-source-id: 59c759a794c42b85bc288d60e1b2c6a71e32bb3d
2022-09-13 11:05:42 -07:00
Luke De Feo
721b9cd4da Fix logging
Summary: typing uidebugger into ADB will hit both the log tag and any thing else such as package name. Turned Enum warning down to verbose reduce load on main thread

Reviewed By: lblasa

Differential Revision: D39466932

fbshipit-source-id: 0106a042a92755cf644c0e66683e7e5993e924e1
2022-09-13 11:05:42 -07:00
Luke De Feo
f06f63306e Restore root view tracking
Summary: We use the root view resolver to detect when roots have been added. We currently have some race conditions where the activity stack managed by application ref doesnt include the first activity

Reviewed By: lblasa

Differential Revision: D39466929

fbshipit-source-id: fff4f830dea337d96dd9a9956a20a080fff2e965
2022-09-13 11:05:42 -07:00
Luke De Feo
4341cbdf3d Factor out common traversal code in observers
Summary: Each observer was doing a similar job of traversing, and setting up child observers and its easy to not clean up child observers in some cases. This provides a helper utility for the common use case

Reviewed By: lblasa

Differential Revision: D39466930

fbshipit-source-id: e74ae5c3709297b73c020cd148a0485ac9fc0f8f
2022-09-13 11:05:42 -07:00
Luke De Feo
a0ee774159 Fix active child
Summary: The active child was only being passed for the native scan full traversal, Now we have it for the partial traversal also

Reviewed By: lblasa

Differential Revision: D39466933

fbshipit-source-id: a0e281e4f9a21bf2edd12f18ecdb68a29ead3476
2022-09-13 11:05:42 -07:00
Luke De Feo
0562178739 Basic Litho support
Summary: Added an initial litho Tree observer and descriptors, its quiet naive and will be improved in a future diff

Reviewed By: lblasa

Differential Revision: D39466931

fbshipit-source-id: 66a462882af2e585b9719ee2f61595449f99c5e5
2022-09-13 11:05:42 -07:00
Luke De Feo
24ec43eb92 Add observer type to Perf event
Summary: While looking at the event stream it is useful to know which observer type fired it

Reviewed By: lblasa

Differential Revision: D39430756

fbshipit-source-id: bc52f085a5497692f8076b12a9c015cc33a19d1e
2022-09-13 11:05:42 -07:00
Lorenzo Blasa
d999f68f62 Remove warnings
Summary: Addresses a few warnings raised

Reviewed By: LukeDefeo

Differential Revision: D39430004

fbshipit-source-id: 877698e8515f08a5cb38b414689615c1b6e4b6cc
2022-09-12 08:17:39 -07:00
Lorenzo Blasa
ed40e16ac9 Addresses a few issues with the Stetho fragment utilities
Summary:
There is a bug in the code to get fragments from the activity.

A boolean, result from the comparison, was added to the list instead of the actual fragments.

Reviewed By: LukeDefeo

Differential Revision: D39348019

fbshipit-source-id: 669f304055f15f59b40352d86f25d768d92df76e
2022-09-12 04:20:01 -07:00
Luke De Feo
4436128d07 Descriptor clean up
Summary:
Now that we have the tree observer we can make descriptors completely about describing an object. To that end we have removed init method and made them all object to indicate to future readers their singleton nature.

onGetActive child was made open instead of abstract to avoid needed to override in all subclasses

Reviewed By: lblasa

Differential Revision: D39387935

fbshipit-source-id: 802b8afdd9aa639daecf10d774ca5b960ee48003
2022-09-12 03:48:43 -07:00
Luke De Feo
9a270cdc7a Tree observer
Summary:
Added concept of a tree observer which is responsible for listening to the changes for a portion of the UI tree. This structure nests so Tree observers can hold child tree observers which emit events on a different cadence. This structure should allow us to incorporate different UI frameworks down the road as well as native android views.

We push the tree updates from the tree observers onto a channel and setup a coroutine to consume this channel, serialize and send down the wire.

Reviewed By: lblasa

Differential Revision: D39276681

fbshipit-source-id: a4bc23b3578a8a10b57dd11fe88b273e1ce09ad8
2022-09-12 03:48:43 -07:00
Luke De Feo
c76c993ce4 Introduced concept of active child
Summary: A node can have an active child, if present we assume all others are inactive and we don't traverse them. This means the activities not on top and view pager views not active will not be scanned. Additionally on the desktop we are automatically collapsing these views. The net result is a lot less work done on the main thread

Reviewed By: lblasa

Differential Revision: D39310126

fbshipit-source-id: ebd0c69d46f2d42fe42e678c8327fcdc73d08385
2022-09-12 03:48:43 -07:00
Lorenzo Blasa
6fcaaabb17 Remove unused observer
Summary:
^

This was replaced by `ApplicationRef`

Reviewed By: antonk52

Differential Revision: D39313539

fbshipit-source-id: ad9b5c3ed963046ba0349fd5112bb9cb5de7640b
2022-09-08 04:26:41 -07:00
Luke De Feo
2fc1ff9f9c Added increment activity
Summary: Added simple activity to test how flipper reacts to changes in native UI

Reviewed By: passy

Differential Revision: D38704012

fbshipit-source-id: 8a593577322922c6f6f0f96dd5cb0761c3035389
2022-09-07 04:37:17 -07:00
Luke De Feo
0426966b14 Additional test activities
Summary: Some activities for testing the UI debugger

Reviewed By: lblasa

Differential Revision: D39208140

fbshipit-source-id: a6fcc1f082df5dc61f72019f92a6307d0e90176e
2022-09-07 04:37:17 -07:00
Luke De Feo
41068d1c90 Native UI scan
Summary: Added scheduler to scan the Native UI every 500 ms to test, Also added instrumentation in a separate event with the timings of each stage visualised in a Data table on desktop which can be accessed with ctrl+I. Currently this instrumentation event is sent every time but it could be a config option controlled from the desktop in the future

Reviewed By: lblasa

Differential Revision: D39205313

fbshipit-source-id: ca034171db6b062396b4ef28028aaa663c4d852a
2022-09-07 04:37:17 -07:00
Luke De Feo
a5da6923eb Flatten layout during traversal
Summary: Move from a nested structure to a flatten one for data exchange, this will allow us to only send sections of the UI in the future

Reviewed By: lblasa

Differential Revision: D38982138

fbshipit-source-id: d578a07a6d2d7e117fbd741bd6e33062223ce10d
2022-09-07 04:37:17 -07:00
Luke De Feo
f123e65e8f Added strongly typed tree for sidebar inspector
Summary:
Introduced a JSON like tree structure for the sidebar insepector. Descriptors can provide their data as well as  if its mutable or not.

Enum mapping was simplified

Reviewed By: lblasa

Differential Revision: D38947238

fbshipit-source-id: cd8a6a8a752c5f626582ab8ac5efae6e9ff6a2ad
2022-09-07 04:37:17 -07:00
Luke De Feo
c854d0a2bb Added kotlin serialization
Summary: ^

Reviewed By: lblasa

Differential Revision: D38976576

fbshipit-source-id: 32022c263a0c81e6e99478375592ef1be9fea1cf
2022-09-05 05:36:23 -07:00
Yizhe Chen
09e81b19ad fix strict mode exemption to allow disk write as well
Summary: Filpper is doing disk IO on UI thread which actually produce `DiskWriteViolation` (presumably when the directory is not there, it will write to create)

Differential Revision: D39196484

fbshipit-source-id: f6b15785ea6ecf3ea5b41211908c14eac3d1309e
2022-09-01 17:39:49 -07:00
Lorenzo Blasa
947d00c6c3 Fix send raw messages
Summary:
^

The last change removed the overload of `send` in favour of `sendRaw`

Reviewed By: LukeDefeo

Differential Revision: D38946386

fbshipit-source-id: c4491c4afe4d719602c99878dc7185d436179aef
2022-08-24 11:17:21 -07:00
Lorenzo Blasa
1b2f875cc6 Scheduler
Summary:
Add a simple scheduler which operates in the following way.

There are two type of tasks: main, background.

The main task will run on the main thread whilst the background task will run on a background thread.

The main task will be executing at a fixed internal whereas the background task will get queued on demand but can effectively consume what was produced by the main task at its own rate.

Reviewed By: LukeDefeo

Differential Revision: D38975283

fbshipit-source-id: 0633385d2938705a16f5fc75a28cad067e4a8e55
2022-08-24 09:03:39 -07:00
Lorenzo Blasa
5aff69d1c9 traversal
Summary: This adds a simple traversal to the UI. As it stands, it will most likely be updated in future iterations.

Reviewed By: LukeDefeo

Differential Revision: D38907292

fbshipit-source-id: 98cea1f971a4ef37ba2d1c75b882dd44df29bb3a
2022-08-23 05:45:29 -07:00
Luke De Feo
f1e80b18b1 Basic desktop plugin
Summary:
Scaffolded desktop UI for UI debugger
I changed getroot from an rpc call to an event sent on connect. The root should never change as its the application object.

Reviewed By: lblasa

Differential Revision: D38866008

fbshipit-source-id: ca0f1908bedb643238f11ed796922e3359619167
2022-08-22 03:02:53 -07:00
Lorenzo Blasa
6adf1d666f Descriptors
Summary:
Introducing descriptors. Taken from the existing inspector, refreshed with a few things from Stetho, and translated to Kotlin.

Note: doesn't use FlipperObject or FlipperArray.

This is a very rough draft for them all, but can be used as basis for experimentation.

Reviewed By: LukeDefeo

Differential Revision: D38860763

fbshipit-source-id: 9f6bf4ad0e61fc40b0a773dfb8bfa80b1f397b3a
2022-08-19 08:47:58 -07:00
Lorenzo Blasa
b5bdd56d2c Application to instantiate Plugin
Summary:
Plugin needs both the Context and Application. Application is Context. Pass Application.

:)

Reviewed By: LukeDefeo

Differential Revision: D38831033

fbshipit-source-id: ff12a8ddc875fb54389e591a1c1c9febedb3aa37
2022-08-19 08:47:58 -07:00
Adam Ernst
0aa1f14536 Remove @scarf-generated from xplat/sonar
Summary: See D38829381.

Reviewed By: d16r

Differential Revision: D38837720

fbshipit-source-id: c576e16ebb5a0afd5e6dfc71adb3cf0c2361e9a3
2022-08-19 05:54:13 -07:00
Lorenzo Blasa
dc28e2ad45 ApplicationRef
Summary:
Introduce ApplicationRef which holds a reference to Application. It exposes a few utility methods to get view roots and activities.

ApplicationInspector has a few template methods for useful things which are not used in this diff and most likely will either be moved/deleted/changed on the final implementation.

Reviewed By: LukeDefeo

Differential Revision: D38829523

fbshipit-source-id: b8aeb133dceb3af42b5f7d6851ef531d35fc7d69
2022-08-19 05:08:49 -07:00
Lorenzo Blasa
769a1844b7 Common types
Summary:
EnumMapping and InspectableValue taken from the original 'inspector' plugin but translated to Kotlin.

Accumulator is just a Map<String, Any>

Reviewed By: LukeDefeo

Differential Revision: D38823678

fbshipit-source-id: 6af395cab2e3e6930575eb63d22d660dab962fde
2022-08-19 03:39:06 -07:00
Lorenzo Blasa
d1c06c9c46 Do not overload send as this causes issues with folly::dynamic
Summary:
folly::dynamic, std::string, implicit constructors and method overloading is not a good combination.

This renames the send method to sendRaw as to avoid issues with existing plugins currently sending string params.

Reviewed By: mweststrate

Differential Revision: D38827539

fbshipit-source-id: 653f62e41ebfbe93d1af25f39c81f6b05bf84cb4
2022-08-18 09:39:42 -07:00
Lorenzo Blasa
543ea489db Stetho-bits
Summary:
^
From: https://github.com/facebook/stetho

The copies used by the original plugin were located at: https://www.internalfb.com/code/fbsource/[a8a0c1be09a9]/xplat/sonar/android/src/main/java/com/facebook/flipper/plugins/inspector/descriptors/utils/stethocopies/

In addition, copies were translated to Kotlin, and adjusted accordingly.

Reviewed By: LukeDefeo

Differential Revision: D38783216

fbshipit-source-id: 2375bd94d333a2edb6156602b47dee32c83472ff
2022-08-18 05:16:38 -07:00
Lorenzo Blasa
ece57689e5 Move to public plugins location
Summary:
^

So far, we had the 'uidebugger' plugin as a meta-only plugin.

This change moves the plugin to OSS space as it will ultimately be its right place.

It will also make it easier to iterate on it.

The plugin itself is not ready for consumption but at no point we are documenting or integrating it with our samples.

Reviewed By: passy

Differential Revision: D38742336

fbshipit-source-id: 5cf124722fa7ba75ee9b998c507bfdfb2e4782c1
2022-08-18 05:16:38 -07:00