Page MenuHomePhabricator

[native] Introduce a JNI network module helper
ClosedPublic

Authored by tomek on Feb 8 2022, 6:50 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Sep 25, 8:59 AM
Unknown Object (File)
Tue, Sep 17, 2:32 PM
Unknown Object (File)
Tue, Sep 17, 2:32 PM
Unknown Object (File)
Tue, Sep 17, 2:32 PM
Unknown Object (File)
Tue, Sep 17, 2:32 PM
Unknown Object (File)
Tue, Sep 17, 2:32 PM
Unknown Object (File)
Tue, Sep 17, 2:32 PM
Unknown Object (File)
Tue, Sep 17, 2:28 PM

Details

Summary

This diff makes it possible to expose C++ static methods to java. A first example of such a method will be added in the next diff.

Test Plan

Compile the app - it should not crash.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

native/android/app/src/cpp/jsiInstaller.cpp
64–69 ↗(On Diff #9394)

When I tried to have a separate method JNI_OnLoad in GlobalNetworkSingletonJNIHelper it was not possible to locate the exposed method (unsatisfied link), so it looks like we need to have only one JNI_OnLoad per library. I could verify that, but I don't think that having a single point where all the natives are registered is a bad thing - it reduces the chances of conflicts, or make finding conflicts easier.

tomek requested review of this revision.Feb 8 2022, 7:04 AM
tomek planned changes to this revision.Feb 8 2022, 9:29 AM
karol added inline comments.
native/android/app/src/cpp/GlobalNetworkSingletonJNIHelper.cpp
5–6

nit

This revision is now accepted and ready to land.Feb 9 2022, 5:05 AM
This revision now requires review to proceed.Feb 9 2022, 5:05 AM
ashoat added a reviewer: jim.
ashoat added a subscriber: jim.

I really don't know much about what's going on here... @karol-bisztyga and @palys-swm are the only ones on the team who have really explored Android JNI generally or fbjni specifically. Adding @jimpo since I know he's done some Android stuff, but not sure if he has context. Will accept, deferring to @karol-bisztyga and @palys-swm.

This revision is now accepted and ready to land.Feb 9 2022, 9:38 PM