android_system_microfuchsia_vm_service/
android_system_microfuchsia_vm_service_aidl_rust_glue.rs

1#![allow(non_snake_case)]
2#![allow(missing_docs)]
3#[deprecated(note = "Please access via libbinder_rs binder::")]
4pub use binder;
5pub mod aidl {
6  pub mod android {
7    pub mod system {
8      pub mod microfuchsia {
9        pub mod vm_service {
10          pub mod IMicrofuchsia {
11            /*
12             * This file is auto-generated.  DO NOT MODIFY.
13             * Using: host_x64/aidl_gen -a -I ../../src/tee/binder-proxy/aidl --lang=rust -o gen/src/tee/binder-proxy/android_system_microfuchsia_vm_service_aidl --min_sdk_version=31 --structured ../../src/tee/binder-proxy/aidl/android/system/microfuchsia/vm_service/IMicrofuchsia.aidl
14             *
15             * DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
16             * ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
17             * AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
18             */
19            #![forbid(unsafe_code)]
20            #![cfg_attr(rustfmt, rustfmt_skip)]
21            #![allow(non_upper_case_globals)]
22            #![allow(non_snake_case)]
23            #[allow(unused_imports)] use binder::binder_impl::IBinderInternal;
24            use binder::declare_binder_interface;
25            declare_binder_interface! {
26              IMicrofuchsia["android.system.microfuchsia.vm_service.IMicrofuchsia"] {
27                native: BnMicrofuchsia(on_transact),
28                proxy: BpMicrofuchsia {
29                },
30                async: IMicrofuchsiaAsync(try_into_local_async),
31              }
32            }
33            pub trait IMicrofuchsia: binder::Interface + Send {
34              fn get_descriptor() -> &'static str where Self: Sized { "android.system.microfuchsia.vm_service.IMicrofuchsia" }
35              fn r#setHostProxy<'a, 'l1, >(&'a self, _arg_proxy: &'l1 binder::Strong<dyn crate::mangled::_7_android_6_system_12_microfuchsia_10_vm_service_10_IHostProxy>) -> binder::Result<()>;
36              fn r#trustedAppUuids<'a, >(&'a self) -> binder::Result<Vec<String>>;
37              fn getDefaultImpl() -> IMicrofuchsiaDefaultRef where Self: Sized {
38                DEFAULT_IMPL.lock().unwrap().clone()
39              }
40              fn setDefaultImpl(d: IMicrofuchsiaDefaultRef) -> IMicrofuchsiaDefaultRef where Self: Sized {
41                std::mem::replace(&mut *DEFAULT_IMPL.lock().unwrap(), d)
42              }
43              fn try_as_async_server<'a>(&'a self) -> Option<&'a (dyn IMicrofuchsiaAsyncServer + Send + Sync)> {
44                None
45              }
46            }
47            pub trait IMicrofuchsiaAsync<P>: binder::Interface + Send {
48              fn get_descriptor() -> &'static str where Self: Sized { "android.system.microfuchsia.vm_service.IMicrofuchsia" }
49              fn r#setHostProxy<'a, >(&'a self, _arg_proxy: &'a binder::Strong<dyn crate::mangled::_7_android_6_system_12_microfuchsia_10_vm_service_10_IHostProxy>) -> binder::BoxFuture<'a, binder::Result<()>>;
50              fn r#trustedAppUuids<'a, >(&'a self) -> binder::BoxFuture<'a, binder::Result<Vec<String>>>;
51            }
52            #[::async_trait::async_trait]
53            pub trait IMicrofuchsiaAsyncServer: binder::Interface + Send {
54              fn get_descriptor() -> &'static str where Self: Sized { "android.system.microfuchsia.vm_service.IMicrofuchsia" }
55              async fn r#setHostProxy<'a, 'l1, >(&'a self, _arg_proxy: &'l1 binder::Strong<dyn crate::mangled::_7_android_6_system_12_microfuchsia_10_vm_service_10_IHostProxy>) -> binder::Result<()>;
56              async fn r#trustedAppUuids<'a, >(&'a self) -> binder::Result<Vec<String>>;
57            }
58            impl BnMicrofuchsia {
59              /// Create a new async binder service.
60              pub fn new_async_binder<T, R>(inner: T, rt: R, features: binder::BinderFeatures) -> binder::Strong<dyn IMicrofuchsia>
61              where
62                T: IMicrofuchsiaAsyncServer + binder::Interface + Send + Sync + 'static,
63                R: binder::binder_impl::BinderAsyncRuntime + Send + Sync + 'static,
64              {
65                struct Wrapper<T, R> {
66                  _inner: T,
67                  _rt: R,
68                }
69                impl<T, R> binder::Interface for Wrapper<T, R> where T: binder::Interface, R: Send + Sync + 'static {
70                  fn as_binder(&self) -> binder::SpIBinder { self._inner.as_binder() }
71                  fn dump(&self, _writer: &mut dyn std::io::Write, _args: &[&std::ffi::CStr]) -> std::result::Result<(), binder::StatusCode> { self._inner.dump(_writer, _args) }
72                }
73                impl<T, R> IMicrofuchsia for Wrapper<T, R>
74                where
75                  T: IMicrofuchsiaAsyncServer + Send + Sync + 'static,
76                  R: binder::binder_impl::BinderAsyncRuntime + Send + Sync + 'static,
77                {
78                  fn r#setHostProxy<'a, 'l1, >(&'a self, _arg_proxy: &'l1 binder::Strong<dyn crate::mangled::_7_android_6_system_12_microfuchsia_10_vm_service_10_IHostProxy>) -> binder::Result<()> {
79                    self._rt.block_on(self._inner.r#setHostProxy(_arg_proxy))
80                  }
81                  fn r#trustedAppUuids<'a, >(&'a self) -> binder::Result<Vec<String>> {
82                    self._rt.block_on(self._inner.r#trustedAppUuids())
83                  }
84                  fn try_as_async_server(&self) -> Option<&(dyn IMicrofuchsiaAsyncServer + Send + Sync)> {
85                    Some(&self._inner)
86                  }
87                }
88                let wrapped = Wrapper { _inner: inner, _rt: rt };
89                Self::new_binder(wrapped, features)
90              }
91              pub fn try_into_local_async<P: binder::BinderAsyncPool + 'static>(_native: binder::binder_impl::Binder<Self>) -> Option<binder::Strong<dyn IMicrofuchsiaAsync<P>>> {
92                struct Wrapper {
93                  _native: binder::binder_impl::Binder<BnMicrofuchsia>
94                }
95                impl binder::Interface for Wrapper {}
96                impl<P: binder::BinderAsyncPool> IMicrofuchsiaAsync<P> for Wrapper {
97                  fn r#setHostProxy<'a, >(&'a self, _arg_proxy: &'a binder::Strong<dyn crate::mangled::_7_android_6_system_12_microfuchsia_10_vm_service_10_IHostProxy>) -> binder::BoxFuture<'a, binder::Result<()>> {
98                    Box::pin(self._native.try_as_async_server().unwrap().r#setHostProxy(_arg_proxy))
99                  }
100                  fn r#trustedAppUuids<'a, >(&'a self) -> binder::BoxFuture<'a, binder::Result<Vec<String>>> {
101                    Box::pin(self._native.try_as_async_server().unwrap().r#trustedAppUuids())
102                  }
103                }
104                if _native.try_as_async_server().is_some() {
105                  Some(binder::Strong::new(Box::new(Wrapper { _native }) as Box<dyn IMicrofuchsiaAsync<P>>))
106                } else {
107                  None
108                }
109              }
110            }
111            pub trait IMicrofuchsiaDefault: Send + Sync {
112              fn r#setHostProxy<'a, 'l1, >(&'a self, _arg_proxy: &'l1 binder::Strong<dyn crate::mangled::_7_android_6_system_12_microfuchsia_10_vm_service_10_IHostProxy>) -> binder::Result<()> {
113                Err(binder::StatusCode::UNKNOWN_TRANSACTION.into())
114              }
115              fn r#trustedAppUuids<'a, >(&'a self) -> binder::Result<Vec<String>> {
116                Err(binder::StatusCode::UNKNOWN_TRANSACTION.into())
117              }
118            }
119            pub mod transactions {
120              pub const r#setHostProxy: binder::binder_impl::TransactionCode = binder::binder_impl::FIRST_CALL_TRANSACTION + 0;
121              pub const r#trustedAppUuids: binder::binder_impl::TransactionCode = binder::binder_impl::FIRST_CALL_TRANSACTION + 1;
122            }
123            pub type IMicrofuchsiaDefaultRef = Option<std::sync::Arc<dyn IMicrofuchsiaDefault>>;
124            static DEFAULT_IMPL: std::sync::Mutex<IMicrofuchsiaDefaultRef> = std::sync::Mutex::new(None);
125            pub const r#GUEST_PORT: i32 = 5680;
126            impl BpMicrofuchsia {
127              fn build_parcel_setHostProxy(&self, _arg_proxy: &binder::Strong<dyn crate::mangled::_7_android_6_system_12_microfuchsia_10_vm_service_10_IHostProxy>) -> binder::Result<binder::binder_impl::Parcel> {
128                let mut aidl_data = self.binder.prepare_transact()?;
129                aidl_data.write(_arg_proxy)?;
130                Ok(aidl_data)
131              }
132              fn read_response_setHostProxy(&self, _arg_proxy: &binder::Strong<dyn crate::mangled::_7_android_6_system_12_microfuchsia_10_vm_service_10_IHostProxy>, _aidl_reply: std::result::Result<binder::binder_impl::Parcel, binder::StatusCode>) -> binder::Result<()> {
133                if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply {
134                  if let Some(_aidl_default_impl) = <Self as IMicrofuchsia>::getDefaultImpl() {
135                    return _aidl_default_impl.r#setHostProxy(_arg_proxy);
136                  }
137                }
138                let _aidl_reply = _aidl_reply?;
139                let _aidl_status: binder::Status = _aidl_reply.read()?;
140                if !_aidl_status.is_ok() { return Err(_aidl_status); }
141                Ok(())
142              }
143              fn build_parcel_trustedAppUuids(&self) -> binder::Result<binder::binder_impl::Parcel> {
144                let mut aidl_data = self.binder.prepare_transact()?;
145                Ok(aidl_data)
146              }
147              fn read_response_trustedAppUuids(&self, _aidl_reply: std::result::Result<binder::binder_impl::Parcel, binder::StatusCode>) -> binder::Result<Vec<String>> {
148                if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply {
149                  if let Some(_aidl_default_impl) = <Self as IMicrofuchsia>::getDefaultImpl() {
150                    return _aidl_default_impl.r#trustedAppUuids();
151                  }
152                }
153                let _aidl_reply = _aidl_reply?;
154                let _aidl_status: binder::Status = _aidl_reply.read()?;
155                if !_aidl_status.is_ok() { return Err(_aidl_status); }
156                let _aidl_return: Vec<String> = _aidl_reply.read()?;
157                Ok(_aidl_return)
158              }
159            }
160            impl IMicrofuchsia for BpMicrofuchsia {
161              fn r#setHostProxy<'a, 'l1, >(&'a self, _arg_proxy: &'l1 binder::Strong<dyn crate::mangled::_7_android_6_system_12_microfuchsia_10_vm_service_10_IHostProxy>) -> binder::Result<()> {
162                let _aidl_data = self.build_parcel_setHostProxy(_arg_proxy)?;
163                let _aidl_reply = self.binder.submit_transact(transactions::r#setHostProxy, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL);
164                self.read_response_setHostProxy(_arg_proxy, _aidl_reply)
165              }
166              fn r#trustedAppUuids<'a, >(&'a self) -> binder::Result<Vec<String>> {
167                let _aidl_data = self.build_parcel_trustedAppUuids()?;
168                let _aidl_reply = self.binder.submit_transact(transactions::r#trustedAppUuids, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL);
169                self.read_response_trustedAppUuids(_aidl_reply)
170              }
171            }
172            impl<P: binder::BinderAsyncPool> IMicrofuchsiaAsync<P> for BpMicrofuchsia {
173              fn r#setHostProxy<'a, >(&'a self, _arg_proxy: &'a binder::Strong<dyn crate::mangled::_7_android_6_system_12_microfuchsia_10_vm_service_10_IHostProxy>) -> binder::BoxFuture<'a, binder::Result<()>> {
174                let _aidl_data = match self.build_parcel_setHostProxy(_arg_proxy) {
175                  Ok(_aidl_data) => _aidl_data,
176                  Err(err) => return Box::pin(std::future::ready(Err(err))),
177                };
178                let binder = self.binder.clone();
179                P::spawn(
180                  move || binder.submit_transact(transactions::r#setHostProxy, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL),
181                  move |_aidl_reply| async move {
182                    self.read_response_setHostProxy(_arg_proxy, _aidl_reply)
183                  }
184                )
185              }
186              fn r#trustedAppUuids<'a, >(&'a self) -> binder::BoxFuture<'a, binder::Result<Vec<String>>> {
187                let _aidl_data = match self.build_parcel_trustedAppUuids() {
188                  Ok(_aidl_data) => _aidl_data,
189                  Err(err) => return Box::pin(std::future::ready(Err(err))),
190                };
191                let binder = self.binder.clone();
192                P::spawn(
193                  move || binder.submit_transact(transactions::r#trustedAppUuids, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL),
194                  move |_aidl_reply| async move {
195                    self.read_response_trustedAppUuids(_aidl_reply)
196                  }
197                )
198              }
199            }
200            impl IMicrofuchsia for binder::binder_impl::Binder<BnMicrofuchsia> {
201              fn r#setHostProxy<'a, 'l1, >(&'a self, _arg_proxy: &'l1 binder::Strong<dyn crate::mangled::_7_android_6_system_12_microfuchsia_10_vm_service_10_IHostProxy>) -> binder::Result<()> { self.0.r#setHostProxy(_arg_proxy) }
202              fn r#trustedAppUuids<'a, >(&'a self) -> binder::Result<Vec<String>> { self.0.r#trustedAppUuids() }
203            }
204            fn on_transact(_aidl_service: &dyn IMicrofuchsia, _aidl_code: binder::binder_impl::TransactionCode, _aidl_data: &binder::binder_impl::BorrowedParcel<'_>, _aidl_reply: &mut binder::binder_impl::BorrowedParcel<'_>) -> std::result::Result<(), binder::StatusCode> {
205              match _aidl_code {
206                transactions::r#setHostProxy => {
207                  let _arg_proxy: binder::Strong<dyn crate::mangled::_7_android_6_system_12_microfuchsia_10_vm_service_10_IHostProxy> = _aidl_data.read()?;
208                  let _aidl_return = _aidl_service.r#setHostProxy(&_arg_proxy);
209                  match &_aidl_return {
210                    Ok(_aidl_return) => {
211                      _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?;
212                    }
213                    Err(_aidl_status) => _aidl_reply.write(_aidl_status)?
214                  }
215                  Ok(())
216                }
217                transactions::r#trustedAppUuids => {
218                  let _aidl_return = _aidl_service.r#trustedAppUuids();
219                  match &_aidl_return {
220                    Ok(_aidl_return) => {
221                      _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?;
222                      _aidl_reply.write(_aidl_return)?;
223                    }
224                    Err(_aidl_status) => _aidl_reply.write(_aidl_status)?
225                  }
226                  Ok(())
227                }
228                _ => Err(binder::StatusCode::UNKNOWN_TRANSACTION)
229              }
230            }
231            pub(crate) mod mangled {
232             pub use super::r#IMicrofuchsia as _7_android_6_system_12_microfuchsia_10_vm_service_13_IMicrofuchsia;
233            }
234          }
235          pub mod IHostProxy {
236            /*
237             * This file is auto-generated.  DO NOT MODIFY.
238             * Using: host_x64/aidl_gen -a -I ../../src/tee/binder-proxy/aidl --lang=rust -o gen/src/tee/binder-proxy/android_system_microfuchsia_vm_service_aidl --min_sdk_version=31 --structured ../../src/tee/binder-proxy/aidl/android/system/microfuchsia/vm_service/IHostProxy.aidl
239             *
240             * DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
241             * ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
242             * AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
243             */
244            #![forbid(unsafe_code)]
245            #![cfg_attr(rustfmt, rustfmt_skip)]
246            #![allow(non_upper_case_globals)]
247            #![allow(non_snake_case)]
248            #[allow(unused_imports)] use binder::binder_impl::IBinderInternal;
249            use binder::declare_binder_interface;
250            declare_binder_interface! {
251              IHostProxy["android.system.microfuchsia.vm_service.IHostProxy"] {
252                native: BnHostProxy(on_transact),
253                proxy: BpHostProxy {
254                },
255                async: IHostProxyAsync(try_into_local_async),
256              }
257            }
258            pub trait IHostProxy: binder::Interface + Send {
259              fn get_descriptor() -> &'static str where Self: Sized { "android.system.microfuchsia.vm_service.IHostProxy" }
260              fn getDefaultImpl() -> IHostProxyDefaultRef where Self: Sized {
261                DEFAULT_IMPL.lock().unwrap().clone()
262              }
263              fn setDefaultImpl(d: IHostProxyDefaultRef) -> IHostProxyDefaultRef where Self: Sized {
264                std::mem::replace(&mut *DEFAULT_IMPL.lock().unwrap(), d)
265              }
266              fn try_as_async_server<'a>(&'a self) -> Option<&'a (dyn IHostProxyAsyncServer + Send + Sync)> {
267                None
268              }
269            }
270            pub trait IHostProxyAsync<P>: binder::Interface + Send {
271              fn get_descriptor() -> &'static str where Self: Sized { "android.system.microfuchsia.vm_service.IHostProxy" }
272            }
273            #[::async_trait::async_trait]
274            pub trait IHostProxyAsyncServer: binder::Interface + Send {
275              fn get_descriptor() -> &'static str where Self: Sized { "android.system.microfuchsia.vm_service.IHostProxy" }
276            }
277            impl BnHostProxy {
278              /// Create a new async binder service.
279              pub fn new_async_binder<T, R>(inner: T, rt: R, features: binder::BinderFeatures) -> binder::Strong<dyn IHostProxy>
280              where
281                T: IHostProxyAsyncServer + binder::Interface + Send + Sync + 'static,
282                R: binder::binder_impl::BinderAsyncRuntime + Send + Sync + 'static,
283              {
284                struct Wrapper<T, R> {
285                  _inner: T,
286                  _rt: R,
287                }
288                impl<T, R> binder::Interface for Wrapper<T, R> where T: binder::Interface, R: Send + Sync + 'static {
289                  fn as_binder(&self) -> binder::SpIBinder { self._inner.as_binder() }
290                  fn dump(&self, _writer: &mut dyn std::io::Write, _args: &[&std::ffi::CStr]) -> std::result::Result<(), binder::StatusCode> { self._inner.dump(_writer, _args) }
291                }
292                impl<T, R> IHostProxy for Wrapper<T, R>
293                where
294                  T: IHostProxyAsyncServer + Send + Sync + 'static,
295                  R: binder::binder_impl::BinderAsyncRuntime + Send + Sync + 'static,
296                {
297                  fn try_as_async_server(&self) -> Option<&(dyn IHostProxyAsyncServer + Send + Sync)> {
298                    Some(&self._inner)
299                  }
300                }
301                let wrapped = Wrapper { _inner: inner, _rt: rt };
302                Self::new_binder(wrapped, features)
303              }
304              pub fn try_into_local_async<P: binder::BinderAsyncPool + 'static>(_native: binder::binder_impl::Binder<Self>) -> Option<binder::Strong<dyn IHostProxyAsync<P>>> {
305                struct Wrapper {
306                  _native: binder::binder_impl::Binder<BnHostProxy>
307                }
308                impl binder::Interface for Wrapper {}
309                impl<P: binder::BinderAsyncPool> IHostProxyAsync<P> for Wrapper {
310                }
311                if _native.try_as_async_server().is_some() {
312                  Some(binder::Strong::new(Box::new(Wrapper { _native }) as Box<dyn IHostProxyAsync<P>>))
313                } else {
314                  None
315                }
316              }
317            }
318            pub trait IHostProxyDefault: Send + Sync {
319            }
320            pub mod transactions {
321            }
322            pub type IHostProxyDefaultRef = Option<std::sync::Arc<dyn IHostProxyDefault>>;
323            static DEFAULT_IMPL: std::sync::Mutex<IHostProxyDefaultRef> = std::sync::Mutex::new(None);
324            impl BpHostProxy {
325            }
326            impl IHostProxy for BpHostProxy {
327            }
328            impl<P: binder::BinderAsyncPool> IHostProxyAsync<P> for BpHostProxy {
329            }
330            impl IHostProxy for binder::binder_impl::Binder<BnHostProxy> {
331            }
332            fn on_transact(_aidl_service: &dyn IHostProxy, _aidl_code: binder::binder_impl::TransactionCode, _aidl_data: &binder::binder_impl::BorrowedParcel<'_>, _aidl_reply: &mut binder::binder_impl::BorrowedParcel<'_>) -> std::result::Result<(), binder::StatusCode> {
333              match _aidl_code {
334                _ => Err(binder::StatusCode::UNKNOWN_TRANSACTION)
335              }
336            }
337            pub(crate) mod mangled {
338             pub use super::r#IHostProxy as _7_android_6_system_12_microfuchsia_10_vm_service_10_IHostProxy;
339            }
340          }
341        }
342      }
343    }
344  }
345}
346pub mod mangled {
347  pub use super::aidl::android::system::microfuchsia::vm_service::IMicrofuchsia::mangled::*;
348  pub use super::aidl::android::system::microfuchsia::vm_service::IHostProxy::mangled::*;
349}