Commit Graph

205 Commits

Author SHA1 Message Date
Mihaela Ogrezeanu
3d03f44f1b Map highlight overlay drawable to view
Summary:
For the Sections plugin I need to be able to highlight multiple views at the same time (without highlighting their parent view). This enables us to do that. Let me know if you have any concerns
Depends on D13803412

Reviewed By: astreet

Differential Revision: D13900729

fbshipit-source-id: cdea9c21ceb11563793410b2bb8f7f2c3a44cefb
2019-02-04 06:11:58 -08:00
Brett Lavalla
fc1d32a3f9 Add accessibility role and role description to flipper
Summary:
This adds the concept of a custom role description to Flipper's accessibility inspector.  This functionality was added in support library version 24.1, and supported in Litho as of D8066609.

This will show both the AccessibilityNodeInfo's raw roleDescription under the AccessibilityNodeInfo section, as well as the derived role description under the main Accessibility section (see highlighted elements in screenshot below).

The difference between the raw role description and the derived role description is that the derived description will show any default description a role is given, such as "Button" for button roles.  This makes it clear that the role-description property will override those default strings.

Unfortunately making these mutable requires the AccessibilityRoleUtil class be restructured a bit to support EnumMapping for its roles, which isn't very straightforward due to these default descriptions being stored in the AccessibilityRole enum, so that will have to wait for a future diff.

Screenshot:

{F149099209}

Reviewed By: danielbuechele

Differential Revision: D13759563

fbshipit-source-id: 6eeb22a35f529663725630936af9967ea1f19c0c
2019-01-28 14:04:19 -08:00
John Knox
18b27f24ad Fix oss build
Summary:
A new test uses a non-public dependency causing the travis CI to fail.
Use the standard roboelectric one instead.

Reviewed By: passy

Differential Revision: D13801098

fbshipit-source-id: 9fcda26fceaed22d18bd743f10bf39eaae0da7a6
2019-01-24 05:19:47 -08:00
John Knox
324a7ae873 Enable flipper android to use different ports based on prop
Summary:
Part 1 of enabling flipper to run on custom ports: android SDK.
Still to go: iOS SDK and desktop

This should allow you to run mobile apps that use flipper on different ports than the default (8089,8088).

`adb shell`
`su`
`setprop flipper.ports 1111,2222`

From what I can tell, this only works on rooted devices.

Reviewed By: passy

Differential Revision: D13753238

fbshipit-source-id: c5f370c9d8c7382e8c17fb81d4010c642ef7c114
2019-01-24 03:12:13 -08:00
Pascal Hartig
0daa5de428 Set parameters to non-null by default
Summary:
This helps Kotlin nullity inference and *should* already be enforced
by Infer/Eradicate. More details here: https://medium.com/square-corner-blog/non-null-is-the-default-58ffc0bb9111

Reviewed By: jknoxville

Differential Revision: D13732788

fbshipit-source-id: c0c60f0f8e9dc8bffe3780c7a1a700d682a6d2b8
2019-01-21 06:06:22 -08:00
Pritesh Nandgaonkar
c6efea991d Remove CrashReporter handlers
Summary: This diff removes the custom global exception handler which was being used to send crash notifications. Removing it in the favour of next diff, where we detect crash by looking at Logcat

Reviewed By: passy

Differential Revision: D13590049

fbshipit-source-id: 2914d51b2c5f33c1cade4926dbbf72c041047c71
2019-01-09 10:42:55 -08:00
Daniel Abramowitz
bb7c8a152a Generic layout inspector section
Summary: `PropWithNamedFlipperObject` is an interface that can be implemented by a Litho component prop to display a new section in the Flipper layout inspector.

Reviewed By: danielbuechele

Differential Revision: D13419918

fbshipit-source-id: be2ade160d6381944b1b68a7645b5b23f1d142a1
2018-12-19 09:43:31 -08:00
Pritesh Nandgaonkar
e3fb1e1d84 Disable crash reporter plugin for iOS and update callstack from array to string
Summary:
This diff does the following

- Comments out the code in iOS which sends the message to the desktop side
- Also comments out the part where signal handler is initialised, as we no longer need it. I will remove the iOS implementation completely in next few diffs
- Updated the JS side to expect call stack as a string instead of an array
- Updated the android side to send callstack as a string

I have commented out the code for crash reporter plugin of iOS as for iOS I will be adding a watchman  to a directory where crash logs are dumped. The diff related to this is in the stack

Reviewed By: passy

Differential Revision: D13424824

fbshipit-source-id: b1105da912292bf73cff948206c031de9b059abd
2018-12-18 13:42:40 -08:00
John Knox
e23da69db9 Use localhost instead of hardcoded IP address
Summary:
We can only do this when adb reverse is available, i.e. on Android 5+.
This also relies on a recent change to flipper desktop, to always run adb reverse on emulators.

Reviewed By: danielbuechele

Differential Revision: D10302579

fbshipit-source-id: cff07f0311d413fdd49424a42c641dfb3d225f7c
2018-12-18 07:31:43 -08:00
Pascal Hartig
7eb1546f25 Move version specifier
Summary: Android Studio keeps loudly complaining about this.

Reviewed By: priteshrnandgaonkar

Differential Revision: D13376394

fbshipit-source-id: 6163977bb013dff214aa684662e4879a19a7a786
2018-12-07 06:50:47 -08:00
Pascal Hartig
3b18303560 Revert D13302768: [flipper] Upgrade to cmake 3.10.2
Differential Revision:
D13302768

Original commit changeset: c38601659bde

fbshipit-source-id: d624e51a489cd2d85288f85e13e09638e2ebb4be
2018-12-06 04:45:54 -08:00
Pascal Hartig
03b5306459 Upgrade to cmake 3.10.2
Summary: This was recommended by my Android Studio 3.3 when starting up, so let's do this.

Reviewed By: jknoxville

Differential Revision: D13302768

fbshipit-source-id: c38601659bde4515d62b31efbd907b44304aafba
2018-12-05 15:47:22 -08:00
Pascal Hartig
214f112c14 Add getPluginByClass interface
Summary:
This deprecates the `getPlugin(String)` method and introduces
a `getPluginByClass(Class<T>)` instead which avoids having
to `instanceof`-check and then cast the result, which provides
a nicer experience for Java users.

Reviewed By: jknoxville

Differential Revision: D13277568

fbshipit-source-id: fb7b5b8c0180470ef0ad322559b5b7424520848b
2018-12-05 08:03:41 -08:00
Pritesh Nandgaonkar
9cfa1b3074 Send notifications on litho's error boundary
Summary: Sends notifications to crash reportr plugin whenever the error boundary happens

Reviewed By: danielbuechele

Differential Revision: D13307473

fbshipit-source-id: dc0c6d2ebac32881fdb1aa5f63def824a115cf9e
2018-12-04 05:51:59 -08:00
Daniel Büchele
d331ec2f10 adding Android ReactPlugin
Summary:
Adding a a react-devtools plugin for Android.
This doesn't do much, but announces the plugin to be available.
To make this work on remote device, the hostname and port sent to the device needs to be set in the dev tools. This is isn't done yet, so this will only work for simulators.

Reviewed By: jknoxville

Differential Revision: D12897151

fbshipit-source-id: b874549925c395ff6356f6745b9706b182d544dd
2018-12-04 03:37:47 -08:00
Pritesh Nandgaonkar
d37fa7ba95 Change crash reporter plugin to send callstack array
Summary: Change crash reporter plugin to send callstackas an array instead of string

Reviewed By: jknoxville

Differential Revision: D13254853

fbshipit-source-id: 0baefb3eb6d3afc38d0c6acc7840ddc981230f9d
2018-11-29 09:15:40 -08:00
Pritesh Nandgaonkar
37c973d0c9 Crash reporting plugin android (#328)
Summary:
This PR adds the barebone of a crash reporting plugin in android. Since there is no easy way to stack the PR's in git, creating a new PR, but this depends on the [iOS PR](https://github.com/facebook/flipper/pull/322)
Pull Request resolved: https://github.com/facebook/flipper/pull/328

Reviewed By: jknoxville, passy

Differential Revision: D13137447

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 3b86cebbb1ea01601405dd7ba58e1caa2b506065
2018-11-26 03:43:26 -08:00
Pritesh Nandgaonkar
ddbb3c7f89 Make android sdk crashless
Summary: This diff wraps all the important places where the java code is called in a try-catch block in order to avoid flipper bringing down an app.

Reviewed By: jknoxville

Differential Revision: D12839504

fbshipit-source-id: 4711bccbe6d50094d76ed7ecd1eb652cefc2a090
2018-11-19 04:29:34 -08:00
Pascal Hartig
093ab1fe57 Add report bug callback for diagnostics screen
Summary:
Adds an optional interface that, when implemented, adds
a "Report Bug" button to the top of the screen.

This is a weird Android-ism that's sadly still the
recommended way of providing hooks into Fragments:
https://developer.android.com/guide/components/fragments#EventCallbacks

In order to keep things vanilla here, let's follow that pattern.

Reviewed By: jknoxville

Differential Revision: D13045578

fbshipit-source-id: 1506fcfc630c2d1183d7d1eaf470d23954e0c097
2018-11-15 12:23:12 -08:00
Pascal Hartig
85206e4d9b Turn FlipperDiagnosticsActivity into a Fragment
Summary:
This allows passing in some options in an easy way, like a callback
that contains all debug information for a bug report.

Reviewed By: jknoxville

Differential Revision: D13045282

fbshipit-source-id: 5698228ee9aef31d406313047b6836dc928448cf
2018-11-15 12:23:12 -08:00
Pritesh Nandgaonkar
e02420ac78 Make android project compile with new gradle and build tools
Summary:
If this is not done. I get
```
Could not find aapt2-proto.jar (com.android.tools.build:aapt2-proto:0.3.1).
Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/build/aapt2-proto/0.3.1/aapt2-proto-0.3.1.jar
```
I follwed the suggestion given on [stack overflow](https://stackoverflow.com/questions/52944598/could-not-find-aapt2-proto-jar)

Reviewed By: jknoxville

Differential Revision: D12839581

fbshipit-source-id: aa02620c7e4c52899b2c2c4805fd8a6f168d946a
2018-11-15 06:37:55 -08:00
Brett Lavalla
4954d018d0 Add litho accessibility rendering to Flipper accessibility mode
Summary: This is a re-do of D9720987.  Now that the Litho version has been bumped to 20 in D12838684, this diff can land safely.

Reviewed By: danielbuechele

Differential Revision: D12969979

fbshipit-source-id: b12d14e3b292d8cd110967f84f770f3725a800de
2018-11-10 00:05:44 -08:00
Brett Lavalla
de016b8493 Added ability to change 'enabled' view property
Summary: In the accessibility inspector plugin, the "Enabled" view property was marked at mutable, but would not actually change the clicked.  This is because no case for changing this property was implemented.  This fixes the issue and allows the property to be mutable.

Reviewed By: jknoxville

Differential Revision: D12944810

fbshipit-source-id: 846547ba1baa481eca3fe1cd949cf252904677bc
2018-11-08 17:56:20 -08:00
Ian Childs
7b569a1692 Remove getBaseContext
Summary:
We have getAndroidContext() instead.

This will probably take a few iterations to land, but getting it out there so that I can try :)

Reviewed By: muraziz

Differential Revision: D12921523

fbshipit-source-id: 038ecf8c411fdbde6831051b219a43716007ac49
2018-11-07 04:20:13 -08:00
Pascal Hartig
a7fd546f0e Add basic integration test
Summary:
Just a quick startup test that can save you the time of manually
opening the app.

I don't have any plans of hooking this up in Circle, but it's
still kinda useful to have.

Reviewed By: jknoxville

Differential Revision: D12901590

fbshipit-source-id: a16a1814574d9f27770dcf98c6b238517c589930
2018-11-02 07:09:51 -07:00
Eric Cochran
c6aed22a25 Fix OkHttp Interceptor closing response on IOException. (#313)
Summary:
The returned response body should not be closed, so that users can read the response body.

Before, when [this call](db833d36e9/android/src/main/java/com/facebook/flipper/plugins/network/FlipperOkhttpInterceptor.java (L94)) threw an exception, the body would be closed, and then [this](db833d36e9/android/src/main/java/com/facebook/flipper/plugins/network/FlipperOkhttpInterceptor.java (L54)) would return a closed response.
Pull Request resolved: https://github.com/facebook/flipper/pull/313

Reviewed By: jknoxville

Differential Revision: D12881111

Pulled By: passy

fbshipit-source-id: e76a732af6bdb527be6b90bbb02b3a5f45a1ec10
2018-11-01 09:35:07 -07:00
Zac Sweers
62b913d844 Remove guava dependency (#309)
Summary:
It's only used in `JavascriptSessionTest`, and seems fine to keep it in tests

Resolves #172
Pull Request resolved: https://github.com/facebook/flipper/pull/309

Reviewed By: passy

Differential Revision: D12840362

Pulled By: jknoxville

fbshipit-source-id: 4ead5a4bf0c08d792abcadef713f907930a3e4e7
2018-10-31 07:50:45 -07:00
Ian Childs
f3833a6e5a More prep for ComponentContext not extending Context
Summary: Per title

Reviewed By: astreet

Differential Revision: D12839032

fbshipit-source-id: c69805fd68a6530d1e56edad3bb5edf4089ee98a
2018-10-31 07:29:32 -07:00
Pritesh Nandgaonkar
2ee2dfacfe Back out "[DO NOT LAND until Litho open source version includes rerenderForAccessibility] add litho accessibility rendering to Flipper accessibility mode [2/2]"
Summary: Original commit changeset: 000a7413fcbe

Reviewed By: passy

Differential Revision: D12821473

fbshipit-source-id: 5fa369cc48f074414b04e4786d5bd634158598a6
2018-10-29 06:20:47 -07:00
Brett Lavalla
21c0b3ad0e add litho accessibility rendering to Flipper accessibility mode [2/2]
Summary: Completes D9667222 to allow force rendering of accessibility in litho when an accessibility service is not actually running.

Reviewed By: ikenwoo

Differential Revision: D9720987

fbshipit-source-id: 000a7413fcbe775a525ca3aca64443c3669cdf9e
2018-10-27 23:35:50 -07:00
Hilal Alsibai
c6244054e0 Fix view accessibility path key
Summary: Was set to view previously and blocked the ability to edit view attributes.

Reviewed By: sjkirby

Differential Revision: D10865495

fbshipit-source-id: 8db043bdc8725b2b56f037d7d8467233db524f5e
2018-10-26 01:15:33 -07:00
Pascal Hartig
f75a90bf78 Remove overloaded ErrorReportingRunnable class
Summary:
This masks this fact that `mConnection` must be `non-null` for
very little convenience in return. Let's keep this explicit.

Reviewed By: danielbuechele

Differential Revision: D10505205

fbshipit-source-id: d8187cc8e79d4508babe281ff88b3ba75c0baa1f
2018-10-23 04:44:52 -07:00
Pascal Hartig
2a179b9d3c @Nullable for example plugin
Summary: Per title.

Reviewed By: jknoxville

Differential Revision: D10464336

fbshipit-source-id: 84b572d9fddf62b8515183aff6bb64925772c719
2018-10-22 09:02:19 -07:00
Pascal Hartig
cb186d2af3 Fix sample app style issues
Summary:
Start adding Nullable and finals in some places to
make our sample app (and hopefully rest of the codebase) follow
some of the standards we have in place elsewhere.

Reviewed By: jknoxville

Differential Revision: D10463816

fbshipit-source-id: 7df6758919331ba8a334c94214b9e02bbab8cd2d
2018-10-20 05:11:14 -07:00
John Knox
6cc7f60cde Add sample js and android plugin
Summary:
The start of an example plugin.

My intention is for this to be a place that we keep up to date with the current best practice for doing things.

For example, with the introduction on persistedStateReducer, there are two ways to receive incoming messages, but only one of them works in the background. This should act as a guideline.

For this reason, don't hold back on reviewing it. I want it to be 👌

Reviewed By: priteshrnandgaonkar

Differential Revision: D10448592

fbshipit-source-id: d5fa978c14e47a7fa3c9a29d0929d5a6109267af
2018-10-19 09:44:05 -07:00
John Knox
c544199289 Fix flipper crashing app bug
Summary: Fixing bug based on stack trace from crash: P59988055

Reviewed By: passy

Differential Revision: D10161779

fbshipit-source-id: 8ad4a7b41144817dfcddb5431326e98fd176adec
2018-10-16 06:46:20 -07:00
Pritesh Nandgaonkar
14e38c087f Add runInBackground Interface method
Summary:
Add support for plugins to opt in to background for android.
This diff does the following
- Adds a method `runInBackground` in java interface of `FlipperPlugin`
- Make the network plugin opt in to run in background

Reviewed By: danielbuechele

Differential Revision: D10360033

fbshipit-source-id: b31c7550d00b760b7033c150232e3925b6272d24
2018-10-15 05:47:25 -07:00
Pascal Hartig
e58961e184 Use compileOnly dependency (#294)
Summary:
Fixes #293.
Pull Request resolved: https://github.com/facebook/flipper/pull/294

Reviewed By: danielbuechele

Differential Revision: D10367678

Pulled By: passy

fbshipit-source-id: 69ccdc470b20d5d43e1bb3c1eb4e52c2e01debb5
2018-10-15 03:11:37 -07:00
John Knox
b95a487748 Back out "[flipper] Fix remote adb connections"
Summary:
Original commit changeset: e53aa6ad10ac

This original change relies on adb reverse being run on emulators, which isn't happening. I didn't pick it up during tests because a previous build of flipper had done it.

Reverting the change. Will fix adb reverse and then re apply it later.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10241728

fbshipit-source-id: 521c18c5a0eb45f3af0fe510defd9116b9bb0626
2018-10-08 14:56:18 -07:00
John Knox
287542c49a Fix remote adb connections
Summary: On emulators and devices that support adb reverse, using localhost will always work, whereas "10.0.2.2" won't work for networked adb connections.

Reviewed By: passy

Differential Revision: D10231163

fbshipit-source-id: e53aa6ad10ac4964431694c48e7148add69487fb
2018-10-08 04:56:35 -07:00
Hilal Alsibai
52e43e6ab8 Run google-java-format over Android code
Summary: Prettier code

Reviewed By: sjkirby

Differential Revision: D10182489

fbshipit-source-id: 6a1ba4d586f49edad00f839ccd1b94857ccfccaa
2018-10-06 11:41:35 -07:00
Hilal Alsibai
34c55262ce Reformat sample android app with google-java-format
Summary: Prettier code

Reviewed By: sjkirby

Differential Revision: D10181909

fbshipit-source-id: 05e4c2417dc04e65a95b69beb3694f240c9d954a
2018-10-06 11:41:35 -07:00
Hilal Alsibai
c7e0a26876 Update sample android app to use multiple shared preference files
Summary: Demonstrates the ability to have multiple shared preference files appear in Flipper

Reviewed By: sjkirby

Differential Revision: D10181910

fbshipit-source-id: 02acc02c722315da74dfb69542ca3ab1f26fa2e5
2018-10-06 11:41:35 -07:00
Hilal Alsibai
b40810080c Add support for multiple shared preference files
Summary: Adds the ability to view multiple shared preference files in Flipper

Reviewed By: danielbuechele

Differential Revision: D10181908

fbshipit-source-id: 723b71d7bd87c51c0fabc77204b5a26a2b7aa782
2018-10-06 11:41:34 -07:00
Pascal Hartig
84384e523f Rename remaining tests
Summary: Something here must have conflicted upon landing. Redoing this again.

Reviewed By: danielbuechele

Differential Revision: D10145804

fbshipit-source-id: 1176167c7e3880055ff5e7b3d7f5723416f6131f
2018-10-03 03:44:20 -07:00
Pascal Hartig
8456a13ee6 Fix unit test setup
Summary:
There were still some tests with the internal test runner which
would fail in open source and with Gradle.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10145759

fbshipit-source-id: 99915548441e426b88b1fa6ace1e852775e2a770
2018-10-02 09:29:37 -07:00
Pascal Hartig
344e6e7a04 Rename test classes
Summary: Take care of the test class names.

Reviewed By: danielbuechele

Differential Revision: D10113028

fbshipit-source-id: c8f0967fe2ae8c0f416e0f2f1eab30785fad01e8
2018-10-02 05:11:56 -07:00
Pascal Hartig
8c4e5ec647 Rename diagnostics AndroidManifest.xml
Summary:
The manifest is invalid without a package name and causes CI
to fail in some weird ways.

Reviewed By: jknoxville

Differential Revision: D10123737

fbshipit-source-id: d4adc84e6c1a4297fc1b30720f131fd06c22c4d3
2018-10-01 14:04:08 -07:00
Pascal Hartig
e39b08cdbf Move test sonar package to flipper
Summary: This confused Android Studio real bad.

Reviewed By: danielbuechele

Differential Revision: D10103210

fbshipit-source-id: 20b28575942998fa0c646090e46a2f55983a26a6
2018-09-30 04:13:54 -07:00
Pascal Hartig
b756b5490f Set up unit test support in Gradle
Summary:
This works now:

```
./gradlew :android:testDebugUnitTest
BUILD SUCCESSFUL in 1s
39 actionable tasks: 39 up-to-date
```

Reviewed By: danielbuechele

Differential Revision: D10101985

fbshipit-source-id: e3d1f17b29652061498d50a9218a94aaebee67e2
2018-09-30 04:13:53 -07:00