Possible to interact with "normal" Android app services from Rust libbinder? From NDK in general?

Skip to first unread message

Peter LeVasseur

Feb 23, 2024, 4:38:45 PMFeb 23
to Android Building
Hi there,

I saw some commits were merged here which allow us to use UnstructuredParcelable​ in Rust. I got some sample code working on an Android Emulator using them, it's super cool! 🙂 (See attached gif)

I did run into what I think is a bit of a problem though. I am trying to, using the Rust binder interface, interact with a privileged Android app. As you can see the service is exposed using an intent. I've tried feeding in variants of combinations of intent or package name + service name and so on to get_interface​, but I don't seem to be able to "reach" the privileged Android app's service.

From what I can tell reading the binder NDK source, it appears that the binder NDK API allows interaction only between system services, not with typical Android apps written in Java / Kotlin. I'd certainly love to be proven wrong though 🙂

Wondered if you knew if this was possible or could suggest a possible way to work through the issue. I had considered doing something next like Rust --- JNI ---> Android App --- JNI ---> Rust to retrieve an IBinder and convert to AIBinder pointer like in this example with which to then call new_spibinder()​. Was hoping there's a more straightforward way though.

Thanks for your time!

Background down below (if you're interested):

I work at General Motors on an open-source project with the Eclipse Foundation called uProtocol. Long story short: in the automotive space there's a need to have a consistent protocol spoken by applications on the many computers we have in the vehicle from low power devices which control mechatronics to high compute Linux devices used for infotainment to bridging to cloud applications. At GM we're trying to develop this in the open for the community.

I'm working on the "router" functionality (called uStreamer [code is very alpha]) of uProtocol which routes between different underlying transports of uProtocol (e.g. Zenoh, MQTT, SOME/IP, Android Binder). My goal is to ideally be able to write the uStreamer library once, in Rust, and then be able to configure and run it for different configurations across the very different devices we have in-vehicle. For the other transports we're looking at, I think the pluggable uStreamer approach seems viable, so I'm trying to make it viable for Android Binder as well.
Reply all
Reply to author
0 new messages