From 743d1cf3dd14dce8941b26259a98386afc6d907a Mon Sep 17 00:00:00 2001 From: Jeff Kim Date: Sun, 17 Mar 2024 15:02:07 +0900 Subject: [PATCH] Add Android descriptions --- src/android-build.md | 17 +++++++++++++++++ src/android.md | 23 +++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/android-build.md create mode 100644 src/android.md diff --git a/src/android-build.md b/src/android-build.md new file mode 100644 index 0000000..5df2b1b --- /dev/null +++ b/src/android-build.md @@ -0,0 +1,17 @@ +# Android Build +## NDK Install +The NDK can be installed using Android Studio, or it can be downloaded and installed from the following URL. + +* [NDK guides](https://developer.android.com/ndk/guides) +* [NDK downloads](https://developer.android.com/ndk/downloads) + +## Cargo NDK Install +To build rsbinder using the NDK, the installation of [cargo-ndk](https://crates.io/crates/cargo-ndk) is required. + +## Build **rsbinder** with NDK +After installing cargo-ndk, various targets were installed with ```$ rustup target add```. Use this target information to build with the following command. + +``` +$ cargo ndk -t x86_64-linux-android build +``` + diff --git a/src/android.md b/src/android.md new file mode 100644 index 0000000..36df775 --- /dev/null +++ b/src/android.md @@ -0,0 +1,23 @@ +**rsbinder** supports not only Linux but also Android. Since Android already has an environment prepared for binder communication, **rsbinder**, **rsbinder-aidl**, and **rsbinder-hub** are utilized for development. There is no need to create a binder device or run a service manager, so **rsbinder-tools** are not used. + +For building in the Android environment, it is necessary to install the NDK, and an additional Rust build environment that utilizes the NDK is required. + +[Android Build](./android-build.md) + +## Compatibility with Android Versions +안드로이드 버전에 따른 Binder IPC에 대한 호환성 문제가 있다. +현재 확인된 사항은 Android 12를 기준으로 그 이전, 이후의 호환성 문제가 있다. + +당신의 SW가 Android 11과 12에서 모두 동작해야 한다면, Android 버전을 rsbinder::set_android_version() api를 통해 설정해야 한다. + +Android Version 정보는 다음과 같이 확인하고, 설정할 수 있다. + +``` +use android_system_properties::AndroidSystemProperties; + +let properties = AndroidSystemProperties::new(); + +if let Some(version) = properties.get("ro.build.version.release") { + rsbinder::set_android_version(version.parse()) +} +```