binder_tokio: only use threadpool for new transactions

The binder kernel driver will detect whether a binder transaction is
started from a thread that is already handling a transaction, and if-so,
use some special logic to avoid deadlocks. This CL makes the async Rust
wrapper check whether we are handling a transaction before offloading
transactions to the `spawn_blocking` thread pool. This avoids breaking
the deadlock prevention in the kernel.

Test: m
Change-Id: If2707c464a4043c80bd893314113b65ef4633baf
diff --git a/libs/binder/rust/src/native.rs b/libs/binder/rust/src/native.rs
index e183ea3..b7c7ae4 100644
--- a/libs/binder/rust/src/native.rs
+++ b/libs/binder/rust/src/native.rs
@@ -517,3 +517,12 @@
 }
 
 impl Interface for () {}
+
+/// Determine whether the current thread is currently executing an incoming
+/// transaction.
+pub fn is_handling_transaction() -> bool {
+    unsafe {
+        // Safety: This method is always safe to call.
+        sys::AIBinder_isHandlingTransaction()
+    }
+}