Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ resolver = "2"
members = ["android-activity"]

exclude = ["examples"]

[patch.crates-io]
# https://github.com/rust-mobile/ndk/pull/495
ndk = { git = "https://github.com/rust-mobile/ndk", rev = "9c63222" }
1 change: 0 additions & 1 deletion android-activity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ jni = "0.21"
ndk-sys = "0.6.0"
ndk = { version = "0.9.0", default-features = false }
ndk-context = "0.1.1"
android-properties = "0.2"
num_enum = "0.7"
bitflags = "2.0"
libc = "0.2.139"
Expand Down
15 changes: 7 additions & 8 deletions android-activity/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -855,15 +855,14 @@

/// The user-visible SDK version of the framework
///
/// Also referred to as [`Build.VERSION_CODES`](https://developer.android.com/reference/android/os/Build.VERSION_CODES)
/// The same value as [`Build.VERSION.SDK_INT`], containing a value from [`Build.VERSION_CODES`].
///
/// [`Build.VERSION.SDK_INT`]: https://developer.android.com/reference/android/os/Build.VERSION#SDK_INT
/// [`Build.VERSION_CODES`]: https://developer.android.com/reference/android/os/Build.VERSION_CODES
pub fn sdk_version() -> i32 {
let mut prop = android_properties::getprop("ro.build.version.sdk");
if let Some(val) = prop.value() {
val.parse::<i32>()
.expect("Failed to parse ro.build.version.sdk property")
} else {
panic!("Couldn't read ro.build.version.sdk system property");
}
// TODO: Replace with ndk::api_level::device_api_level() from https://github.com/rust-mobile/ndk/pull/479?
ndk::system_properties::get::<i32>(c"ro.build.version.sdk")

Check failure on line 864 in android-activity/src/lib.rs

View workflow job for this annotation

GitHub Actions / build (1.73.0)

`c".."` literals are experimental

Check failure on line 864 in android-activity/src/lib.rs

View workflow job for this annotation

GitHub Actions / build (1.73.0)

`c".."` literals are experimental
.expect("Failed to get or parse `ro.build.version.sdk` property")
}

/// Path to this application's internal data directory
Expand Down
Loading