Commit Graph

634 Commits

Author SHA1 Message Date
John Knox
a92b6eaf80 Add AndroidSonarClient.getInstanceIfInitialized()
Summary:
Sometimes you want to get the sonar client without necessarily wanting to initialize it, for example if you don't have a context object, but still want to get hold of a particular plugin object.
Adds a getInstance method that returns null if not initialized.

Reviewed By: passy

Differential Revision: D9154423

fbshipit-source-id: 65cb46684bc35d9a953dbd958c7cf72aba0015e2
2018-08-07 06:29:09 -07:00
Sara Valderrama
fc7f949daf Click to inspect works with TalkBack
Summary: Allow click to inspect to work when Talkback is running (normal tree expands as usual although ax tree doesn't expand yet). Override onHover of Touchoverlay and onRequestSendAccessibilityEvent in viewRoot to prevent talkback focus when in Click to Inspect mode. Also update layout inspector to persist isSearchActive to prevent build up of TouchOverlayViews when navigating between plugins (which happened if leaving the layout inspector while in Click to Inspect mode).

Reviewed By: danielbuechele

Differential Revision: D9153446

fbshipit-source-id: f76982e8f8cea1e7b7e4c6b9bf73632d101222ef
2018-08-06 16:54:20 -07:00
Pascal Hartig
f59cafe25e Android v0.6.16
Summary:
Rename artifacts and release on Bintray. Public release
will be delayed by the manual review by JFrog.

Reviewed By: danielbuechele

Differential Revision: D9179646

fbshipit-source-id: 84c11d545940d1d52b9de9f87b4eb26901290108
2018-08-06 14:11:54 -07:00
Phoomraphee Luenam
2c48afdf04 Implement AlignmentMode in layoutplugin
Summary:
Add a Button to toggle alignment lines on Sonar interface.

Call sonar plugin in java, sending isAlignmentMode flag.

Changed API for setHighlighted to include alignment mode flag.

Button design to be added in future diffs by @[100003260904633:maximg]

Reviewed By: danielbuechele

Differential Revision: D9123749

fbshipit-source-id: 01c299f299be30dbb695bfb1d8007d63c27643d5
2018-08-06 07:41:48 -07:00
Pascal Hartig
4e5122d664 Fix RootComponentSpec formatting
Summary: pusheen_big_and_beautiful

Reviewed By: danielbuechele

Differential Revision: D9178922

fbshipit-source-id: 5d8e1b01086e337b9f9d3b714bb1e6c879a43f55
2018-08-06 04:41:29 -07:00
Phoomraphee Luenam
8ea2809742 Add Alignment Functionality for Sonar
Summary:
Part of a hackathon project. (https://fb.facebook.com/groups/230455004101832/permalink/454928784987785/)

We're adding an alignment mode for Sonar that shows the pixel level alignment.

Reviewed By: danielbuechele

Differential Revision: D9121197

fbshipit-source-id: 21af36fd7eeea631d580ccebff8e648fa276bf35
2018-08-06 04:13:00 -07:00
Pascal Hartig
0c536b3188 Set up LeakCanary plugin in sample app
Summary: Per title.

Reviewed By: danielbuechele

Differential Revision: D9178886

fbshipit-source-id: c48411cdd2a28d182644bf2278ee8414812d6034
2018-08-06 03:14:20 -07:00
Pascal Hartig
dedd953c28 Move leakcanary to open source and add build files
Summary:
Made sure it builds with both buck and Gradle.

Follow-up to D8865149.

Reviewed By: danielbuechele

Differential Revision: D9178885

fbshipit-source-id: 46efaa532efdc1d59ce76e04be6680e233084881
2018-08-06 03:14:20 -07:00
Daniel Abramowitz
410e6d14c8 Revert D8932114: [sonar] Add state tracking plumbing
Differential Revision:
D8932114

Original commit changeset: fb03babfe92b

fbshipit-source-id: a6a372a4115d69b5419a8c9924b333e7c163497b
2018-08-03 08:27:42 -07:00
Daniel Abramowitz
fadd392349 Revert D8954095: [sonar] Add SonarDiagnosticActivity to android
Differential Revision:
D8954095

Original commit changeset: b4a638bc0ba2

fbshipit-source-id: 6165b7429477e80520fb0e149da1c2ef893e1d90
2018-08-03 08:27:42 -07:00
John Knox
3237b60ff1 Add SonarDiagnosticActivity to android
Summary:
Open the screen by running adb shell
am start -n com.facebook.wakizashi/com.facebook.sonar.android.diagnostics.SonarDiagnosticActivity

Reviewed By: passy

Differential Revision: D8954095

fbshipit-source-id: b4a638bc0ba2f69a69c121c7c1c00fbe47476ee3
2018-08-03 07:42:17 -07:00
John Knox
fb447e4f84 Add state tracking plumbing
Summary:
The plan is to get SonarState to take update events and aggregate them into an object, that can be displayed in the UI so you can see what sonar is currently trying to do, and what if anything is failing.
This is pretty rubbish right now, as it just uses a single string to represent state, this is just the initial version I'll iterate on.
I also need to pass the SonarState into the SonarWebSocketImpl, since that's where a lot of the heavy lifting is done, but as long as something is logging state updates here, it proves the concept.
SonarStateUpdateListener is the interface that will be implemented by android and iOS implementations. These implementations will notify an activity or screen that the state has changed and they should reflect that.

Reviewed By: passy

Differential Revision: D8932114

fbshipit-source-id: fb03babfe92be53771eb4d8f10de7ecdc7f1a6d8
2018-08-03 07:42:16 -07:00
Sara Valderrama
ff0b045bde Allow for multiple view roots, include accessibility focus changing between view roots
Summary: Ax mode now works with multiple view roots/windows, accessibility focus is also updated when new windows are opened.

Reviewed By: danielbuechele

Differential Revision: D9121844

fbshipit-source-id: 1da9327f5d6a784793db8076c2ad2d84e860ac1c
2018-08-02 09:41:26 -07:00
John Knox
a6d8493330 Grammar fix in android sample app
Summary: Fixing grammar.

Reviewed By: passy

Differential Revision: D9082223

fbshipit-source-id: d3bf4e345f0fd13c5ef5c418c41e4a07620bd86f
2018-08-01 06:12:04 -07:00
John Knox
0729ce6959 Log error when sonar is missing required permissions
Summary:
Sonar won't work without the INTERNET permission, so it can talk TCP to the desktop, on localhost.
Also, for genymotion, we use the IP address, so we need ACCESS_WIFI_STATE.

Reviewed By: passy

Differential Revision: D8855239

fbshipit-source-id: 35d0b0bba91daeba35a5de90e5ef87e89ac6bb51
2018-08-01 04:56:23 -07:00
Pritesh Nandgaonkar
07d75ce848 Rename Sample app from Sonar to Flipper
Summary: Renamed sonar sample app with flipper

Reviewed By: passy

Differential Revision: D9050608

fbshipit-source-id: 4e76e4c6cc8febb997ce32b4f78a2fab9792310d
2018-07-31 14:02:58 -07:00
Sara Valderrama
33e6538477 Highlight the current talkback-focused element in the accessibility tree
Summary: Highlights the element corresponding to the view talkback is focused on in green in the ax tree (and updates live as talkback moves).

Reviewed By: blavalla

Differential Revision: D9021542

fbshipit-source-id: c3bf6f5625aacb0cd054032b33a50541b88b2eaf
2018-07-31 04:14:49 -07:00
Sara Valderrama
ffe53d1345 Small sidebar update
Summary: Added some props to sidebar for ax mode.

Differential Revision: D8983386

fbshipit-source-id: eaf414dc8ae5386744c66f1d43b6b9068b9593c1
2018-07-26 15:48:00 -07:00
Pascal Hartig
8482e80c27 Move javatests/
Summary: That one was a doozy.

Reviewed By: jknoxville

Differential Revision: D8974692

fbshipit-source-id: bbdca0d5c598a2d1ebcc03f1456a7b17be5ffcf2
2018-07-26 02:05:02 -07:00
Sara Valderrama
41f4478a74 Basic mutual highlighting for Litho components
Summary: Shows basic relationship between the AX and nonAX tree litho nodes. When a litho component is selected from the nonAX tree, it's corresponding hostView or lithoView (root of the component tree) is highlighted in the AX tree giving priority to the hostView if it exists. If a hostView is selected in the AX tree, it's corresponding component is selected in the non-AX tree. If a lithoView is selected from the AX tree, it's corresponding lithoView is highlighted in the non-AX tree. This means that each hostView has a one-to-one highlighting between the two trees but lithoViews will have many nodes in the main tree that map to one node in the AX tree (which is accurate to litho components rendering but we may need to change in the future if it is not clear).

Reviewed By: jknoxville

Differential Revision: D8972205

fbshipit-source-id: d136f5b594d0ac1b66a82b35dc7b085186829fc4
2018-07-25 10:19:37 -07:00
Sara Valderrama
c57e6e4396 Expand trees together - including fragments, not including litho components
Summary: When expanding one tree, the other tree also expands. This expanding jumps over fragments (which are not in the accessibility tree) so that the trees can stay in sync even when there are extra wrappers in the main tree. Need to figure out functionality for litho components (these simply don't expand together right now since the relationship between the trees at these nodes are less obvious).

Differential Revision: D8943229

fbshipit-source-id: 289c3511a6495508b45a62da13ae4c50209e6118
2018-07-25 10:19:37 -07:00
Pascal Hartig
16093222c0 Move Litho plugin to xplat//
Summary: Last one of the plugins.

Reviewed By: jknoxville

Differential Revision: D8966725

fbshipit-source-id: 1564042c45815d324f7dc0ef6d9d024307787b49
2018-07-25 06:33:29 -07:00
Thomson Thomas
65239838f2 Fix the crash from okhttp interceptor (#168)
Summary:
Add a null check before creating a new response
Fixes #166
Pull Request resolved: https://github.com/facebook/Sonar/pull/168

Reviewed By: jknoxville

Differential Revision: D8915871

Pulled By: passy

fbshipit-source-id: aa93273f6fe90a8160133331e0844f67ff7e620a
2018-07-24 08:33:14 -07:00
Pascal Hartig
5b38cbdf76 Move OSS plugins
Summary:
This is a big one. Moves all oss plugins to a new place and leaves
stub targets in place. No logic changes. Everything apart from
BUCK files should be unchanged.

Reviewed By: jknoxville

Differential Revision: D8951045

fbshipit-source-id: 8054fb4028181d5cc4a240b1908dab6471cf0a27
2018-07-24 07:22:27 -07:00
Pascal Hartig
fb2b9cfc9f Update android lib build paths
Summary: Move manifest to correct place, update build.gradle accordingly.

Reviewed By: priteshrnandgaonkar

Differential Revision: D8931222

fbshipit-source-id: e2cf4b507de4ea984b5a2dce1bb9edee0c4e2558
2018-07-20 08:20:50 -07:00
Pascal Hartig
c3e8a2d22a Fix cpp build paths
Summary:
Those hadn't been updated as part of the move and cause runtime
failures.

Reviewed By: priteshrnandgaonkar

Differential Revision: D8931211

fbshipit-source-id: bc874eeea39134d6da9e16f6771bf0d3d3c02473
2018-07-20 08:20:50 -07:00
Pascal Hartig
07b083e570 Move sample source and resources to gradle dirs
Summary: Follow standard Gradle paths.

Reviewed By: priteshrnandgaonkar

Differential Revision: D8890133

fbshipit-source-id: 062331b6b3d5f118f07cb5ca14cdec871f75867b
2018-07-19 09:50:04 -07:00
Pascal Hartig
f6b143135c Remove third-party from dependencies
Summary:
:third-party doesn't actually export anything. So we don't need to
explicitly depend on it as it messes with the POM generation otherwise.

Reviewed By: jknoxville

Differential Revision: D8913636

fbshipit-source-id: d0da6ed4c47e8d6b7986ec9f12960c9323ad1640
2018-07-19 08:48:13 -07:00
Austin Vandergon
5b0e742fe6 Call module init helpers on debug builds
Reviewed By: SeyelentEco

Differential Revision: D8879847

fbshipit-source-id: 812ff0098fc8e3c85ab0a33df5e4ade919209583
2018-07-18 17:24:35 -07:00
Sara Valderrama
0244f15dab Use views not components for Litho nodes in AX tree + more sidebar props
Summary: Switches the tree to use the view hierarchy for Litho nodes rather than Litho component hierarchy since Accessibility services interact with the views rendered. Includes a few more properties in the accessibility sidebar and updates to the segmented sidebar based on derived/non-derived properties for all views. Also adds functions to the AccessibilityUtil to be able to work on the accessibility sidebar while still leaving the non-accessibility sidebar unchanged. Eventually the accessibility panel will be removed from 'normal' mode and the original functions will no longer be necessary.

Reviewed By: blavalla

Differential Revision: D8881739

fbshipit-source-id: 9ce37e8f18025538cba2c86c0895ee38d13d024b
2018-07-18 17:03:32 -07:00
Pascal Hartig
818c5e9dc5 Move android package to xplat
Summary: That's the android package and all references to it.

Reviewed By: jknoxville

Differential Revision: D8875423

fbshipit-source-id: 478bb380012bc1327199d51527a7fe376824fce2
2018-07-18 08:04:23 -07:00
Pascal Hartig
ee86ea0338 Move testing to xplat
Summary: More moving.

Reviewed By: jknoxville

Differential Revision: D8859751

fbshipit-source-id: 23dac3808715000d672f843d5eff34e81ccf637a
2018-07-17 07:49:33 -07:00
Pascal Hartig
bd719e6c9e Move sonar core to xplat
Reviewed By: jknoxville

Differential Revision: D8859681

fbshipit-source-id: 6613d6b62d4433aa3dde60b34affd48752c53366
2018-07-17 07:49:33 -07:00
Pascal Hartig
c0d1510d58 Move android build files to xplat
Summary:
This should work with our existing shipit config. Moves the build
files to xplat and sets up a standard gradle directory structure
that we will continue to move more files into.

Reviewed By: jknoxville

Differential Revision: D8859483

fbshipit-source-id: 5df5882a3bcaee36280af68aeaa740290288e0d3
2018-07-17 03:34:54 -07:00
Sara Valderrama
5ceb3e4ffe Include non-drawable litho components in AX tree + small sidebar edit
Summary:
Fixed issue with DebugComponentDescriptors being left out of accessibility tree so the AX tree now includes all Litho view nodes (not Litho accessibility nodes yet). Litho drawables have no accessibility properties so these are not included. Also changed default for getAXChildAt to do whatever the original view tree does for that node and added a getAXChildCount function to better customize the accessibility tree.

Segmented the ax sidebar into properties directly form the view and properties derived from the AccessibilityNodeInfo.

Differential Revision: D8861129

fbshipit-source-id: 987683ef45188aa9cb587cc0e5ffba8fbf40136d
2018-07-16 17:04:15 -07:00
Pascal Hartig
cd6a5f9ff8 Reorganize native dep download and extraction (#154)
Summary:
This moves the native setup to a separate gradle file and unpacks everything outside the build folder. That way we don't throw everything away on every incremental build.

This is an intermediate step to get to a more declarative setup like Fresco has it and get rid of the individual hacks we have for every download.
Pull Request resolved: https://github.com/facebook/Sonar/pull/154

Reviewed By: jknoxville

Differential Revision: D8833812

Pulled By: passy

fbshipit-source-id: 2424c9d6e22e6092c04af344e06939b4a6aba041
2018-07-16 10:26:10 -07:00
Sara Valderrama
1c5ecce667 NodeInfo tree working (besides litho nodes)
Summary: The second tree has access to all AX NodeInfo properties (they are not in the sidebar yet). Infrastructure set up to customize displayed information bassed on what is most useful. Descriptors for views updated to include AX functionality and non-view descriptors AX functions defaulted to null/empty. Non-view nodes (like Fragments, Window, Appication) no longer included in AX tree. Corresponding nodes will be highlighted (although not expanded) on click in either tree.

Differential Revision: D8795800

fbshipit-source-id: cf2333f69bfecca3ff84aae62681c684dfa14bf3
2018-07-12 09:33:21 -07:00
Pascal Hartig
fcd1b1e773 Clean up dependencies (#153)
Summary:
Remove unused dependencies and centralise the remaining ones in the
global project config.
Pull Request resolved: https://github.com/facebook/Sonar/pull/153

Reviewed By: priteshrnandgaonkar

Differential Revision: D8820462

Pulled By: passy

fbshipit-source-id: 1c845898930eb62942379fddec6da39dbdc426d0
2018-07-12 09:05:55 -07:00
Pascal Hartig
c871496f8c Update build deps (#151)
Summary:
Update some build dependencies (gradle, android plugin) and make some
minor cleanups in the gradle files along the way.
Pull Request resolved: https://github.com/facebook/Sonar/pull/151

Reviewed By: priteshrnandgaonkar

Differential Revision: D8818841

Pulled By: passy

fbshipit-source-id: 78b6592dbf967553aadead57a60023a0b5ae79b6
2018-07-12 06:47:41 -07:00
Pascal Hartig
c7de8b8d37 Link against OpenSSL statically (#149)
Summary:
Compile against a static version of OpenSSL for better compatibility
with apps that already use OpenSSL in some fashion.
Pull Request resolved: https://github.com/facebook/Sonar/pull/149

Reviewed By: priteshrnandgaonkar

Differential Revision: D8804169

Pulled By: passy

fbshipit-source-id: 4de66a77806a3b3f01b2cf5f253916f2cf6f48e8
2018-07-11 08:42:02 -07:00
Daniel Büchele
c239fcac01 persist network plugin state
Summary:
This saved the state of the network plugin even when switching between plugins using persistedState.
A bug in the Android implementation didn't clear the events that were already sent to the desktop.

Reviewed By: jknoxville

Differential Revision: D8752098

fbshipit-source-id: 152ec5da83958ad8124686f780d39983cbce563f
2018-07-10 02:33:51 -07:00
John Knox
26d58557ee Android: Use separate thread for network connection
Summary:
We currently give sonar one event base from java / obj-c code to use for scheduling tasks.
This causes a problem, because we schedule reconnect tasks on the event base, and then these tasks interact with rsocket which schedules it's own tasks.
The problem is that we're passing rsocket the same event base. So the reconnect code executes and blocks waiting for rsocket to connect.
But rsocket can never connect because it never executes because that thread is blocked, so we get deadlock.

Fixing it by giving both processes their own event base / thread.

Reviewed By: danielbuechele

Differential Revision: D8748354

fbshipit-source-id: aa00766059f66fadfecb1970492bbb7107bbbfe4
2018-07-09 07:49:08 -07:00
John Knox
cebc409da6 Change SonarInitConfig to take two EventBases
Summary:
We currently give sonar one event base from java / obj-c code to use for scheduling tasks.
This causes a problem, because we schedule reconnect tasks on the event base, and then these tasks interact with rsocket which schedules it's own tasks.
The problem is that we're passing rsocket the same event base. So the reconnect code executes and blocks waiting for rsocket to connect.
But rsocket can never connect because it never executes because that thread is blocked, so we get deadlock.

This is the first step which just changes the interface to pass two event bases.
The consumers will be changed to pass in different threads next.

Reviewed By: danielbuechele

Differential Revision: D8748350

fbshipit-source-id: 481d6f23644f28fd0f1c786252605287019c999c
2018-07-09 07:49:07 -07:00
Conor O'Donnell
d45bc14cce Keep strong reference to OnSharedPreferenceChangeListener (#131)
Summary:
A strong reference to the listener should be kept when calling `registerOnSharedPreferenceChangeListener`, otherwise the listener can get garbage-collected and stop working.

Mentioned in the Android SDK docs [here](https://developer.android.com/reference/android/content/SharedPreferences.html#registerOnSharedPreferenceChangeListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener)):

> Caution: The preference manager does not currently store a strong reference to the listener. You must store a strong reference to the listener, or it will be susceptible to garbage collection. We recommend you keep a reference to the listener in the instance data of an object that will exist as long as you need the listener.
Closes https://github.com/facebook/Sonar/pull/131

Differential Revision: D8751484

Pulled By: xiphirx

fbshipit-source-id: e46715d637c89491770c266fc22c27db41beb042
2018-07-06 13:03:44 -07:00
Edoardo Tognoni
53753801b0 Open source the Sandbox plugin
Summary: This diff is mainly moving diffs around to open source the Sandbox plugin. I created the MD file writing some docs. The rest is just making our own FB implementation work

Reviewed By: danielbuechele

Differential Revision: D8731839

fbshipit-source-id: 27ac67223c6de9d1be406ab8c06b71b82d5407bc
2018-07-05 09:19:37 -07:00
Pascal Hartig
020a771125 Clean up Folly CMakeLists (#127)
Summary:
Remove left over from local testing.
Closes https://github.com/facebook/Sonar/pull/127

Reviewed By: danielbuechele

Differential Revision: D8723789

Pulled By: passy

fbshipit-source-id: f08203a441c35860dd5257a0ec147d1bf9c3da60
2018-07-04 11:33:36 -07:00
Pascal Hartig
3dcf7722bb Add support for x86_64 builds (#128)
Summary:
Add the required compiler flag for Folly when building x86_64.

I'll prepare a new release for this shortly.

Depends on #126
Closes https://github.com/facebook/Sonar/pull/128

Reviewed By: danielbuechele

Differential Revision: D8731955

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 9511811b0b51205989a5200ad9d0d8689ca684cb
2018-07-04 10:17:52 -07:00
Hilal Alsibai
e6fa377d75 Add extension support to InspectorSonarPlugin
Summary:
This mirrors the extension support added to the desktop plugin and allows people to dynamically
add extension commands

Reviewed By: danielbuechele

Differential Revision: D8691167

fbshipit-source-id: 60136b960f8bbdfa42b2077d1f5f7b391fc44443
2018-07-03 16:33:42 -07:00
Pascal Hartig
69711642c9 Build against vanilla OpenSSL 1.1.0h (#125)
Summary:
This uses OpenSSL 1.1.0h to build and link against. The `.so`s are
precompiled and hand-patched from [this
repository](https://github.com/passy/android-database-sqlcipher). The
patching was necessary to fix the `SONAME` and corresponding `NEEDED`
flags to *not* contain a `.1.1` version suffix as Gradle will refuse to
bundle those.

We basically only use the headers for the remaining part.

The precompiled version contains ABI support for `arm64-v8a`, `armeabi`,
`armeabi-v7a`, `x86` and most importantly `x86_64`. HOWEVER, `x86_64` is
still excluded for now because folly fails to compile due to a missing
compiler flag:

```
error: needs target feature pclmul
```

This should be easily fixable by ensuring that `-mpclmul` is added to
the CFLAGS if we're compiling for an `x86_64` target in the
`CMakeLists.txt` for Folly.

Closes #113.
Closes https://github.com/facebook/Sonar/pull/125

Reviewed By: priteshrnandgaonkar

Differential Revision: D8723636

Pulled By: passy

fbshipit-source-id: 41c61047d2793ebaef5793a3c937c4d628471d6a
2018-07-03 13:18:53 -07:00
Hilal Alsibai
c6eb0d6b1a Integrate shared preferences plugin in sample Android app
Summary: Adds the shared preferences plugin to the sample Android app

Reviewed By: sjkirby

Differential Revision: D8661572

fbshipit-source-id: 490a19938b9dd1c87f9200027d3395d719013d21
2018-07-02 11:05:14 -07:00