summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2021-09-29 16:25:49 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-09-29 16:25:49 +0000
commit3c064e40ac90ac2243f6807c0938f80b0d6396da (patch)
treeaa55ae27b461b3ae61f82ff080a749c93043e5b9
parent708f9aa0f552a64e3f04550a84ea757b89cb370a (diff)
parent05933f79256550d27a9e1c55b1f0b7984ed19fe4 (diff)
downloadnative-3c064e40ac90ac2243f6807c0938f80b0d6396da.tar.gz
Merge "Document functions that may panic." am: 05933f7925
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1834433 Change-Id: Ia733525c6d0f6ba128e6762a19ea76e398ff1a1c
-rw-r--r--libs/binder/rust/src/native.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/libs/binder/rust/src/native.rs b/libs/binder/rust/src/native.rs
index e7c33960e2..a91092e2d4 100644
--- a/libs/binder/rust/src/native.rs
+++ b/libs/binder/rust/src/native.rs
@@ -441,6 +441,8 @@ unsafe impl<B: Remotable> AsNative<sys::AIBinder> for Binder<B> {
///
/// Registers the given binder object with the given identifier. If successful,
/// this service can then be retrieved using that identifier.
+///
+/// This function will panic if the identifier contains a 0 byte (NUL).
pub fn add_service(identifier: &str, mut binder: SpIBinder) -> Result<()> {
let instance = CString::new(identifier).unwrap();
let status = unsafe {
@@ -462,6 +464,8 @@ pub fn add_service(identifier: &str, mut binder: SpIBinder) -> Result<()> {
///
/// If any service in the process is registered as lazy, all should be, otherwise
/// the process may be shut down while a service is in use.
+///
+/// This function will panic if the identifier contains a 0 byte (NUL).
pub fn register_lazy_service(identifier: &str, mut binder: SpIBinder) -> Result<()> {
let instance = CString::new(identifier).unwrap();
let status = unsafe {