Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70e475a5 authored by Matthew Maurer's avatar Matthew Maurer Committed by Automerger Merge Worker
Browse files

Merge "Implement Debug for a few Binder Rust types" am: 5defed6e am: 9fc032aa

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1397072

Change-Id: I8f75c6dc5c14b8c986597ccffa17581dc1f025f0
parents ff9fd7ef 9fc032aa
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -581,5 +581,11 @@ macro_rules! declare_binder_interface {
                parcel.write(&this.map($crate::Interface::as_binder))
            }
        }

        impl std::fmt::Debug for dyn $interface {
            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                f.pad(stringify!($interface))
            }
        }
    };
}
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ use std::fs::File;
use std::os::unix::io::{AsRawFd, FromRawFd};

/// Rust version of the Java class android.os.ParcelFileDescriptor
#[derive(Debug)]
pub struct ParcelFileDescriptor(File);

impl ParcelFileDescriptor {
+7 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ use crate::sys;

use std::convert::TryInto;
use std::ffi::{c_void, CString};
use std::fmt;
use std::os::unix::io::AsRawFd;
use std::ptr;

@@ -37,6 +38,12 @@ use std::ptr;
/// is untyped; typed interface access is implemented by the AIDL compiler.
pub struct SpIBinder(*mut sys::AIBinder);

impl fmt::Debug for SpIBinder {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        f.pad("SpIBinder")
    }
}

/// # Safety
///
/// An `SpIBinder` is a handle to a C++ IBinder, which is thread-safe