Set dataspace to native window

Following ag/17264070, codec2 should also set the dataspace to native
window. That will allow the driver to query the consumer-requested
dataspace and configure the bufferqueue appropriately prior to rendering.

Bug: 232748666
Fix: 240709246
Test: atest android.media.codec.cts.EncodeDecodeTest
Test: atest android.media.codec.cts.DecodeEditEncodeTest
Change-Id: I412639b32ac371beee14e48b7b0949dd87a7439f
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.cpp b/media/codec2/sfplugin/CCodecBufferChannel.cpp
index 5ecb130..3ca263f 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.cpp
+++ b/media/codec2/sfplugin/CCodecBufferChannel.cpp
@@ -960,9 +960,9 @@
                     hdrDynamicInfo->m.data + hdrDynamicInfo->flexCount());
         }
         qbi.setHdrMetadata(hdr);
-
-        SetHdrMetadataToGralloc4Handle(hdrStaticInfo, hdrDynamicInfo, block.handle());
     }
+    SetMetadataToGralloc4Handle(dataSpace, hdrStaticInfo, hdrDynamicInfo, block.handle());
+
     // we don't have dirty regions
     qbi.setSurfaceDamage(Region::INVALID_REGION);
     android::IGraphicBufferProducer::QueueBufferOutput qbo;