Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Load the symbols dynamically #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "android-properties"
description = "Rust-based Android properties wrapper"
version = "0.2.2"
version = "0.3.0"
authors = ["Mikhail Lappo <mikhail.lappo@esrlabs.com>"]
edition = "2018"
license = "MIT"
Expand All @@ -19,9 +19,8 @@ keywords = [
categories = ["external-ffi-bindings", "os", "os::linux-apis"]
exclude = [".travis.yml", "check.sh"]

[features]
# Use this feature if you have Android 8 and older versions
bionic-deprecated = []
[dependencies]
libc = "0.2.126"

[package.metadata.docs.rs]
targets = ["arm-linux-androideabi", "armv7-linux-androideabi", "aarch64-linux-android", "i686-linux-android", "x86_64-unknown-linux-gnu"]
4 changes: 1 addition & 3 deletions check.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
set -e

adb shell reboot

cargo check --target=aarch64-linux-android
cargo check --target=aarch64-linux-android
cargo check --target=aarch64-linux-android --features "bionic-deprecated"
cargo check --target=aarch64-linux-android --examples --features "bionic-deprecated"
cargo build --target=aarch64-linux-android --examples
cargo doc
cargo test
Expand Down
7 changes: 5 additions & 2 deletions examples/property_foreach.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use android_properties::AndroidProperties;

fn main() {
for property in android_properties::prop_values() {
println!("{}", property);
let properties = AndroidProperties::new();
for property in properties.property_values() {
println!("{:?}", properties.get(&property));
}
}
11 changes: 7 additions & 4 deletions examples/property_get.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
use android_properties::AndroidProperty;
use android_properties::{AndroidProperties, AndroidProperty};

const HELLO_WORLD_PROPERTY: &str = "hello.world";

fn main() {
let mut hello_world = AndroidProperty::new(HELLO_WORLD_PROPERTY);
match hello_world.value() {
Some(_value) => println!("{}", hello_world),
let properties = AndroidProperties::new();
let hello_world = AndroidProperty::new(HELLO_WORLD_PROPERTY);
properties.set(&hello_world, "bonjour").unwrap();

match properties.get(&hello_world) {
Some(value) => println!("{:?}", value),
None => println!("Property {} not found", hello_world.name()),
};
}
13 changes: 8 additions & 5 deletions examples/property_refresh.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use android_properties::{setprop, AndroidProperty};
use android_properties::{AndroidProperties, AndroidProperty};

const HELLO_WORLD_PROPERTY: &str = "hello.world";

fn main() {
setprop(HELLO_WORLD_PROPERTY, "initial value").expect("Cannot set android property");
let properties = AndroidProperties::new();

properties.set_property(HELLO_WORLD_PROPERTY, "initial value").expect("Cannot set android property");

let hello_world = AndroidProperty::new(HELLO_WORLD_PROPERTY);
println!("Initial property: {}", hello_world);
println!("Initial property: {:?}", properties.get(&hello_world));

setprop(HELLO_WORLD_PROPERTY, "refreshed value").expect("Cannot set android property");
println!("Refreshed property: {}", hello_world);
properties.set_property(HELLO_WORLD_PROPERTY, "refreshed value").expect("Cannot set android property");
println!("Refreshed property: {:?}", properties.get(&hello_world));
}
5 changes: 4 additions & 1 deletion examples/property_set.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
use android_properties::AndroidProperties;

fn main() {
android_properties::setprop("hello.world", "hello").expect("Cannot set android property");
let properties = AndroidProperties::new();
properties.set_property("hello.world", "hello").expect("Cannot set android property");
}
111 changes: 0 additions & 111 deletions src/android/mod.rs

This file was deleted.

Loading