Pass bits per pixel tu UI when it gets attached to core framebuffer
Instead of passing bits per pixel property in each and every framebuffer notification
message, do it once when UI attaches to the core's framebuffer service.
Change-Id: Ic1f6d9796b64d40518f09f5a5341f8359ff817b7
diff --git a/android/console.c b/android/console.c
index 398218a..a89d0e1 100644
--- a/android/console.c
+++ b/android/console.c
@@ -2518,10 +2518,14 @@
return -1;
}
- core_fb = corefb_create(client->sock, protocol);
+ core_fb = corefb_create(client->sock, protocol, coredisplay_get_framebuffer());
if (!coredisplay_attach_fb_service(core_fb)) {
+ char reply_buf[4096];
framebuffer_client = client;
- control_write( client, "OK\r\n");
+ // Reply "OK" with the framebuffer's bits per pixel
+ snprintf(reply_buf, sizeof(reply_buf), "OK: -bitsperpixel=%d\r\n",
+ corefb_get_bits_per_pixel(core_fb));
+ control_write( client, reply_buf);
} else {
control_write( client, "KO\r\n" );
control_client_destroy(client);