gralloc1: Fixes for hidl
* Fix capabilities check
* Use unique ID for backing store per the hidl spec
CRs-Fixed: 2009826
Change-Id: Ifc2be98a00dc3b0e4fd4e3e4c8d343de6afd8560
diff --git a/libgralloc1/gr_device_impl.cpp b/libgralloc1/gr_device_impl.cpp
index 121d0cf..2bb66d1 100644
--- a/libgralloc1/gr_device_impl.cpp
+++ b/libgralloc1/gr_device_impl.cpp
@@ -100,16 +100,13 @@
}
void GrallocImpl::GetCapabilities(struct gralloc1_device *device, uint32_t *out_count,
- int32_t /*gralloc1_capability_t*/ *out_capabilities) {
- if (!device) {
- // Need to plan for adding more capabilities
- if (out_capabilities == NULL) {
- *out_count = 1;
- } else {
- *out_capabilities = GRALLOC1_CAPABILITY_TEST_ALLOCATE;
+ int32_t /*gralloc1_capability_t*/ *out_capabilities) {
+ if (device != nullptr) {
+ if (out_capabilities != nullptr && *out_count > 0) {
+ out_capabilities[0] = GRALLOC1_CAPABILITY_TEST_ALLOCATE;
}
+ *out_count = 1;
}
-
return;
}