Fix consumer closed input channel cause an error occurred (1/2)

An input channel specifies the file descriptors used to send input
events to a window in another process. And All of the file descriptors
open in the calling process shall be closed when process terminated.

The server side could receive the socket broken event when the process
terminated, we should do the unregister channel before close the file
descriptor or do it automatically without error if there is no valid
window.

- Change the order that remove window before dispose the receiver.
- Unregister input channel when windowless window removed.

Bug: 133782251
Test: open app and exit by back key or recent apps, check if any
      error log occurs.
Change-Id: I59d0084c2c771544e7ee226ce53c574f60c6b988
4 files changed