summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alice Ryhl <aliceryhl@google.com> 2023-07-25 21:04:50 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-07-25 21:04:50 +0000
commit3bac47efeee82d994fcbf7fc9f500e5fedb48c3d (patch)
tree7b01d471e6fcff7f255775d0ae82c1c7cc5307be
parent587dfb191e62a4d28272a776d59eb11d9cb54096 (diff)
parent7b9570b304ac25412e1bb7e51886d4e8bb1a6702 (diff)
Merge "Fix unimplemented codepath in conversion to async binder interface" into main am: c1c1e6e83e am: ae58d47573 am: 7b9570b304
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2673278 Change-Id: Ib41a750a69510be54adb8cc1d7f6d983637525c9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libs/binder/rust/binder_tokio/lib.rs7
-rw-r--r--libs/binder/rust/src/binder.rs12
2 files changed, 7 insertions, 12 deletions
diff --git a/libs/binder/rust/binder_tokio/lib.rs b/libs/binder/rust/binder_tokio/lib.rs
index 2d2bf7c582..1dc0b2471d 100644
--- a/libs/binder/rust/binder_tokio/lib.rs
+++ b/libs/binder/rust/binder_tokio/lib.rs
@@ -103,7 +103,12 @@ impl BinderAsyncPool for Tokio {
//
// This shouldn't cause issues with blocking the thread as only one task will run in a
// call to `block_on`, so there aren't other tasks to block.
- let result = spawn_me();
+ //
+ // If the `block_in_place` call fails, then you are driving a current-thread runtime on
+ // the binder threadpool. Instead, it is recommended to use `TokioRuntime<Handle>` when
+ // the runtime is a current-thread runtime, as the current-thread runtime can be driven
+ // only by `Runtime::block_on` calls and not by `Handle::block_on`.
+ let result = tokio::task::block_in_place(spawn_me);
Box::pin(after_spawn(result))
} else {
let handle = tokio::task::spawn_blocking(spawn_me);
diff --git a/libs/binder/rust/src/binder.rs b/libs/binder/rust/src/binder.rs
index 0bd0781cf4..463c210316 100644
--- a/libs/binder/rust/src/binder.rs
+++ b/libs/binder/rust/src/binder.rs
@@ -1023,17 +1023,7 @@ macro_rules! declare_binder_interface {
}
if ibinder.associate_class(<$native as $crate::binder_impl::Remotable>::get_class()) {
- let service: std::result::Result<$crate::binder_impl::Binder<$native>, $crate::StatusCode> =
- std::convert::TryFrom::try_from(ibinder.clone());
- if let Ok(service) = service {
- // We were able to associate with our expected class and
- // the service is local.
- todo!()
- //return Ok($crate::Strong::new(Box::new(service)));
- } else {
- // Service is remote
- return Ok($crate::Strong::new(Box::new(<$proxy as $crate::binder_impl::Proxy>::from_binder(ibinder)?)));
- }
+ return Ok($crate::Strong::new(Box::new(<$proxy as $crate::binder_impl::Proxy>::from_binder(ibinder)?)));
}
Err($crate::StatusCode::BAD_TYPE.into())