diff options
| author | 2022-01-24 22:18:14 +0000 | |
|---|---|---|
| committer | 2022-01-24 22:18:14 +0000 | |
| commit | 203ff82d2a9facf917bef23eec85f19eafdd5caa (patch) | |
| tree | 369759b104e22a68d48b4a3d32ed2c3522caafb2 | |
| parent | 6923f9cdcb6299f99b7db87025d4f81b48380cfc (diff) | |
| parent | 9db4c13d0e3e802da54b3772e8792adb3b011f9b (diff) | |
Merge "[binder] Move Rust ping_binder() to external API" am: 13a5e9c010 am: 69f071e60e am: 9d1cbca87b am: 9db4c13d0e
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1956718
Change-Id: I0f858c349486cb2a21920ea24f6db46d56551d4a
| -rw-r--r-- | libs/binder/rust/src/binder.rs | 6 | ||||
| -rw-r--r-- | libs/binder/rust/src/proxy.rs | 22 |
2 files changed, 14 insertions, 14 deletions
diff --git a/libs/binder/rust/src/binder.rs b/libs/binder/rust/src/binder.rs index 7895a7293d..467e51e276 100644 --- a/libs/binder/rust/src/binder.rs +++ b/libs/binder/rust/src/binder.rs @@ -192,9 +192,6 @@ pub trait IBinderInternal: IBinder { /// Is this object still alive? fn is_binder_alive(&self) -> bool; - /// Send a ping transaction to this object - 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); @@ -270,6 +267,9 @@ pub trait IBinder { /// The recipient will no longer be called if this object /// dies. fn unlink_to_death(&mut self, recipient: &mut DeathRecipient) -> Result<()>; + + /// Send a ping transaction to this object + fn ping_binder(&mut self) -> Result<()>; } /// Opaque reference to the type of a Binder interface. diff --git a/libs/binder/rust/src/proxy.rs b/libs/binder/rust/src/proxy.rs index 760d862c53..12bfde755e 100644 --- a/libs/binder/rust/src/proxy.rs +++ b/libs/binder/rust/src/proxy.rs @@ -312,17 +312,6 @@ impl<T: AsNative<sys::AIBinder>> IBinderInternal for T { } } - fn ping_binder(&mut self) -> Result<()> { - let status = unsafe { - // Safety: `SpIBinder` guarantees that `self` always contains a - // valid pointer to an `AIBinder`. - // - // This call does not affect ownership of its pointer parameter. - sys::AIBinder_ping(self.as_native_mut()) - }; - status_result(status) - } - #[cfg(not(android_vndk))] fn set_requesting_sid(&mut self, enable: bool) { unsafe { sys::AIBinder_setRequestingSid(self.as_native_mut(), enable) }; @@ -412,6 +401,17 @@ impl<T: AsNative<sys::AIBinder>> IBinder for T { ) }) } + + fn ping_binder(&mut self) -> Result<()> { + let status = unsafe { + // Safety: `SpIBinder` guarantees that `self` always contains a + // valid pointer to an `AIBinder`. + // + // This call does not affect ownership of its pointer parameter. + sys::AIBinder_ping(self.as_native_mut()) + }; + status_result(status) + } } impl Serialize for SpIBinder { |