3

I am interested in using the AServiceManager_get/addService() APIs that are made available via the NDK implementation of binder, libbinder_ndk.

The sources for this can be found here for 10.0.0r30 - API29, and in your AOSP tree at:

$SDK/frameworks/native/libs/binder/ndk/

However, the libbinder_ndk.so bundled with the latest r21c NDK does not have all of these APIs exported. Many are, but the get/add services endpoints are not available. The libbinder_ndk.so for API29 can be found at:

$NDK/platforms/android-29/$PLAT/usr/lib/libbinder_ndk.so

As well as the sysroot directories of each respective toolchain, but only for API29

$NDK/toolchains/llvm/prebuilt/$HOST/sysroot/usr/lib/$PLAT/29/libbinder_ndk.so

But the symbols are of course available if you build the AOSP tree for this same release:

$ readelf --wide -s libbinder_ndk.so  | grep AService
   180: 000000000000e148   256 FUNC    GLOBAL DEFAULT   15 AServiceManager_addService@@LIBBINDER_NDK
   181: 000000000000e248   244 FUNC    GLOBAL DEFAULT   15 AServiceManager_checkService@@LIBBINDER_NDK
   224: 000000000000e33c   244 FUNC    GLOBAL DEFAULT   15 AServiceManager_getService@@LIBBINDER_NDK

In fact, a search of the documentation returns no results for these APIs, but the source has been available since 2018-08-20 according to the blame records.

Am I missing something?

sherrellbc
  • 4,650
  • 9
  • 48
  • 77
  • Answer to your question below, but what are you actually trying to do? – Dan Albert Jun 09 '20 at 08:38
  • @DanAlbert Nothing explicitly required from the `libbinder_ndk`. I just intend to connect to a service and `transact` with it. You can do this from C++, but `libbinder_ndk` provided a C-based API (that just wrapped the C++ interfaces) that seemed nice for the job. – sherrellbc Jun 09 '20 at 12:41

1 Answers1

2

The reason they are not exported is because they are not a part of the app API surface. They exist for vendor and APEX modules. Those domains do not have the same API permanence guarantees that apps do (read: they might disappear in any given release).

Dan Albert
  • 10,079
  • 2
  • 36
  • 79