dumpsys: use a socket for dumping, add timeout support.
Passing the stdout file descriptor directly to a service to dump with
leads to bad things happening if the service hangs, or dumpsys is
terminated prematurely. For example, `dumpsys foo | cat` will not
terminate, even if the dumpsys process is killed, since the write end of
the pipe is still alive in the hung service.
Pass an intermediate socketpair when dumping services to avoid this.
Bug: http://b/
26849443
Change-Id: Ide18741080355b3c680275a59172c61734eca92d