Skip to content

Commit

Permalink
Android 10 Support
Browse files Browse the repository at this point in the history
* Added hooking abstraction for multiple framework support
* Converted ADBI to a hooking framework for Android < Pie
* Added xHook hooking framework for Android >= Pie
* Added support for mangled symbol names since Android now uses C++ in
NFC-NCI
* Removed Android headers in favor of version specific offsets
* Removed hooks only used for debugging
* Switched SetConfig from requiring original call to global flags for
unguarded access
* Bumped SDK version

Co-authored-by: Alexandros Roussos <thealexroussos@gmail.com>
  • Loading branch information
kleest and roussosalex committed Jun 15, 2020
1 parent 0f03e65 commit e84644f
Show file tree
Hide file tree
Showing 32 changed files with 405 additions and 6,414 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "protocol"]
path = protobuf/src/main/proto/protocol
url = ../protocol.git
[submodule "nfcd/xHook"]
path = nfcd/xHook
url = https://github.com/iqiyi/xHook.git
21 changes: 17 additions & 4 deletions nfcd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
cmake_minimum_required(VERSION 3.4.1)
cmake_minimum_required(VERSION 3.6)

# xHook target
file(GLOB XH_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/xHook/libxhook/jni/*.c)
set(XH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/xHook/libxhook/jni/)
add_library(xh STATIC ${XH_SOURCES})
target_include_directories(xh PUBLIC ${XH_INCLUDE_DIR})

# find files
file(GLOB_RECURSE NFCD_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h)
file(GLOB_RECURSE NFCD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)

# cxx standard
set(CMAKE_CXX_STANDARD 11)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/main/jni/include/)

# compile library
add_library(nfcgate SHARED ${NFCD_HEADERS} ${NFCD_SOURCES})

# platform specific flags
if (CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-execute-only -fuse-ld=lld -execute-only -ffixed-x18")
endif()

# link library
target_link_libraries(nfcgate android log)
target_link_libraries(nfcgate android log xh)
# include directory
target_include_directories(nfcgate PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/main/jni/include/)

4 changes: 2 additions & 2 deletions nfcd/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 27
compileSdkVersion 29

defaultConfig {
minSdkVersion 19
targetSdkVersion 27
targetSdkVersion 29
versionCode 1
versionName "1.0"
ndk {
Expand Down
1 change: 1 addition & 0 deletions nfcd/src/main/jni/include/nfcd/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
#define LOG_ASSERT(x, ...) if (!(x)) { LOGE(__VA_ARGS__); }
// assert x, print to error log, return on error
#define LOG_ASSERT_X(x, ...) if (!(x)) { LOGE(__VA_ARGS__); return; }
#define LOG_ASSERT_XR(x, r, ...) if (!(x)) { LOGE(__VA_ARGS__); return r; }

#endif // NFCD_ERROR_H
536 changes: 0 additions & 536 deletions nfcd/src/main/jni/include/nfcd/external/bt_types.h

This file was deleted.

267 changes: 0 additions & 267 deletions nfcd/src/main/jni/include/nfcd/external/ce_api.h

This file was deleted.

Loading

0 comments on commit e84644f

Please sign in to comment.