Add metadata for mouse cursor.
Mouse cursor metadata is stored in a parcel with a int32_t for mouse
cursor type, and two floats for mouse hotspotX/Y. Therefore move the
parcel to byte vector conversion into SurfaceComposerClient. If anyone
needs to store metadata in raw byte vector we can change the interface
later.
Bug: 130822623
Test: SurfaceFlinger can get cursor type and hotspot.
Change-Id: Ia7e0c952fcaefd14280322d9b2269f4dba38e8da
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index e6b1beb..40621e3 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -795,14 +795,15 @@
}
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setMetadata(
- const sp<SurfaceControl>& sc, uint32_t key, std::vector<uint8_t> data) {
+ const sp<SurfaceControl>& sc, uint32_t key, const Parcel& p) {
layer_state_t* s = getLayerState(sc);
if (!s) {
mStatus = BAD_INDEX;
return *this;
}
s->what |= layer_state_t::eMetadataChanged;
- s->metadata.mMap[key] = std::move(data);
+
+ s->metadata.mMap[key] = {p.data(), p.data() + p.dataSize()};
registerSurfaceControlForCallback(sc);
return *this;