Loading libs/binder/rust/Android.bp +3 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ rust_library { "libdowncast_rs", ], host_supported: true, vendor_available: true, target: { darwin: { enabled: false, Loading Loading @@ -64,6 +65,7 @@ rust_library { "libbinder_ndk", ], host_supported: true, vendor_available: true, target: { darwin: { enabled: false, Loading Loading @@ -105,6 +107,7 @@ rust_bindgen { "libbinder_ndk", ], host_supported: true, vendor_available: true, // Currently necessary for host builds // TODO(b/31559095): bionic on host should define this Loading libs/binder/rust/src/binder.rs +3 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,7 @@ pub trait IBinderInternal: IBinder { fn ping_binder(&mut self) -> Result<()>; /// Indicate that the service intends to receive caller security contexts. #[cfg(not(android_vndk))] fn set_requesting_sid(&mut self, enable: bool); /// Dump this object to the given file handle Loading Loading @@ -635,6 +636,7 @@ unsafe impl<T, V: AsNative<T>> AsNative<T> for Option<V> { pub struct BinderFeatures { /// Indicates that the service intends to receive caller security contexts. This must be true /// for `ThreadState::with_calling_sid` to work. #[cfg(not(android_vndk))] pub set_requesting_sid: bool, // Ensure that clients include a ..BinderFeatures::default() to preserve backwards compatibility // when new fields are added. #[non_exhaustive] doesn't work because it prevents struct Loading Loading @@ -837,6 +839,7 @@ macro_rules! declare_binder_interface { /// Create a new binder service. pub fn new_binder<T: $interface + Sync + Send + 'static>(inner: T, features: $crate::BinderFeatures) -> $crate::Strong<dyn $interface> { let mut binder = $crate::Binder::new_with_stability($native(Box::new(inner)), $stability); #[cfg(not(android_vndk))] $crate::IBinderInternal::set_requesting_sid(&mut binder, features.set_requesting_sid); $crate::Strong::new(Box::new(binder)) } Loading libs/binder/rust/src/native.rs +2 −2 Original line number Diff line number Diff line Loading @@ -212,7 +212,7 @@ impl<T: Remotable> Binder<T> { /// Mark this binder object with local stability, which is vendor if we are /// building for the VNDK and system otherwise. #[cfg(vendor_ndk)] #[cfg(any(vendor_ndk, android_vndk))] fn mark_local_stability(&mut self) { unsafe { // Safety: Self always contains a valid `AIBinder` pointer, so Loading @@ -223,7 +223,7 @@ impl<T: Remotable> Binder<T> { /// Mark this binder object with local stability, which is vendor if we are /// building for the VNDK and system otherwise. #[cfg(not(vendor_ndk))] #[cfg(not(any(vendor_ndk, android_vndk)))] fn mark_local_stability(&mut self) { unsafe { // Safety: Self always contains a valid `AIBinder` pointer, so Loading libs/binder/rust/src/proxy.rs +1 −0 Original line number Diff line number Diff line Loading @@ -323,6 +323,7 @@ impl<T: AsNative<sys::AIBinder>> IBinderInternal for T { status_result(status) } #[cfg(not(android_vndk))] fn set_requesting_sid(&mut self, enable: bool) { unsafe { sys::AIBinder_setRequestingSid(self.as_native_mut(), enable) }; } Loading Loading
libs/binder/rust/Android.bp +3 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ rust_library { "libdowncast_rs", ], host_supported: true, vendor_available: true, target: { darwin: { enabled: false, Loading Loading @@ -64,6 +65,7 @@ rust_library { "libbinder_ndk", ], host_supported: true, vendor_available: true, target: { darwin: { enabled: false, Loading Loading @@ -105,6 +107,7 @@ rust_bindgen { "libbinder_ndk", ], host_supported: true, vendor_available: true, // Currently necessary for host builds // TODO(b/31559095): bionic on host should define this Loading
libs/binder/rust/src/binder.rs +3 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,7 @@ pub trait IBinderInternal: IBinder { fn ping_binder(&mut self) -> Result<()>; /// Indicate that the service intends to receive caller security contexts. #[cfg(not(android_vndk))] fn set_requesting_sid(&mut self, enable: bool); /// Dump this object to the given file handle Loading Loading @@ -635,6 +636,7 @@ unsafe impl<T, V: AsNative<T>> AsNative<T> for Option<V> { pub struct BinderFeatures { /// Indicates that the service intends to receive caller security contexts. This must be true /// for `ThreadState::with_calling_sid` to work. #[cfg(not(android_vndk))] pub set_requesting_sid: bool, // Ensure that clients include a ..BinderFeatures::default() to preserve backwards compatibility // when new fields are added. #[non_exhaustive] doesn't work because it prevents struct Loading Loading @@ -837,6 +839,7 @@ macro_rules! declare_binder_interface { /// Create a new binder service. pub fn new_binder<T: $interface + Sync + Send + 'static>(inner: T, features: $crate::BinderFeatures) -> $crate::Strong<dyn $interface> { let mut binder = $crate::Binder::new_with_stability($native(Box::new(inner)), $stability); #[cfg(not(android_vndk))] $crate::IBinderInternal::set_requesting_sid(&mut binder, features.set_requesting_sid); $crate::Strong::new(Box::new(binder)) } Loading
libs/binder/rust/src/native.rs +2 −2 Original line number Diff line number Diff line Loading @@ -212,7 +212,7 @@ impl<T: Remotable> Binder<T> { /// Mark this binder object with local stability, which is vendor if we are /// building for the VNDK and system otherwise. #[cfg(vendor_ndk)] #[cfg(any(vendor_ndk, android_vndk))] fn mark_local_stability(&mut self) { unsafe { // Safety: Self always contains a valid `AIBinder` pointer, so Loading @@ -223,7 +223,7 @@ impl<T: Remotable> Binder<T> { /// Mark this binder object with local stability, which is vendor if we are /// building for the VNDK and system otherwise. #[cfg(not(vendor_ndk))] #[cfg(not(any(vendor_ndk, android_vndk)))] fn mark_local_stability(&mut self) { unsafe { // Safety: Self always contains a valid `AIBinder` pointer, so Loading
libs/binder/rust/src/proxy.rs +1 −0 Original line number Diff line number Diff line Loading @@ -323,6 +323,7 @@ impl<T: AsNative<sys::AIBinder>> IBinderInternal for T { status_result(status) } #[cfg(not(android_vndk))] fn set_requesting_sid(&mut self, enable: bool) { unsafe { sys::AIBinder_setRequestingSid(self.as_native_mut(), enable) }; } Loading