Send screen parameters once per connection
The cutf_cvm hwcomposer HAL only reads the screen
parameters (resolution, dpi, etc) once per connection, so it should
not be sent more than once.
Bug: 134972437
Test: run locally
Change-Id: I9c87dce74ab4a913c1899eca8970979f6f3fcdf5
diff --git a/host/frontend/vnc_server/screen_connector.cpp b/host/frontend/vnc_server/screen_connector.cpp
index 1b9b900..4551450 100644
--- a/host/frontend/vnc_server/screen_connector.cpp
+++ b/host/frontend/vnc_server/screen_connector.cpp
@@ -89,10 +89,14 @@
int current_buffer = 0;
while (1) {
+ LOG(INFO) << "Screen Connector accepting connections...";
auto conn = SharedFD::Accept(*server);
+ if (!conn->IsOpen()) {
+ LOG(ERROR) << "Disconnected fd returned from accept";
+ continue;
+ }
+ SendScreenParameters(conn);
while (conn->IsOpen()) {
- SendScreenParameters(conn);
-
int32_t size = 0;
conn->Read(&size, sizeof(size));
auto buff = reinterpret_cast<uint8_t*>(GetBuffer(current_buffer));