android_adb: add Android ADB backend

The Android adbd daemon running inside Android VMs on the emulator
expect to be able to talk to a backend named "qemud:adb" (for historical
reasons).

The backend will carry out a handshake:
 1. Listen for connections from the host adb server on
    adb_port = <5555 + (2 * emulator instance id)>.
 2. Connect to the local adb server on port 5037 if it's available.
 3. Listen for and accept the beginning of the handshake with the adbd
    daemon (adbd sends 'accept' over the write).
 4. After the adb backend detects a connection on <adb_port>, it sends
    back an "ok" string to adbd.
 5. The adb backend will not send any more data over the pipe until it
    recognizes a 'start' request, which means the adbd is ready to
    receive data from the host ADB server.

Once the above process is complete, the adb backend will consume
everything it receives on the socket connected on <adb_port> and send it
over the adb pipe and will consume everything it receives over the adb
pipe and send it on the socket connected on <adb_port>.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
[AJB: Bunch of clean-up/re-factoring to GIOChannel code]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
3 files changed
tree: ad62a939a7deb426126d858147214a930f50a832
  1. audio/
  2. backends/
  3. block/
  4. bsd-user/
  5. default-configs/
  6. disas/
  7. docs/
  8. fpu/
  9. fsdev/
  10. gdb-xml/
  11. hw/
  12. include/
  13. libcacard/
  14. linux-headers/
  15. linux-user/
  16. net/
  17. pc-bios/
  18. po/
  19. qapi/
  20. qga/
  21. qobject/
  22. qom/
  23. roms/
  24. scripts/
  25. slirp/
  26. stubs/
  27. sysconfigs/
  28. target-alpha/
  29. target-arm/
  30. target-cris/
  31. target-i386/
  32. target-lm32/
  33. target-m68k/
  34. target-microblaze/
  35. target-mips/
  36. target-moxie/
  37. target-openrisc/
  38. target-ppc/
  39. target-s390x/
  40. target-sh4/
  41. target-sparc/
  42. target-unicore32/
  43. target-xtensa/
  44. tcg/
  45. tests/
  46. trace/
  47. ui/
  48. util/
  49. .exrc
  50. .gitignore
  51. .gitmodules
  52. .mailmap
  53. .travis.yml
  54. aio-posix.c
  55. aio-win32.c
  56. android-commands.h
  57. android-console.c
  58. android-console.h
  59. arch_init.c
  60. async.c
  61. balloon.c
  62. block-migration.c
  63. block.c
  64. blockdev-nbd.c
  65. blockdev.c
  66. blockjob.c
  67. bt-host.c
  68. bt-vhci.c
  69. Changelog
  70. CODING_STYLE
  71. configure
  72. COPYING
  73. COPYING.LIB
  74. coroutine-gthread.c
  75. coroutine-sigaltstack.c
  76. coroutine-ucontext.c
  77. coroutine-win32.c
  78. cpu-exec.c
  79. cpus.c
  80. cputlb.c
  81. device-hotplug.c
  82. device_tree.c
  83. disas.c
  84. dma-helpers.c
  85. dump.c
  86. exec.c
  87. gdbstub.c
  88. HACKING
  89. hmp-commands.hx
  90. hmp.c
  91. hmp.h
  92. iohandler.c
  93. ioport.c
  94. iothread.c
  95. kvm-all.c
  96. kvm-stub.c
  97. LICENSE
  98. main-loop.c
  99. MAINTAINERS
  100. Makefile
  101. Makefile.objs
  102. Makefile.target
  103. memory.c
  104. memory_mapping.c
  105. migration-exec.c
  106. migration-fd.c
  107. migration-rdma.c
  108. migration-tcp.c
  109. migration-unix.c
  110. migration.c
  111. module-common.c
  112. monitor.c
  113. nbd.c
  114. os-posix.c
  115. os-win32.c
  116. page_cache.c
  117. qapi-schema.json
  118. qdev-monitor.c
  119. qdict-test-data.txt
  120. qemu-bridge-helper.c
  121. qemu-char.c
  122. qemu-coroutine-io.c
  123. qemu-coroutine-lock.c
  124. qemu-coroutine-sleep.c
  125. qemu-coroutine.c
  126. qemu-doc.texi
  127. qemu-file.c
  128. qemu-img-cmds.hx
  129. qemu-img.c
  130. qemu-img.texi
  131. qemu-io-cmds.c
  132. qemu-io.c
  133. qemu-log.c
  134. qemu-nbd.c
  135. qemu-nbd.texi
  136. qemu-options-wrapper.h
  137. qemu-options.h
  138. qemu-options.hx
  139. qemu-seccomp.c
  140. qemu-tech.texi
  141. qemu-timer.c
  142. qemu.nsi
  143. qemu.sasl
  144. qmp-commands.hx
  145. qmp.c
  146. qtest.c
  147. README
  148. rules.mak
  149. savevm.c
  150. spice-qemu-char.c
  151. tcg-runtime.c
  152. tci.c
  153. thread-pool.c
  154. thunk.c
  155. tpm.c
  156. trace-events
  157. translate-all.c
  158. translate-all.h
  159. user-exec.c
  160. VERSION
  161. version.rc
  162. vl.c
  163. vmstate.c
  164. xbzrle.c
  165. xen-common-stub.c
  166. xen-common.c
  167. xen-hvm-stub.c
  168. xen-hvm.c
  169. xen-mapcache.c