Add support for Android 11 RefBase ABI (#29)
Implements a compatibility layer to allow the binary to run on Android 11 (API 30) and older, which lack the `incStrongRequireStrong` symbol in their `libutils.so`. This is achieved by creating a runtime wrapper that checks the device's SDK version. - On Android 12 (API 31) and newer, it dynamically loads and calls the `incStrongRequireStrong` function using `dlsym`. - On older versions, it safely falls back to the universally available `incStrong` method. This resolves the fatal `dlopen` error "cannot locate symbol" when injecting the library into processes on older Android versions. See AOSP change https://android-review.googlesource.com/c/platform/system/core/+/1660499
This commit is contained in:
@@ -12,7 +12,7 @@ add_subdirectory(external/LSPlt/lsplt/src/main/jni)
|
||||
|
||||
add_compile_definitions(BINDER_DISABLE_NATIVE_HANDLE)
|
||||
add_library(utils SHARED stub/stub_utils.cpp)
|
||||
target_include_directories(utils PUBLIC external/AOSP/include)
|
||||
target_include_directories(utils PUBLIC external/AOSP/include compat)
|
||||
|
||||
add_library(binder SHARED stub/stub_binder.cpp)
|
||||
target_include_directories(binder PUBLIC external/AOSP/include)
|
||||
@@ -22,7 +22,7 @@ add_executable(libinject.so inject/main.cpp inject/utils.cpp)
|
||||
target_include_directories(libinject.so PUBLIC include)
|
||||
target_link_libraries(libinject.so PRIVATE lsplt_static)
|
||||
|
||||
add_library(${CMAKE_PROJECT_NAME} SHARED binder_interceptor.cpp)
|
||||
add_library(${CMAKE_PROJECT_NAME} SHARED binder_interceptor.cpp compat/refbase_compat.cpp)
|
||||
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC external/linux-kernel/include include)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE binder lsplt_static utils)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user