Fix BufferHubBuffer black screen

1/ BufferHubService should read back fields of
HardwareBufferDescription of allocated BufferNode and send them back
to the client.
2/ Update some minor naming for better readability.

Bug: 122959735
Test: cts-tradefed run commandAndExit cts -m CtsNativeHardwareTestCases
Change-Id: I10a176810d78c754fe0b69d4128078fc17d50035
diff --git a/services/bufferhub/BufferHubService.cpp b/services/bufferhub/BufferHubService.cpp
index 90ac1c2..ade08e7 100644
--- a/services/bufferhub/BufferHubService.cpp
+++ b/services/bufferhub/BufferHubService.cpp
@@ -73,7 +73,13 @@
             buildBufferInfo(bufferInfoStorage, node->id(), node->addNewActiveClientsBitToMask(),
                             node->userMetadataSize(), node->metadata().ashmemFd(),
                             node->eventFd().get());
-    BufferTraits bufferTraits = {/*bufferDesc=*/description,
+    // During the gralloc allocation carried out by BufferNode, gralloc allocator will populate the
+    // fields of its HardwareBufferDescription (i.e. strides) according to the actual
+    // gralloc implementation. We need to read those fields back and send them to the client via
+    // BufferTraits.
+    HardwareBufferDescription allocatedBufferDesc;
+    memcpy(&allocatedBufferDesc, &node->bufferDesc(), sizeof(AHardwareBuffer_Desc));
+    BufferTraits bufferTraits = {/*bufferDesc=*/allocatedBufferDesc,
                                  /*bufferHandle=*/hidl_handle(node->bufferHandle()),
                                  /*bufferInfo=*/std::move(bufferInfo)};