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