git clone https://android.googlesource.com/platform/system/adb
There are three components in ADB: Client, AdbServer, Adb Daemon. Client and AdbServer always run on your PC, Adb Daemon (adbd) run on your Android device.
When you input adb connect <serial>
, why connection state become device
or offline
. There are 1 + 2 * N
threads in AdbServer, every connection has a atransport object, every transport has two threads.
ADB Daemon will do something to check auth permission before send CNXN
Packet to AdbServer.
When you input adb -s <serial> <command>
, command may be shell
or others.