Commit Graph

27 Commits

Author SHA1 Message Date
Zac Sweers
48d6ea4c30 Remove stetho (#762)
Summary:
## Summary

Resolves https://github.com/facebook/flipper/issues/607

This removes stetho dependencies directly in favor of just copying in the used classes. This removes the last non-androidx dependency from the project, and is useful as stetho appears to be unmaintained. The fresco stetho dependency appeared to be completely unused.

## Changelog

Remove stetho dependencies. It was unused other than a few utility methods, but came at the cost of preventing Flipper consumers from completely removing dependencies that hadn't updated to Androidx yet.
Pull Request resolved: https://github.com/facebook/flipper/pull/762

Test Plan: Existing tests still pass with no regressions. Functionally this should be no difference.

Reviewed By: jknoxville

Differential Revision: D19577969

Pulled By: passy

fbshipit-source-id: b277ddf97a9d2c846dd0b9227c02bb46c1ecd930
2020-01-28 05:24:30 -08:00
Alexander Oprisnik
ad720b1f63 Fix CloseableReference leaks in Flipper plugin
Summary:
When debugging closeable reference leaks, I found that the Flipper plugin doesn't properly close one:

```
2020-01-17 10:45:29.346 27038-27053/com.facebook.wakizashi D/YOLO: LEAK!!:
    java.lang.Throwable
        at com.facebook.common.references.CloseableReference.<init>(CloseableReference.java:158)
        at com.facebook.common.references.DefaultCloseableReference.<init>(DefaultCloseableReference.java:29)
        at com.facebook.common.references.CloseableReference.of(CloseableReference.java:237)
        at com.facebook.common.references.CloseableReference.of(CloseableReference.java:203)
        at com.facebook.common.references.CloseableReference.of(CloseableReference.java:176)
        at com.facebook.imagepipeline.cache.CountingMemoryCache.newClientReference(CountingMemoryCache.java:221)
        at com.facebook.imagepipeline.cache.CountingMemoryCache.get(CountingMemoryCache.java:209)
        at com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin$4.onReceive(FrescoFlipperPlugin.java:204)
        at com.facebook.flipper.android.EventBase.loopForever(Native Method)
        at com.facebook.flipper.android.FlipperThread.run(FlipperThread.java:31)
```

Second leak:
```
2020-01-17 11:04:16.503 28855-28869/com.facebook.wakizashi D/YOLO: LEAK!!:
    java.lang.Throwable
        at com.facebook.common.references.CloseableReference.<init>(CloseableReference.java:147)
        at com.facebook.common.references.DefaultCloseableReference.<init>(DefaultCloseableReference.java:21)
        at com.facebook.common.references.DefaultCloseableReference.clone(DefaultCloseableReference.java:35)
        at com.facebook.common.references.CloseableReference.cloneOrNull(CloseableReference.java:258)
        at com.facebook.common.references.CloseableReference.cloneOrNull(CloseableReference.java:326)
        at com.facebook.imagepipeline.cache.CountingMemoryCacheInspector$DumpInfoEntry.<init>(CountingMemoryCacheInspector.java:32)
        at com.facebook.imagepipeline.cache.CountingMemoryCacheInspector.dumpCacheContent(CountingMemoryCacheInspector.java:101)
        at com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin$3.onReceive(FrescoFlipperPlugin.java:171)
        at com.facebook.flipper.android.EventBase.loopForever(Native Method)
        at com.facebook.flipper.android.FlipperThread.run(FlipperThread.java:31)
```

Reviewed By: passy

Differential Revision: D19445902

fbshipit-source-id: 12a513d9e34fcac0d546a4eac55932956e4e4d5b
2020-01-17 12:32:01 -08:00
Eric O'Connell
b24c2e0b52 Limit request/response body to 100kb to address #457 (#617)
Summary:
As previously reported in https://github.com/facebook/flipper/issues/457, I immediately started to see crashes with Flipper integrated due to large responses (e.g., >= 100MB). This will only write the first 100KB of the response or request body into `RequestInfo` objects.

## Changelog

- Limits request/response body in network request info to 100KB max.
Pull Request resolved: https://github.com/facebook/flipper/pull/617

Test Plan:
- Make a network request which has a response size of < 100kb, verify that it is visible in its entirety
- Make a network request w/ response size > 100kb, verify that it is truncated
- Ideally, use your application with the Network plugin running, and do not see OOMs

Reviewed By: mweststrate

Differential Revision: D19412075

Pulled By: passy

fbshipit-source-id: c93662dba7a5f24820287e56e889576b5bcb5a72
2020-01-17 03:55:51 -08:00
Rong Tang
83641ff05c Show Encoded Cache in Flipper Image plugins.
Summary: load encoded cache and pass to flipper to show.

Reviewed By: oprisnik, passy

Differential Revision: D18643671

fbshipit-source-id: 2df34e0f67ccc585834f02760a1e28079bcf4a6f
2019-11-28 04:30:02 -08:00
Mihaela Ogrezeanu
4d324075e9 Show caller stack trace
Summary: On Android, the stack trace looks different so we don't need to use the Regex we use on iOS. We can simply display all the lines in the trace.

Reviewed By: pasqualeanatriello

Differential Revision: D17181400

fbshipit-source-id: e471da17b89806a161edc7edcf05ac6faed44bf0
2019-11-19 10:28:18 -08:00
Sara Valderrama
353cfeafc8 update accessibility hierarchy to treat lithoViews and LithoRecyclerViews as ViewGroups
Summary: This will correctly show all view children instead of reverting to the non-ax default behavior. Fixes bug where recycler views showed no children.

Reviewed By: jknoxville

Differential Revision: D18574220

fbshipit-source-id: f22606fb582e0bfd1a171dc4497e1d1613e800d1
2019-11-19 10:04:10 -08:00
Pascal Hartig
182b4e1b1f Set stricter limit for body payloads
Summary:
Base64 encoding can easily cause OOMs for large payloads.

In the long-term, it would be great to have a way of streaming these
responses so we don't allocate 50MB chunks of memory at once.

Reviewed By: jknoxville

Differential Revision: D17951353

fbshipit-source-id: a5d7b8242892518590ac95c1d9751f24d20dc40e
2019-10-16 09:29:52 -07:00
Andres Suarez
0675dd924d Tidy up Flipper license headers [1/2]
Reviewed By: passy

Differential Revision: D17863711

fbshipit-source-id: 259dc77826fb803ff1b88c88529d7f679d3b74d8
2019-10-11 13:46:45 -07:00
Chaiwat Ekkaewnumchai
053cfc09f3 Make LeakCanary a Separate Plugin
Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/559

Reviewed By: passy

Differential Revision: D17546936

fbshipit-source-id: dce128a771b73e8b18dfc2b78ee99502c3f1ce86
2019-09-25 03:05:56 -07:00
Pascal Hartig
b041da6d61 Move litho plugin tests
Summary:
I missed these. :(

Open source CI is unhappy about this - for good reasons.

Reviewed By: jknoxville

Differential Revision: D17500071

fbshipit-source-id: 96106f660dee59985c51e2635321ab4ad00a795a
2019-09-20 10:24:38 -07:00
Pascal Hartig
1ab47f9ca8 Set up Maven distribution for new plugins
Summary:
Setting up the necessary metadata to publish the separate plugins
to Maven/Bintray.

Reviewed By: danielbuechele

Differential Revision: D17480263

fbshipit-source-id: 1772cee5b3744ce52fc6e2510a27cb7f500e72bf
2019-09-20 06:07:42 -07:00
Pascal Hartig
2baadf9867 Make litho/sections a separate plugin
Summary:
Breaking Litho/Sections off. Doesn't really make sense to have
two deps for this especially since they're pretty tightly coupled.

This makes our core already quite slim.

Reviewed By: jknoxville

Differential Revision: D17420118

fbshipit-source-id: 9a03911f4af6410745b9aefd0e6a75bdf106660f
2019-09-19 03:02:51 -07:00
Pascal Hartig
c4a9b603e2 Make network a separate plugin
Summary: Per title.

Reviewed By: jknoxville

Differential Revision: D17419678

fbshipit-source-id: aee00f077b7ed955c60884853dc1128d27366ee8
2019-09-19 03:02:51 -07:00
Pascal Hartig
7ac82bec4e Make fresco a stand-alone gradle project (#548)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/548

First project to pull out of the "fat distribution" we currently have.
Still needs setup for Maven and registration in Bintray.

Reviewed By: jknoxville

Differential Revision: D17395660

fbshipit-source-id: 6244495a2e25d705dd930ef87c7e5e1f038eb921
2019-09-19 03:02:51 -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
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
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
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
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
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
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
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
Hilal Alsibai
ceb16db812 Make the shared preferences plugin more flexible
Summary:
You don't necessarily need / have your shared preferences defined in a file that is your package
name. This adds the ability to pass in the name + mode you need to read the correct shared
preferences file.

Reviewed By: sjkirby

Differential Revision: D8661573

fbshipit-source-id: 49e57b0371228eca7fc4f06e8ba65ff8cc059b11
2018-07-02 11:05:14 -07:00
Pascal Hartig
16a3e2fa27 Rename isInternalComponent to canResolve
Summary:
I'm sure there's a better way to describe what this does in the Javadoc, but I
can't really come up with one.

Also inlined one method which made another call which is now redundant.

I'd also really like to make this call entirely unnecessary by moving the logic
to `resolve()` so that overriding it automatically implies `canResolve` but the
edge cases for commonProps and treeProps make this rather unpleasant.

Reviewed By: IanChilds

Differential Revision: D8476911

fbshipit-source-id: 33c6a20da03e50cd1c1d4994e64ef8b43b2c68bc
2018-06-18 07:32:26 -07:00
Daniel Büchele
fbbf8cf16b Initial commit 🎉
fbshipit-source-id: b6fc29740c6875d2e78953b8a7123890a67930f2
Co-authored-by: Sebastian McKenzie <sebmck@fb.com>
Co-authored-by: John Knox <jknox@fb.com>
Co-authored-by: Emil Sjölander <emilsj@fb.com>
Co-authored-by: Pritesh Nandgaonkar <prit91@fb.com>
2018-06-01 11:03:58 +01:00