Android KitCat 4.4.2 ADB 官方所支援的所有Services格式翻譯

來源:互聯網
上載者:User

Android KitCat 4.4.2 ADB 官方所支援的所有Services格式翻譯

在之前的文章中有轉帖網上同行製作的ADB協議表格<>,但不夠詳盡,所以這裡自己另外基於Android 4.4.2的技術文檔重新做一次翻譯。

HOST SERVICES:主機服務:host:version Ask the ADB server for its internal version number. As a special exception, the server will respond with a 4-byte hex string corresponding to its internal version number, without any OKAY or FAIL.

向ADB伺服器請求其組建號。作為一個協議中的例外(請查看OVERVIEW.txt來查看ADB具體協議規則),伺服器會返回一個代表其組建號的4位元組的十六進位字串,而不會像標準協議中會返回OKAY或者FAIL

host:kill Ask the ADB server to quit immediately. This is used when the ADB client detects that an obsolete server is running after an upgrade.
請求ADB伺服器立刻退出。當ADB升級完成後,如果ADB用戶端檢測到之前已經過時的ADB伺服器還在啟動並執行時候會發送這個請求。

host:devices
host:devices-l Ask to return the list of available Android devices and their state. devices-l includes the device paths in the state. After the OKAY, this is followed by a 4-byte hex len, and a string that will be dumped as-is by the client, then the connection is closed

這兩個服務要求是類似的,都是請求ADB伺服器返回一系列有效安卓裝置以及對應的狀態資訊,只是devices -l會在狀態資訊中包含該裝置更多的資訊,比如產品型號等。在正常返回OKAY之後,會緊跟著一個代表資料長度的4位元組長的十六進位數,以及對應的如我們通過命令adb devices -l命令能看到的輸出,然後串連請求就會關閉。

host:track-devices This is a variant of host:devices which doesn't close the connection. Instead, a new device list description is sent each time a device is added/removed or the state of a given device changes (hex4 + content). This allows tools like DDMS to track the state of connected devices in real-time without polling the server repeatedly.

這個服務是以上的host:devices的一個變種,用戶端和ADB伺服器的串連會一致保持,當有增加/移除裝置或者裝置狀態改變的時候會主動的往串連上的用戶端發送新的裝置列表資訊(4位元組16進位長度+內容)。這樣做的話就可以允許DDMS這些工具來即時跟蹤所有串連上來的裝置的狀態,而不需要用戶端每次都去串連ADB伺服器擷取對應資訊。

host:emulator: This is a special query that is sent to the ADB server when a new emulator starts up. is a decimal number corresponding to the emulator's ADB control port, i.e. the TCP port that the emulator will forward automatically to the adbd daemon running in the emulator system. This mechanism allows the ADB server to know when new emulator instances start.

這是一個特殊的請求,當一個新的模擬器啟動的時候這個請求將會發送到ADB伺服器。對應的是模擬器的控制連接埠的一個十進位數字,例如本機轉寄到正在啟動並執行模擬器的adbd的對應的那個TCP轉送連接埠。這個機制讓ADB伺服器可以清楚知道有哪個模擬器被啟動起來了。


host:transport: Ask to switch the connection to the device/emulator identified by . After the OKAY response, every client request will be sent directly to the adbd daemon running on the device. (Used to implement the -s option)

請求ADB伺服器切換當前串連到指定的裝置/模擬器。在OKAY應答之後,用戶端的所有請求都會重新導向到該裝置的adbd這個守護進程。(用來實現ADB命令列用戶端的-s選項)


host:transport-usb Ask to switch the connection to one device connected through USB to the host machine. This will fail if there are more than one such devices. (Used to implement the -d convenience option)

請求ADB伺服器切換當前串連到通過USB串連到主機的裝置。如果多於一個裝置通過USB串連到主機,調用將會失敗。(用來實現ADB命令列用戶端的-d這個方便使用的選項)

host:transport-local Ask to switch the connection to one emulator connected through TCP. This will fail if there is more than one such emulator instance running. (Used to implement the -e convenience option)

請求ADB伺服器切換當前串連到一個通過TCP協議串連上來的模擬器。如果多於一個模擬器在啟動並執行話,調用將會失敗。(用來實現-e這個方便使用的選項)

host:transport-any Another host:transport variant. Ask to switch the connection to either the device or emulator connect to/running on the host. Will fail if there is more than one such device/emulator available. (Used when neither -s, -d or -e are provided)

另外一個host:transport的變種。請求ADB伺服器切換當前串連到已經串連上主機的裝置或者正在主機中啟動並執行中模擬器。如果有多於一個這類裝置存在,調用將會失敗。(在-s,-d或-e選項都沒有提供的時候使用)

host-serial:: This is a special form of query, where the 'host-serial::' prefix can be used to indicate that the client is asking the ADB server for information related to a specific device. can be in one of the format described below.

這是一個特殊的請求,首碼"host-serial: :"是用來指定用戶端請求資訊時的目標ADB伺服器所在的一個特定裝置。可以是以下描述的任一方法。

host-usb: A variant of host-serial used to target the single USB device connected to the host. This will fail if there is none or more than one.

host-serial的一個變種,指定的是一個串連上主機的USB裝置。如果沒有或者有多於一個這種裝置的話調用將會失敗。

host-local: A variant of host-serial used to target the single emulator instance running on the host. This will fail if there is none or more than one.

另一個host-serial的變種,這次指定的是一個在主機啟動並執行模擬器。如果沒有或者有多於一個這種裝置的話調用將會失敗。相當於直接執行" adb get-product"或者“adb get-serilano"等

host: When asking for information related to a device, 'host:' can also be interpreted as 'any single device or emulator connected to/running on
the host'.

當通過ADB伺服器向一個相關裝置請求資訊的時候,'host:' 在這種情況下也可以指‘任意一個串連上主機的的裝置或者正在主機上啟動並執行模擬器'。


:get-product XXX

作官方就提供了上面的XXX,沒有更多的資訊。本人在嘗試"adb get-product"時發現並沒有支援。


:get-serialno Returns the serial number of the corresponding device/emulator. Note that emulator serial numbers are of the form "emulator-5554"

返回對應的裝置/模擬器的序號。":"指的是上面三種特殊資訊請求命令。注意模擬器的序號的格式形如"emulator-5554"。類似於命令列執行"adb get-serialno"


:get-devpath Returns the device path of the corresponding device/emulator.

返回對應裝置/模擬器的裝置路徑,這裡的裝置路徑指的是"adb device -l"列出的最後一部分,如"device product:OPPO_12025 model:X909 device:X909"。 ":"指的是上面三種特殊資訊請求命令。類似於命令列執行"adb get-devpath"。


:get-state Returns the state of a given device as a string.

返回一個代表指定裝置狀態的字串,":"指的是上面三種特殊資訊請求命令。類似於命令列執行"adb get-stat"。

:forward:; Asks the ADB server to forward local connections from to the address on a given device.There, can be one of the host-serial/host-usb/host-local/host prefixes as described previously and indicates which device/emulator to target.
請求ADB伺服器把本地指定的串連重新導向到指定裝置的地址。在這裡,""可以是以上描述的用來指定目標裝置/模擬器的host-serial/host-usb/host-local/host。


the format of is one of:

其中的格式可以是以下任一種:

tcp: -> TCP connection on localhost:tcp: -> 本地主機的連接埠的TCP串連 local: -> Unix local domain socket on local: -> 基於地址的本地主機的Unix域通訊端串連(UNIX Domain Socket的地址是一個socket類型的檔案在檔案系統中的路徑)the format of is one of:

的格式如下:

tcp: -> TCP localhost: on devicetcp ->目標裝置的localhost: local: -> Unix local domain socket on devicelocal: -> 目標裝置的本地Unix Domain Socket jdwp: -> JDWP thread on VM process jdwp: -> 目標裝置中進程號指定的JAVA虛擬機器內部的JDWP線程 or even any one of the local services described below.

甚至還支援下面描述的任一個本地服務


:forward:norebind:;

Same as :forward:; except that it will fail it there is already a forward connection from . Used to implement 'adb forward --no-rebind '

類似:forward:; ,有一點區別是如果已經存在的一個轉寄的話調用會失敗。用來實現"adb forward --no-rebind "

:killforward: Remove any existing forward local connection from . This is used to implement 'adb forward --remove '

移除所有指定的本地重新導向串連。用來實現"adb forward --remove :killforward-all

Remove all forward network connections. This is used to implement 'adb forward --remove-all'.

移除所有的重新導向串連。用來實現"adb forward --remove-all"命令

:list-forward List all existing forward connections from this server. This returns something that looks like the following:

列出本機所有存在的轉寄串連。返回格式如下:

: The length of the payload, as 4 hexadecimal chars.: 返回結果長度,由4位元組16進位字元組成 : A series of lines of the following format: " " " " "\n" :Where is a device serial number. is the host-specific endpoint (e.g. tcp:9000). is the device-specific endpoint. : 一連串以下格式的行: " " " " "\n":代表裝置序號。代表主機端的的連接點(比如tcp:90000)。代表裝置端的連接點。

Used to implement 'adb forward --list'.

這是用來實現"adb forward --list"命令的。


LOCAL SERVICES:本地服務: All the queries below assumed that you already switched the transport to a real device, or that you have used a query prefix as described above.

下面的所有請求是建立在你已經把傳輸切換到一個真實裝置上,或者你使用了以上描述的一個query首碼的服務要求

shell:command arg1 arg2 ... Run 'command arg1 arg2 ...' in a shell on the device, and return its output and error streams.

在裝置的shell中運行'command arg1 arg2 ...',並且返回對應輸出和錯誤流。

Note that arguments must be separated by spaces. If an argument contains a space, it must be quoted with double-quotes. Arguments cannot contain double quotes or things will go very wrong.

注意參數必須空格隔開。如果一個參數本身包含空格,那麼它必須要用雙引號引起來。參數內部不能包含雙引號,否則命令執行結果將無法控制。

Note that this is the non-interactive version of "adb shell"

注意這是"adb shell"的一個非互動式版本

shell:

Start an interactive shell session on the device. Redirect stdin/stdout/stderr as appropriate.

開啟裝置的一個互動shell會話。合理的重新導向了標準輸入/標準輸出/標註錯誤。

Note that the ADB server uses this to implement "adb shell", but will also cook the input before sending it to the device (see interactive_shell() in commandline.c)

注意ADB伺服器就是使用這個協議來實現命令列用戶端的"adb shell"請求的,但當然它會先封裝整理好輸入的資訊再發送到目標裝置(請查看commandline.c的interactive_shell())

remount: Ask adbd to remount the device's filesystem in read-write mode, instead of read-only. This is usually necessary before performing an "adb sync" or "adb push" request.
This request may not succeed on certain builds which do not allow that.

請求adbd去重新把裝置唯讀檔案系統掛載成可讀寫入模式的檔案系統。這個在執行"adb sync"或者"adb push"請求之前通常是很有必要先執行的。這個請求在一些版本中也許因為不支援而會失敗

dev:

Opens a device file and connects the client directly to it for read/write purposes. Useful for debugging, but may require special privileges and thus may not run on all devices. is a full path from the root of the filesystem.

開啟一個裝置檔案並通過用戶端串連上該裝置來進行讀寫操作。通常這是用來調試用的,但可能不可以在所有裝置上運行,因為它需要特殊的許可權才能執行。指的是從檔案系統根開始的全路徑。

tcp: Tries to connect to tcp port on localhost.

嘗試串連上原生tcp連接埠

tcp:: Tries to connect to tcp port on machine from the device. This can be useful to debug some networking/proxy issues that can only be revealed on the device itself.

嘗試串連上指定的裝置的tecp連接埠。這對調試只能在裝置上顯示的網路/代理問題很有用。

local: Tries to connect to a Unix domain socket on the device

嘗試串連上裝置上的地址指定的Unix域通訊端

localreserved:
localabstract:
localfilesystem: Variants of local: that are used to access other Android socket namespaces.

local:的幾個變種,用來訪問安卓其他命名空間指定的通訊端。

log: Opens one of the system logs (/dev/log/) and allows the client to read them directly. Used to implement 'adb logcat'. The stream will be read-only for the client.

開啟/dev/log/指定的一個系統日記檔案,並允許用戶端去直接讀取日記資訊。用來實現"adb logcat"這個命令。日記流對用戶端是唯讀。

framebuffer: This service is used to send snapshots of the framebuffer to a client. It requires sufficient privileges but works as follow: After the OKAY, the service sends 16-byte binary structure containing the following fields (little-endian format):

這個服務是用來把framebuffer的截屏快照發送到用戶端的。它需要足夠的許可權,且工作原理如下: 服務在返回OKAY之後會繼續發送16位元組的二進位結構資料的以下內容到用戶端(小位元組序格式)

depth: uint32_t: framebuffer depthdepth: uint32_t: framebuffer 深度 size: uint32_t: framebuffer size in bytessize: uint32_t: framebuffer 大小(位元組) width: uint32_t: framebuffer width in pixelswidth: uint32_t: framebuffer寬度(像素)
height: uint32_t: framebuffer height in pixelsheight: uint32_t: framebuffer 高度(像素)
With the current implementation, depth is always 16, and size is always width*height*2

在當前的實現中,寬度永遠是16,大小用永遠是寬度*高度*2

Then, each time the client wants a snapshot, it should send one byte through the channel, which will trigger the service to send it 'size' bytes of framebuffer data. If the adbd daemon doesn't have sufficient privileges to open the framebuffer device, the connection is simply closed immediately.

每次用戶端想要一個截屏快照時,它將會通過Socket通道發送一個位元組,這會觸發本服務去把framebuffer資料按其大小指定的位元組數發送給用戶端。如果adbd守護進程沒有足夠的許可權開啟framebuffer裝置,那麼串連會立即關閉。

jdwp: Connects to the JDWP thread running in the VM of process .

串連目標裝置中由進程號指定的JAVA虛擬機器進程內部的JDWP線程

track-jdwp This is used to send the list of JDWP pids periodically to the client.

這個服務是用來周期性的往用戶端發送有啟用JDWP的進程的進程號列表。

The format of the returned data is the following:

返回資料格式如下:

: the length of all content as a 4-char hexadecimal string: 代表返回資料長度的一個4位元組16進位字串 : a series of ASCII lines of the following format: "\n": 一系列的ASCLL字串列,每行的格式如下: "\n" This service is used by DDMS to know which debuggable processes are running on the device/emulator.

這個服務被DDMS用來知悉有哪些可調式的進程正在真實裝置/模擬器上運行。

Note that there is no single-shot service to retrieve the list only once.

注意並不存在另外一個服務來只擷取一次這個列表。

sync: This starts the file synchronisation service, used to implement "adb push" and "adb pull". Since this service is pretty complex, it will be detailed in a companion document named SYNC.TXT

開啟檔案同步服務,用來實現"adb push"和" adb pull" 這兩個命令。因為這個服務相當複雜,更詳細的資訊請查看相關的SYNC.TXT文檔。


Item

Description

Warning

Author

天地會珠海分舵

轉載請註明出處!

Blog Address

http://blog.csdn.net/zhubaitian



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.