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