GraphicsTracker: ensure migrated buffers are overwritten

During rendering decoded GraphicBuffers, if a GraphicBuffer is not from
the current surface the buffer is attached to the current surface.

Those attached buffers are cached in GraphicsTracker. But if the
specified slot for the buffer has a stale buffer, the buffer is not
overwritten to the cache currently.

Ensure those attached buffers are overwritten to the current cache.

Bug: 357973422
Flag: EXEMPT bugfix
Test: presubmit
Change-Id: Ia51305b0941706dabfae1646be81cabff6d52d3c
diff --git a/media/codec2/hal/client/GraphicsTracker.cpp b/media/codec2/hal/client/GraphicsTracker.cpp
index 8d9e76e..e1193cc 100644
--- a/media/codec2/hal/client/GraphicsTracker.cpp
+++ b/media/codec2/hal/client/GraphicsTracker.cpp
@@ -900,7 +900,10 @@
         cache->unblockSlot(buffer->mSlot);
         if (oldBuffer) {
             // migrated, register the new buffer to the cache.
-            cache->mBuffers.emplace(buffer->mSlot, buffer);
+            auto ret = cache->mBuffers.emplace(buffer->mSlot, buffer);
+            if (!ret.second) {
+                ret.first->second = buffer;
+            }
         }
     }
     mDeallocating.erase(origBid);