Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ndk: Add definitions and bindings for API levels #479

Open
wants to merge 2 commits into
base: system-properties
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
2 changes: 2 additions & 0 deletions ndk-sys/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Unreleased

- **Breaking:** Removed `__ANDROID_API__` constant as it is always defined to the value of `__ANDROID_API_FUTURE__`. (#479)
- Regenerate bindings with `bindgen 0.71.1`. (#487)
- Include API bindings from `sys/system_properties.h`. (#495)

# 0.6.0 (2024-04-26)

Expand Down
1 change: 1 addition & 0 deletions ndk-sys/generate_bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ while read ARCH && read TARGET ; do
--blocklist-item 'C?_?JNIEnv' \
--blocklist-item '_?JavaVM' \
--blocklist-item '_?j\w+' \
--blocklist-item '__ANDROID_API__' \
--newtype-enum '\w+_(result|status)_t' \
--newtype-enum 'ACameraDevice_request_template' \
--newtype-enum 'ADataSpace' \
Expand Down
63 changes: 62 additions & 1 deletion ndk-sys/src/ffi_aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ pub const __BIONIC__: u32 = 1;
pub const __WORDSIZE: u32 = 64;
pub const __bos_level: u32 = 0;
pub const __ANDROID_API_FUTURE__: u32 = 10000;
pub const __ANDROID_API__: u32 = 10000;
pub const __ANDROID_API_G__: u32 = 9;
pub const __ANDROID_API_I__: u32 = 14;
pub const __ANDROID_API_J__: u32 = 16;
Expand Down Expand Up @@ -1410,6 +1409,8 @@ pub const PROPERTY_VERSION: &[u8; 8] = b"version\0";
pub const PROPERTY_DESCRIPTION: &[u8; 12] = b"description\0";
pub const PROPERTY_ALGORITHMS: &[u8; 11] = b"algorithms\0";
pub const PROPERTY_DEVICE_UNIQUE_ID: &[u8; 15] = b"deviceUniqueId\0";
pub const PROP_VALUE_MAX: u32 = 92;
pub const PROP_NAME_MAX: u32 = 32;
extern "C" {
pub fn android_get_application_target_sdk_version() -> ::std::os::raw::c_int;
}
Expand Down Expand Up @@ -21844,4 +21845,64 @@ extern "C" {
extern "C" {
pub fn AMediaMuxer_getTrackFormat(muxer: *mut AMediaMuxer, idx: usize) -> *mut AMediaFormat;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct prop_info {
_unused: [u8; 0],
}
extern "C" {
pub fn __system_property_set(
__name: *const ::std::os::raw::c_char,
__value: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_find(__name: *const ::std::os::raw::c_char) -> *const prop_info;
}
extern "C" {
pub fn __system_property_read_callback(
__pi: *const prop_info,
__callback: ::std::option::Option<
unsafe extern "C" fn(
__cookie: *mut ::std::os::raw::c_void,
__name: *const ::std::os::raw::c_char,
__value: *const ::std::os::raw::c_char,
__serial: u32,
),
>,
__cookie: *mut ::std::os::raw::c_void,
);
}
extern "C" {
pub fn __system_property_foreach(
__callback: ::std::option::Option<
unsafe extern "C" fn(__pi: *const prop_info, __cookie: *mut ::std::os::raw::c_void),
>,
__cookie: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_wait(
__pi: *const prop_info,
__old_serial: u32,
__new_serial_ptr: *mut u32,
__relative_timeout: *const timespec,
) -> bool;
}
extern "C" {
pub fn __system_property_read(
__pi: *const prop_info,
__name: *mut ::std::os::raw::c_char,
__value: *mut ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_get(
__name: *const ::std::os::raw::c_char,
__value: *mut ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_find_nth(__n: ::std::os::raw::c_uint) -> *const prop_info;
}
pub type __uint128_t = u128;
63 changes: 62 additions & 1 deletion ndk-sys/src/ffi_arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ pub const __BIONIC__: u32 = 1;
pub const __WORDSIZE: u32 = 32;
pub const __bos_level: u32 = 0;
pub const __ANDROID_API_FUTURE__: u32 = 10000;
pub const __ANDROID_API__: u32 = 10000;
pub const __ANDROID_API_G__: u32 = 9;
pub const __ANDROID_API_I__: u32 = 14;
pub const __ANDROID_API_J__: u32 = 16;
Expand Down Expand Up @@ -1463,6 +1462,8 @@ pub const PROPERTY_VERSION: &[u8; 8] = b"version\0";
pub const PROPERTY_DESCRIPTION: &[u8; 12] = b"description\0";
pub const PROPERTY_ALGORITHMS: &[u8; 11] = b"algorithms\0";
pub const PROPERTY_DEVICE_UNIQUE_ID: &[u8; 15] = b"deviceUniqueId\0";
pub const PROP_VALUE_MAX: u32 = 92;
pub const PROP_NAME_MAX: u32 = 32;
extern "C" {
pub fn android_get_application_target_sdk_version() -> ::std::os::raw::c_int;
}
Expand Down Expand Up @@ -22294,3 +22295,63 @@ extern "C" {
extern "C" {
pub fn AMediaMuxer_getTrackFormat(muxer: *mut AMediaMuxer, idx: usize) -> *mut AMediaFormat;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct prop_info {
_unused: [u8; 0],
}
extern "C" {
pub fn __system_property_set(
__name: *const ::std::os::raw::c_char,
__value: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_find(__name: *const ::std::os::raw::c_char) -> *const prop_info;
}
extern "C" {
pub fn __system_property_read_callback(
__pi: *const prop_info,
__callback: ::std::option::Option<
unsafe extern "C" fn(
__cookie: *mut ::std::os::raw::c_void,
__name: *const ::std::os::raw::c_char,
__value: *const ::std::os::raw::c_char,
__serial: u32,
),
>,
__cookie: *mut ::std::os::raw::c_void,
);
}
extern "C" {
pub fn __system_property_foreach(
__callback: ::std::option::Option<
unsafe extern "C" fn(__pi: *const prop_info, __cookie: *mut ::std::os::raw::c_void),
>,
__cookie: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_wait(
__pi: *const prop_info,
__old_serial: u32,
__new_serial_ptr: *mut u32,
__relative_timeout: *const timespec,
) -> bool;
}
extern "C" {
pub fn __system_property_read(
__pi: *const prop_info,
__name: *mut ::std::os::raw::c_char,
__value: *mut ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_get(
__name: *const ::std::os::raw::c_char,
__value: *mut ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_find_nth(__n: ::std::os::raw::c_uint) -> *const prop_info;
}
63 changes: 62 additions & 1 deletion ndk-sys/src/ffi_i686.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ pub const __BIONIC__: u32 = 1;
pub const __WORDSIZE: u32 = 32;
pub const __bos_level: u32 = 0;
pub const __ANDROID_API_FUTURE__: u32 = 10000;
pub const __ANDROID_API__: u32 = 10000;
pub const __ANDROID_API_G__: u32 = 9;
pub const __ANDROID_API_I__: u32 = 14;
pub const __ANDROID_API_J__: u32 = 16;
Expand Down Expand Up @@ -1327,6 +1326,8 @@ pub const PROPERTY_VERSION: &[u8; 8] = b"version\0";
pub const PROPERTY_DESCRIPTION: &[u8; 12] = b"description\0";
pub const PROPERTY_ALGORITHMS: &[u8; 11] = b"algorithms\0";
pub const PROPERTY_DEVICE_UNIQUE_ID: &[u8; 15] = b"deviceUniqueId\0";
pub const PROP_VALUE_MAX: u32 = 92;
pub const PROP_NAME_MAX: u32 = 32;
extern "C" {
pub fn android_get_application_target_sdk_version() -> ::std::os::raw::c_int;
}
Expand Down Expand Up @@ -23011,4 +23012,64 @@ extern "C" {
extern "C" {
pub fn AMediaMuxer_getTrackFormat(muxer: *mut AMediaMuxer, idx: usize) -> *mut AMediaFormat;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct prop_info {
_unused: [u8; 0],
}
extern "C" {
pub fn __system_property_set(
__name: *const ::std::os::raw::c_char,
__value: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_find(__name: *const ::std::os::raw::c_char) -> *const prop_info;
}
extern "C" {
pub fn __system_property_read_callback(
__pi: *const prop_info,
__callback: ::std::option::Option<
unsafe extern "C" fn(
__cookie: *mut ::std::os::raw::c_void,
__name: *const ::std::os::raw::c_char,
__value: *const ::std::os::raw::c_char,
__serial: u32,
),
>,
__cookie: *mut ::std::os::raw::c_void,
);
}
extern "C" {
pub fn __system_property_foreach(
__callback: ::std::option::Option<
unsafe extern "C" fn(__pi: *const prop_info, __cookie: *mut ::std::os::raw::c_void),
>,
__cookie: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_wait(
__pi: *const prop_info,
__old_serial: u32,
__new_serial_ptr: *mut u32,
__relative_timeout: *const timespec,
) -> bool;
}
extern "C" {
pub fn __system_property_read(
__pi: *const prop_info,
__name: *mut ::std::os::raw::c_char,
__value: *mut ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_get(
__name: *const ::std::os::raw::c_char,
__value: *mut ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_find_nth(__n: ::std::os::raw::c_uint) -> *const prop_info;
}
pub type __builtin_va_list = *mut ::std::os::raw::c_char;
63 changes: 62 additions & 1 deletion ndk-sys/src/ffi_x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ pub const __BIONIC__: u32 = 1;
pub const __WORDSIZE: u32 = 64;
pub const __bos_level: u32 = 0;
pub const __ANDROID_API_FUTURE__: u32 = 10000;
pub const __ANDROID_API__: u32 = 10000;
pub const __ANDROID_API_G__: u32 = 9;
pub const __ANDROID_API_I__: u32 = 14;
pub const __ANDROID_API_J__: u32 = 16;
Expand Down Expand Up @@ -1372,6 +1371,8 @@ pub const PROPERTY_VERSION: &[u8; 8] = b"version\0";
pub const PROPERTY_DESCRIPTION: &[u8; 12] = b"description\0";
pub const PROPERTY_ALGORITHMS: &[u8; 11] = b"algorithms\0";
pub const PROPERTY_DEVICE_UNIQUE_ID: &[u8; 15] = b"deviceUniqueId\0";
pub const PROP_VALUE_MAX: u32 = 92;
pub const PROP_NAME_MAX: u32 = 32;
extern "C" {
pub fn android_get_application_target_sdk_version() -> ::std::os::raw::c_int;
}
Expand Down Expand Up @@ -23049,6 +23050,66 @@ extern "C" {
extern "C" {
pub fn AMediaMuxer_getTrackFormat(muxer: *mut AMediaMuxer, idx: usize) -> *mut AMediaFormat;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct prop_info {
_unused: [u8; 0],
}
extern "C" {
pub fn __system_property_set(
__name: *const ::std::os::raw::c_char,
__value: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_find(__name: *const ::std::os::raw::c_char) -> *const prop_info;
}
extern "C" {
pub fn __system_property_read_callback(
__pi: *const prop_info,
__callback: ::std::option::Option<
unsafe extern "C" fn(
__cookie: *mut ::std::os::raw::c_void,
__name: *const ::std::os::raw::c_char,
__value: *const ::std::os::raw::c_char,
__serial: u32,
),
>,
__cookie: *mut ::std::os::raw::c_void,
);
}
extern "C" {
pub fn __system_property_foreach(
__callback: ::std::option::Option<
unsafe extern "C" fn(__pi: *const prop_info, __cookie: *mut ::std::os::raw::c_void),
>,
__cookie: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_wait(
__pi: *const prop_info,
__old_serial: u32,
__new_serial_ptr: *mut u32,
__relative_timeout: *const timespec,
) -> bool;
}
extern "C" {
pub fn __system_property_read(
__pi: *const prop_info,
__name: *mut ::std::os::raw::c_char,
__value: *mut ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_get(
__name: *const ::std::os::raw::c_char,
__value: *mut ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn __system_property_find_nth(__n: ::std::os::raw::c_uint) -> *const prop_info;
}
pub type __builtin_va_list = [__va_list_tag; 1usize];
#[repr(C)]
#[derive(Debug, Copy, Clone)]
Expand Down
2 changes: 2 additions & 0 deletions ndk-sys/wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,5 @@
#include <media/NdkMediaExtractor.h>
#include <media/NdkMediaFormat.h>
#include <media/NdkMediaMuxer.h>

#include <sys/system_properties.h>
2 changes: 2 additions & 0 deletions ndk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Unreleased

- image_reader: Add `ImageReader::new_with_data_space()` constructor and `ImageReader::data_space()` getter from API level 34. (#474)
- Add `api_level` module with definitions and bindings for Android API levels. (#479)
- Add bindings for querying and setting Android System Properties. (#495)

# 0.9.0 (2024-04-26)

Expand Down
Loading
Loading