Loading libs/binder/Android.bp +7 −0 Original line number Diff line number Diff line Loading @@ -229,6 +229,7 @@ cc_defaults { cc_library_headers { name: "trusty_mock_headers", host_supported: true, vendor_available: true, export_include_dirs: [ "trusty/include", Loading @@ -243,12 +244,18 @@ cc_library_headers { cc_defaults { name: "trusty_mock_defaults", host_supported: true, vendor_available: true, header_libs: [ "libbinder_headers_base", "liblog_stub", "trusty_mock_headers", ], export_header_lib_headers: [ "libbinder_headers_base", "liblog_stub", "trusty_mock_headers", ], shared_libs: [ "libutils_binder_sdk", Loading libs/binder/rust/Android.bp +57 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,21 @@ rust_library { min_sdk_version: "Tiramisu", } rust_library { name: "libbinder_rs_on_trusty_mock", crate_name: "binder", srcs: ["src/lib.rs"], cfgs: [ "trusty", ], rustlibs: [ "libbinder_ndk_sys_on_trusty_mock", "libdowncast_rs", "liblibc", ], vendor: true, } rust_library { name: "libbinder_tokio_rs", crate_name: "binder_tokio", Loading Loading @@ -89,6 +104,26 @@ rust_library { visibility: [":__subpackages__"], } rust_library { name: "libbinder_ndk_sys_on_trusty_mock", crate_name: "binder_ndk_sys", srcs: [ "sys/lib.rs", ":libbinder_ndk_bindgen_on_trusty_mock", ], cfgs: [ "trusty", ], shared_libs: [ "libbinder_ndk_on_trusty_mock", ], vendor: true, // Lints are checked separately for libbinder_ndk_sys. // The Trusty mock copy pulls in extra headers that // don't pass the lints for the bindgen output. lints: "none", } rust_bindgen { name: "libbinder_ndk_bindgen", crate_name: "binder_ndk_bindgen", Loading Loading @@ -125,6 +160,28 @@ rust_bindgen { min_sdk_version: "Tiramisu", } rust_bindgen { name: "libbinder_ndk_bindgen_on_trusty_mock", crate_name: "binder_ndk_bindgen", wrapper_src: "sys/BinderBindings.hpp", source_stem: "bindings", defaults: [ "trusty_mock_defaults", ], bindgen_flag_files: [ // Unfortunately the only way to specify the rust_non_exhaustive enum // style for a type is to make it the default // and then specify constified enums for the enums we don't want // rustified "libbinder_ndk_bindgen_flags.txt", ], shared_libs: [ "libbinder_ndk_on_trusty_mock", "libc++", ], } rust_test { name: "libbinder_rs-internal_test", crate_name: "binder", Loading libs/binder/rust/src/lib.rs +4 −4 Original line number Diff line number Diff line Loading @@ -100,9 +100,9 @@ mod error; mod native; mod parcel; mod proxy; #[cfg(not(target_os = "trusty"))] #[cfg(not(trusty))] mod service; #[cfg(not(target_os = "trusty"))] #[cfg(not(trusty))] mod state; use binder_ndk_sys as sys; Loading @@ -112,13 +112,13 @@ pub use binder::{BinderFeatures, FromIBinder, IBinder, Interface, Strong, Weak}; pub use error::{ExceptionCode, IntoBinderResult, Status, StatusCode}; pub use parcel::{ParcelFileDescriptor, Parcelable, ParcelableHolder}; pub use proxy::{DeathRecipient, SpIBinder, WpIBinder}; #[cfg(not(target_os = "trusty"))] #[cfg(not(trusty))] pub use service::{ add_service, force_lazy_services_persist, get_declared_instances, get_interface, get_service, is_declared, is_handling_transaction, register_lazy_service, wait_for_interface, wait_for_service, LazyServiceGuard, }; #[cfg(not(target_os = "trusty"))] #[cfg(not(trusty))] pub use state::{ProcessState, ThreadState}; /// Binder result containing a [`Status`] on error. Loading libs/binder/rust/src/native.rs +2 −2 Original line number Diff line number Diff line Loading @@ -327,7 +327,7 @@ impl<T: Remotable> InterfaceClassMethods for Binder<T> { /// contains a `T` pointer in its user data. fd should be a non-owned file /// descriptor, and args must be an array of null-terminated string /// pointers with length num_args. #[cfg(not(target_os = "trusty"))] #[cfg(not(trusty))] unsafe extern "C" fn on_dump( binder: *mut sys::AIBinder, fd: i32, Loading Loading @@ -374,7 +374,7 @@ impl<T: Remotable> InterfaceClassMethods for Binder<T> { } /// Called to handle the `dump` transaction. #[cfg(target_os = "trusty")] #[cfg(trusty)] unsafe extern "C" fn on_dump( _binder: *mut sys::AIBinder, _fd: i32, Loading libs/binder/rust/sys/lib.rs +3 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,9 @@ mod bindings { } // Trusty puts the full path to the auto-generated file in BINDGEN_INC_FILE // and builds it with warnings-as-errors, so we need to use #[allow(bad_style)] // and builds it with warnings-as-errors, so we need to use #[allow(bad_style)]. // We need to use cfg(target_os) instead of cfg(trusty) here because of // the difference between the two build systems, which we cannot mock. #[cfg(target_os = "trusty")] #[allow(bad_style)] mod bindings { Loading Loading
libs/binder/Android.bp +7 −0 Original line number Diff line number Diff line Loading @@ -229,6 +229,7 @@ cc_defaults { cc_library_headers { name: "trusty_mock_headers", host_supported: true, vendor_available: true, export_include_dirs: [ "trusty/include", Loading @@ -243,12 +244,18 @@ cc_library_headers { cc_defaults { name: "trusty_mock_defaults", host_supported: true, vendor_available: true, header_libs: [ "libbinder_headers_base", "liblog_stub", "trusty_mock_headers", ], export_header_lib_headers: [ "libbinder_headers_base", "liblog_stub", "trusty_mock_headers", ], shared_libs: [ "libutils_binder_sdk", Loading
libs/binder/rust/Android.bp +57 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,21 @@ rust_library { min_sdk_version: "Tiramisu", } rust_library { name: "libbinder_rs_on_trusty_mock", crate_name: "binder", srcs: ["src/lib.rs"], cfgs: [ "trusty", ], rustlibs: [ "libbinder_ndk_sys_on_trusty_mock", "libdowncast_rs", "liblibc", ], vendor: true, } rust_library { name: "libbinder_tokio_rs", crate_name: "binder_tokio", Loading Loading @@ -89,6 +104,26 @@ rust_library { visibility: [":__subpackages__"], } rust_library { name: "libbinder_ndk_sys_on_trusty_mock", crate_name: "binder_ndk_sys", srcs: [ "sys/lib.rs", ":libbinder_ndk_bindgen_on_trusty_mock", ], cfgs: [ "trusty", ], shared_libs: [ "libbinder_ndk_on_trusty_mock", ], vendor: true, // Lints are checked separately for libbinder_ndk_sys. // The Trusty mock copy pulls in extra headers that // don't pass the lints for the bindgen output. lints: "none", } rust_bindgen { name: "libbinder_ndk_bindgen", crate_name: "binder_ndk_bindgen", Loading Loading @@ -125,6 +160,28 @@ rust_bindgen { min_sdk_version: "Tiramisu", } rust_bindgen { name: "libbinder_ndk_bindgen_on_trusty_mock", crate_name: "binder_ndk_bindgen", wrapper_src: "sys/BinderBindings.hpp", source_stem: "bindings", defaults: [ "trusty_mock_defaults", ], bindgen_flag_files: [ // Unfortunately the only way to specify the rust_non_exhaustive enum // style for a type is to make it the default // and then specify constified enums for the enums we don't want // rustified "libbinder_ndk_bindgen_flags.txt", ], shared_libs: [ "libbinder_ndk_on_trusty_mock", "libc++", ], } rust_test { name: "libbinder_rs-internal_test", crate_name: "binder", Loading
libs/binder/rust/src/lib.rs +4 −4 Original line number Diff line number Diff line Loading @@ -100,9 +100,9 @@ mod error; mod native; mod parcel; mod proxy; #[cfg(not(target_os = "trusty"))] #[cfg(not(trusty))] mod service; #[cfg(not(target_os = "trusty"))] #[cfg(not(trusty))] mod state; use binder_ndk_sys as sys; Loading @@ -112,13 +112,13 @@ pub use binder::{BinderFeatures, FromIBinder, IBinder, Interface, Strong, Weak}; pub use error::{ExceptionCode, IntoBinderResult, Status, StatusCode}; pub use parcel::{ParcelFileDescriptor, Parcelable, ParcelableHolder}; pub use proxy::{DeathRecipient, SpIBinder, WpIBinder}; #[cfg(not(target_os = "trusty"))] #[cfg(not(trusty))] pub use service::{ add_service, force_lazy_services_persist, get_declared_instances, get_interface, get_service, is_declared, is_handling_transaction, register_lazy_service, wait_for_interface, wait_for_service, LazyServiceGuard, }; #[cfg(not(target_os = "trusty"))] #[cfg(not(trusty))] pub use state::{ProcessState, ThreadState}; /// Binder result containing a [`Status`] on error. Loading
libs/binder/rust/src/native.rs +2 −2 Original line number Diff line number Diff line Loading @@ -327,7 +327,7 @@ impl<T: Remotable> InterfaceClassMethods for Binder<T> { /// contains a `T` pointer in its user data. fd should be a non-owned file /// descriptor, and args must be an array of null-terminated string /// pointers with length num_args. #[cfg(not(target_os = "trusty"))] #[cfg(not(trusty))] unsafe extern "C" fn on_dump( binder: *mut sys::AIBinder, fd: i32, Loading Loading @@ -374,7 +374,7 @@ impl<T: Remotable> InterfaceClassMethods for Binder<T> { } /// Called to handle the `dump` transaction. #[cfg(target_os = "trusty")] #[cfg(trusty)] unsafe extern "C" fn on_dump( _binder: *mut sys::AIBinder, _fd: i32, Loading
libs/binder/rust/sys/lib.rs +3 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,9 @@ mod bindings { } // Trusty puts the full path to the auto-generated file in BINDGEN_INC_FILE // and builds it with warnings-as-errors, so we need to use #[allow(bad_style)] // and builds it with warnings-as-errors, so we need to use #[allow(bad_style)]. // We need to use cfg(target_os) instead of cfg(trusty) here because of // the difference between the two build systems, which we cannot mock. #[cfg(target_os = "trusty")] #[allow(bad_style)] mod bindings { Loading