nativewindow: Misc. improvements for AHardwareBuffer Rust wrapper
Changes include:
- Rename AHardwareBuffer to HardwareBuffer
- Expose AHardwareBuffer as a raw pointer type
- Making HardwareBuffer Send
- HardwareBuffer now derives Debug, PartialEq and Eq
- Use NonNull instead of a *mut pointer
- Adding an into_raw function to match from_raw
- Adding a Clone impl that acquires a ref
Bug: 296449936, 296100790
Test: atest libnativewindow_rs-internal_test
Change-Id: Iaf916fabe49190f47abd1a9ed34afdb76fd20e40
diff --git a/libs/bufferstreams/rust/src/lib.rs b/libs/bufferstreams/rust/src/lib.rs
index 87f3104..5964281 100644
--- a/libs/bufferstreams/rust/src/lib.rs
+++ b/libs/bufferstreams/rust/src/lib.rs
@@ -159,7 +159,7 @@
/// Struct used to contain the buffer.
pub struct Frame {
/// A handle to the C buffer interface.
- pub buffer: AHardwareBuffer,
+ pub buffer: HardwareBuffer,
/// The time at which the buffer was dispatched.
pub present_time: Instant,
/// A fence used for reading/writing safely.
diff --git a/libs/bufferstreams/rust/src/stream_config.rs b/libs/bufferstreams/rust/src/stream_config.rs
index d0c621b..454bdf1 100644
--- a/libs/bufferstreams/rust/src/stream_config.rs
+++ b/libs/bufferstreams/rust/src/stream_config.rs
@@ -33,9 +33,9 @@
}
impl StreamConfig {
- /// Tries to create a new AHardwareBuffer from settings in a [StreamConfig].
- pub fn create_hardware_buffer(&self) -> Option<AHardwareBuffer> {
- AHardwareBuffer::new(self.width, self.height, self.layers, self.format, self.usage)
+ /// Tries to create a new HardwareBuffer from settings in a [StreamConfig].
+ pub fn create_hardware_buffer(&self) -> Option<HardwareBuffer> {
+ HardwareBuffer::new(self.width, self.height, self.layers, self.format, self.usage)
}
}