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