Use hidl_handle instead of native_handle_t*.
To ensure 32/64 compatibility.
Bug: 32089785
Test: builds
Change-Id: Ie86e5734c4a66db7dddd9e93f6dd26990f245d71
diff --git a/services/surfaceflinger/DisplayHardware/ComposerHal.cpp b/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
index 128e2b0..06f67ba 100644
--- a/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
+++ b/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
@@ -26,6 +26,7 @@
using hardware::Return;
using hardware::hidl_vec;
+using hardware::hidl_handle;
namespace Hwc2 {
@@ -39,14 +40,14 @@
mHandle = (buffer) ? buffer : native_handle_init(mStorage, 0, 0);
}
- operator const native_handle_t*() const
+ operator const hidl_handle&() const
{
return mHandle;
}
private:
NATIVE_HANDLE_DECLARE_STORAGE(mStorage, 0, 0);
- const native_handle_t* mHandle;
+ hidl_handle mHandle;
};
class FenceHandle
@@ -55,13 +56,15 @@
FenceHandle(int fd, bool owned)
: mOwned(owned)
{
+ native_handle_t* handle;
if (fd >= 0) {
- mHandle = native_handle_init(mStorage, 1, 0);
- mHandle->data[0] = fd;
+ handle = native_handle_init(mStorage, 1, 0);
+ handle->data[0] = fd;
} else {
// nullptr is not a valid handle to HIDL
- mHandle = native_handle_init(mStorage, 0, 0);
+ handle = native_handle_init(mStorage, 0, 0);
}
+ mHandle = handle;
}
~FenceHandle()
@@ -71,7 +74,7 @@
}
}
- operator const native_handle_t*() const
+ operator const hidl_handle&() const
{
return mHandle;
}
@@ -79,7 +82,7 @@
private:
bool mOwned;
NATIVE_HANDLE_DECLARE_STORAGE(mStorage, 1, 0);
- native_handle_t* mHandle;
+ hidl_handle mHandle;
};
// assume NO_RESOURCES when Status::isOk returns false