最新的Android NDK(r21c)的libbinder_ndk缺少几个导出的API [英] Latest Android NDK (r21c)'s libbinder_ndk is missing several exported APIs

查看:283
本文介绍了最新的Android NDK(r21c)的libbinder_ndk缺少几个导出的API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用

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/

但是,与最新的r21c NDK 捆绑在一起的libbinder_ndk.so不会 导出了所有这些API.有许多端点,但没有get/add服务端点.可以在以下位置找到API29的libbinder_ndk.so:

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

以及每个相应工具链的sysroot目录,但仅适用于API29

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

但是,如果您为同一版本构建AOSP树,则这些符号当然可用:

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

实际上,搜索文档不会返回任何结果API,但来源

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.

我错过了什么吗?

推荐答案

不导出它们的原因是因为它们不是应用程序API表面的一部分.它们存在于供应商和APEX模块中.这些域没有应用程序具有相同的API持久性保证(请阅读:它们可能会在任何给定版本中消失).

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).

这篇关于最新的Android NDK(r21c)的libbinder_ndk缺少几个导出的API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆