Fix temporary stretching when Surface is resized with Vulkan

Set NATIVE_WINDOW_SCALING_MODE_FREEZE scaling mode on the surface
after Vulkan swapchain is created. This is the scaling mode used
by GL as well. Window resize flow depends on preserving this
behavior, because SurfaceComposerClient::Transaction::setSize
calls are not postponed until a new buffer is enqueued.

Test: StatusBar is resized correctly without any glitch.
Bug: 118501234
Change-Id: Icfb6805bc362a742e14b993a0b825e5447d6eeb4
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp
index 2abb3d5..4be8bd9 100644
--- a/libs/hwui/renderthread/VulkanManager.cpp
+++ b/libs/hwui/renderthread/VulkanManager.cpp
@@ -831,6 +831,11 @@
 
     createBuffers(surface, surfaceFormat, extent);
 
+    // The window content is not updated (frozen) until a buffer of the window size is received.
+    // This prevents temporary stretching of the window after it is resized, but before the first
+    // buffer with new size is enqueued.
+    native_window_set_scaling_mode(surface->mNativeWindow, NATIVE_WINDOW_SCALING_MODE_FREEZE);
+
     return true;
 }