This package contains functionality to track the liveness of the ADB server on the PC and starts a new one as needed. It also tries to kill any competing ADB server to make sure it stays in control.
That probably sounds nuts. Well behaved programs should not go around killing each other, right? Unfortunately...
As it is, the “only” way to handle the worst effects is to start the ADB server as root from init and then watch that server process closely. The exact behavior can be controlled with a configuration file.
If no parameters are passed, the AdbServer class’ configuration is loaded from <home>/.ave/config/adb_server.json where <home> is the value of "home" in /etc/ave/user.
Parameters: |
|
---|
Return a list of PID’s with server processes that listen to a selected TCP port port, or any server if port is omitted.
Parameters: | port – An integer or None. |
---|---|
Returns: | A list of integers (PIDs). |
Kill all ADB servers that listen to the TCP port port and do not have the same PID as excepted. Kill all ADB servers if both parameters are omitted.
Parameters: |
|
---|
Load the file <home>/.ave/config/adb_server.json and validate its contents.
Parameters: | home – String. A valid directory path. |
---|
Kill all ADB servers that were not created by the current instance of the AdbServer class.
Start a new ADB server. The call returns immediately.
Stop an ADB server that were previously started with start_server().
Kill all other ADB servers, then start a new one and wait until it dies. Repeat forever if this AdbServer instance was configured to be persistent (see Configuration Files below).
A tool called ave-adb-server wraps the functionality desribed above:
ave-adb-server --start # start a new instance
--restart # replace a running instance with a new one
--stop # stop a running instance
If this file exists, it must contain a dictionary. The dictionary may have any of the following fields:
This is the default configuration:
{
"port": 5037,
"persist": true,
"demote": false
}