Skip to content

Commit

Permalink
Merge pull request #15 from hiking90/main
Browse files Browse the repository at this point in the history
Add Android descriptions
  • Loading branch information
hiking90 authored Mar 17, 2024
2 parents 12f8028 + 743d1cf commit 2dbe6fa
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/android-build.md
Original file line number Diff line number Diff line change
@@ -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
```

23 changes: 23 additions & 0 deletions src/android.md
Original file line number Diff line number Diff line change
@@ -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())
}
```

0 comments on commit 2dbe6fa

Please sign in to comment.