Replace android-properties with android_system_properties. (#2815)

The former use statically linked Android libc symbols while the latter loads them dynamically. This is required to support old and new versions of Android with the same binary. It unblocks updating wgpu in Gecko.

Fixes #2805.
This commit is contained in:
Nicolas Silva 2022-06-27 22:56:11 +02:00 committed by GitHub
parent 064f3f1db4
commit 892c272d18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 10 deletions

17
Cargo.lock generated
View File

@ -34,18 +34,21 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "android-properties"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04"
[[package]] [[package]]
name = "android_glue" name = "android_glue"
version = "0.2.3" version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407"
[[package]]
name = "android_system_properties"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40906ab18de39e789f964079c6cee50adfb8290fc17bc87f4df76057edc47368"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.57" version = "1.0.57"
@ -2112,7 +2115,7 @@ dependencies = [
name = "wgpu-hal" name = "wgpu-hal"
version = "0.12.0" version = "0.12.0"
dependencies = [ dependencies = [
"android-properties", "android_system_properties",
"arrayvec", "arrayvec",
"ash", "ash",
"bit-set", "bit-set",

View File

@ -91,7 +91,7 @@ web-sys = { version = "0.3", features = ["Window", "HtmlCanvasElement", "WebGl2R
js-sys = { version = "0.3" } js-sys = { version = "0.3" }
[target.'cfg(target_os = "android")'.dependencies] [target.'cfg(target_os = "android")'.dependencies]
android-properties = "0.2" android_system_properties = "0.1.1"
[dependencies.naga] [dependencies.naga]
git = "https://github.com/gfx-rs/naga" git = "https://github.com/gfx-rs/naga"

View File

@ -573,9 +573,9 @@ impl crate::Instance<super::Api> for super::Instance {
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
let android_sdk_version = { let android_sdk_version = {
let properties = android_system_properties::AndroidSystemProperties::new();
// See: https://developer.android.com/reference/android/os/Build.VERSION_CODES // See: https://developer.android.com/reference/android/os/Build.VERSION_CODES
let mut prop = android_properties::getprop("ro.build.version.sdk"); if let Some(val) = properties.get("ro.build.version.sdk") {
if let Some(val) = prop.value() {
match val.parse::<u32>() { match val.parse::<u32>() {
Ok(sdk_ver) => sdk_ver, Ok(sdk_ver) => sdk_ver,
Err(err) => { Err(err) => {