Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

AndroidFDYB/vibratorsample

Repository files navigation

一、相关资料准备

  1. android.so 路径列表

libbinder.so 路径如下:frameworks/native/libs/binder

  1. lib_ndk 参考路径:frameworks/native/libs/binder/ndk/Android.bp
cc_library {
 name: "libbinder_ndk",
 vendor_available: true,
 export_include_dirs: [
 "include_ndk",
 "include_apex",
 ],
 cflags: [
 "-Wall",
 "-Wextra",
 "-Werror",
 ],
 srcs: [
 "ibinder.cpp",
 "ibinder_jni.cpp",
 "parcel.cpp",
 "process.cpp",
 "status.cpp",
 "service_manager.cpp",
 ],
 shared_libs: [
 "libandroid_runtime_lazy",
 "libbase",
 "libbinder",
 "libutils",
 ],
 header_libs: [
 "jni_headers",
 ],
 export_header_lib_headers: [
 "jni_headers",
 ],
 version_script: "libbinder_ndk.map.txt",
 stubs: {
 symbol_file: "libbinder_ndk.map.txt",
 versions: ["29"],
 },
}

从这里可以看出libbinder_ndk.so --依赖于---> libbinder.so 。

  1. lib_ndk 对应的samples中的 makefile: iface.h
cc_library_static {
 name: "test_libbinder_ndk_library",
 defaults: ["test_libbinder_ndk_defaults"],
 export_include_dirs: ["include"],
 shared_libs: ["libbinder_ndk"],
 export_shared_lib_headers: ["libbinder_ndk"],
 srcs: ["iface.cpp"],
}
  1. 参考 iface.cpp

  2. 然后想办法传递parcel对象

相关链接信息

1.Android Binder 底层实现原理 2.Android Developer 官网 3.HAL: 将HIDL 接口改造为Stable AIDL 4.vnd binder和binder共存问题 5.Android native进程间通信实例-binder篇 6.binder的两种C语言实现方式

方式二 通过binder去获取 值IPC State

  1. libhwbinder系统binder库 real实现
  2. libbinder

方式三 通过binder service_manager去获取

/frameworks/native/cmds/servicemanager/bctest.c servicemanager

相关头文件

../../rk3568_android12_SDK/frameworks/native/include/binder/IServiceManager.h ../../rk3568_android12_SDK/frameworks/native/libs/binder/include/binder/IServiceManager.h ../../rk3568_android12_SDK/frameworks/native/include/binder/IInterface.h ../../rk3568_android12_SDK/frameworks/native/libs/binder/include/binder/IInterface.h ../../rk3568_android12_SDK/system/core/libutils/include/utils/VectorImpl.h ../../rk3568_android12_SDK/system/logging/liblog/include/log/log_id.h ../../rk3568_android12_SDK/system/logging/liblog/include/log/log.h /system/core/libsystem/include/system/graphics.h

out/target/product/rk3568_s/system/lib/libbinder.so out/target/product/rk3568_s/system/lib/libutils.so out/target/product/rk3568_s/system/lib/libcutils.so out/target/product/rk3568_s/system/lib/liblog.so

scp beancurd@121.37.117.214:/home/beancurd/rk3568_android_sdk/rk3568_android12_SDK/out/target/product/rk3568_s/system/lib/liblog.so -P 65068 .

../../rk3568_android12_SDK/prebuilts/clang/host/linux-x86/clang-r416183b1/bin/clang++ -o vibrator_main.o -I include/ vibrator_main.cpp -std=c++17 -lc++_shared

输入结果: Sharknade Binder info: 0xb400007809678490

震动驱动对应AIDL生成目录 /out/soong/.intermediates/hardware/interfaces/vibrator/aidl/android.hardware.vibrator-V2-cpp-source/gen/include/android/hardware/vibrator/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

AltStyle によって変換されたページ (->オリジナル) /