Fix framebuffer and user events service disconnection bug.
FB and UE services overwrite the socket's read callbacks, making the console
unavare of the fact that console client gets disconnected. As the result,
console clients for FB and UE stays alive after UI has exited, making it
impossible to attach another UI. To fix this, we add socket read callbacks
to the FB and UE service that monitor the disconnection event and destroy
their console clients on such events.
Change-Id: I82e714f33ccc81bc04ca47eda6fbb8fab4a313f9
diff --git a/android/console.c b/android/console.c
index 6f9e26b..4c3548a 100644
--- a/android/console.c
+++ b/android/console.c
@@ -2550,6 +2550,14 @@
return 0;
}
+void
+destroy_control_fb_client(void)
+{
+ if (framebuffer_client != NULL) {
+ control_client_destroy(framebuffer_client);
+ }
+}
+
static int
do_create_user_events_service( ControlClient client, char* args )
{
@@ -2575,6 +2583,14 @@
return 0;
}
+
+void
+destroy_control_ue_client(void)
+{
+ if (user_events_client != NULL) {
+ control_client_destroy(user_events_client);
+ }
+}
#endif // CONFIG_STANDALONE_CORE
static const CommandDefRec qemu_commands[] =