mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1157377 - Fixed parameter types to adb_android.py and adb.py. r=dhunt
This commit is contained in:
parent
e6a696a283
commit
0667cac540
@ -129,10 +129,12 @@ class ADBCommand(object):
|
||||
verbose=False):
|
||||
"""Initializes the ADBCommand object.
|
||||
|
||||
:param adb: path to adb executable. Defaults to 'adb'.
|
||||
:param str adb: path to adb executable. Defaults to 'adb'.
|
||||
:param adb_host: host of the adb server.
|
||||
:type adb_host: str or None
|
||||
:param adb_port: port of the adb server.
|
||||
:param logger_name: logging logger name. Defaults to 'adb'.
|
||||
:type adb_port: integer or None
|
||||
:param str logger_name: logging logger name. Defaults to 'adb'.
|
||||
|
||||
:raises: * ADBError
|
||||
* ADBTimeoutError
|
||||
@ -178,16 +180,18 @@ class ADBCommand(object):
|
||||
def command(self, cmds, device_serial=None, timeout=None):
|
||||
"""Executes an adb command on the host.
|
||||
|
||||
:param cmds: list containing the command and its arguments to be
|
||||
:param list cmds: The command and its arguments to be
|
||||
executed.
|
||||
:param device_serial: optional string specifying the device's
|
||||
:param device_serial: The device's
|
||||
serial number if the adb command is to be executed against
|
||||
a specific device.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:type device_serial: str or None
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError. This timeout is per adb call. The
|
||||
total time spent may exceed this value. If it is not
|
||||
specified, the value set in the ADBCommand constructor is used.
|
||||
:type timeout: integer or None
|
||||
:returns: :class:`mozdevice.ADBProcess`
|
||||
|
||||
command() provides a low level interface for executing
|
||||
@ -242,17 +246,19 @@ class ADBCommand(object):
|
||||
def command_output(self, cmds, device_serial=None, timeout=None):
|
||||
"""Executes an adb command on the host returning stdout.
|
||||
|
||||
:param cmds: list containing the command and its arguments to be
|
||||
:param list cmds: The command and its arguments to be
|
||||
executed.
|
||||
:param device_serial: optional string specifying the device's
|
||||
:param device_serial: The device's
|
||||
serial number if the adb command is to be executed against
|
||||
a specific device.
|
||||
:param timeout: optional integer specifying the maximum time in seconds
|
||||
:type device_serial: str or None
|
||||
:param timeout: The maximum time in seconds
|
||||
for any spawned adb process to complete before throwing
|
||||
an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBCommand constructor is used.
|
||||
:type timeout: integer or None
|
||||
:returns: string - content of stdout.
|
||||
|
||||
:raises: * ADBTimeoutError
|
||||
@ -311,10 +317,12 @@ class ADBHost(ADBCommand):
|
||||
verbose=False):
|
||||
"""Initializes the ADBHost object.
|
||||
|
||||
:param adb: path to adb executable. Defaults to 'adb'.
|
||||
:param str adb: path to adb executable. Defaults to 'adb'.
|
||||
:param adb_host: host of the adb server.
|
||||
:type adb_host: str or None
|
||||
:param adb_port: port of the adb server.
|
||||
:param logger_name: logging logger name. Defaults to 'adb'.
|
||||
:type adb_port: integer or None
|
||||
:param str logger_name: logging logger name. Defaults to 'adb'.
|
||||
|
||||
:raises: * ADBError
|
||||
* ADBTimeoutError
|
||||
@ -327,13 +335,14 @@ class ADBHost(ADBCommand):
|
||||
def command(self, cmds, timeout=None):
|
||||
"""Executes an adb command on the host.
|
||||
|
||||
:param cmds: list containing the command and its arguments to be
|
||||
:param list cmds: The command and its arguments to be
|
||||
executed.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError. This timeout is per adb call. The
|
||||
total time spent may exceed this value. If it is not
|
||||
specified, the value set in the ADBHost constructor is used.
|
||||
:type timeout: integer or None
|
||||
:returns: :class:`mozdevice.ADBProcess`
|
||||
|
||||
command() provides a low level interface for executing
|
||||
@ -360,14 +369,15 @@ class ADBHost(ADBCommand):
|
||||
def command_output(self, cmds, timeout=None):
|
||||
"""Executes an adb command on the host returning stdout.
|
||||
|
||||
:param cmds: list containing the command and its arguments to be
|
||||
:param list cmds: The command and its arguments to be
|
||||
executed.
|
||||
:param timeout: optional integer specifying the maximum time in seconds
|
||||
:param timeout: The maximum time in seconds
|
||||
for any spawned adb process to complete before throwing
|
||||
an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBHost constructor is used.
|
||||
:type timeout: integer or None
|
||||
:returns: string - content of stdout.
|
||||
|
||||
:raises: * ADBTimeoutError
|
||||
@ -379,11 +389,12 @@ class ADBHost(ADBCommand):
|
||||
def start_server(self, timeout=None):
|
||||
"""Starts the adb server.
|
||||
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError. This timeout is per adb call. The
|
||||
total time spent may exceed this value. If it is not
|
||||
specified, the value set in the ADBHost constructor is used.
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
|
||||
@ -411,11 +422,12 @@ class ADBHost(ADBCommand):
|
||||
def kill_server(self, timeout=None):
|
||||
"""Kills the adb server.
|
||||
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError. This timeout is per adb call. The
|
||||
total time spent may exceed this value. If it is not
|
||||
specified, the value set in the ADBHost constructor is used.
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
|
||||
@ -425,11 +437,12 @@ class ADBHost(ADBCommand):
|
||||
def devices(self, timeout=None):
|
||||
"""Executes adb devices -l and returns a list of objects describing attached devices.
|
||||
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError. This timeout is per adb call. The
|
||||
total time spent may exceed this value. If it is not
|
||||
specified, the value set in the ADBHost constructor is used.
|
||||
:type timeout: integer or None
|
||||
:returns: an object contain
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
@ -503,8 +516,7 @@ class ADBDevice(ADBCommand):
|
||||
device_ready_retry_attempts=3):
|
||||
"""Initializes the ADBDevice object.
|
||||
|
||||
:param device: can be either a dictionary, a string or None.
|
||||
When a string is passed, it is interpreted as the
|
||||
:param device: When a string is passed, it is interpreted as the
|
||||
device serial number. This form is not compatible with
|
||||
devices containing a ":" in the serial; in this case
|
||||
ValueError will be raised.
|
||||
@ -520,13 +532,16 @@ class ADBDevice(ADBCommand):
|
||||
device attached, ValueError is raised. If no device is
|
||||
attached the constructor will block until a device is
|
||||
attached or the timeout is reached.
|
||||
:type device: dict, str or None
|
||||
:param adb_host: host of the adb server to connect to.
|
||||
:type adb_host: str or None
|
||||
:param adb_port: port of the adb server to connect to.
|
||||
:param logger_name: logging logger name. Defaults to 'adb'.
|
||||
:param device_ready_retry_wait: number of seconds to wait
|
||||
:type adb_port: integer or None
|
||||
:param str logger_name: logging logger name. Defaults to 'adb'.
|
||||
:param integer device_ready_retry_wait: number of seconds to wait
|
||||
between attempts to check if the device is ready after a
|
||||
reboot.
|
||||
:param device_ready_retry_attempts: number of attempts when
|
||||
:param integer device_ready_retry_attempts: number of attempts when
|
||||
checking if a device is ready.
|
||||
|
||||
:raises: * ADBError
|
||||
@ -762,13 +777,14 @@ class ADBDevice(ADBCommand):
|
||||
def command(self, cmds, timeout=None):
|
||||
"""Executes an adb command on the host against the device.
|
||||
|
||||
:param cmds: list containing the command and its arguments to be
|
||||
:param list cmds: The command and its arguments to be
|
||||
executed.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError. This timeout is per adb call. The
|
||||
total time spent may exceed this value. If it is not
|
||||
specified, the value set in the ADBDevice constructor is used.
|
||||
:type timeout: integer or None
|
||||
:returns: :class:`mozdevice.ADBProcess`
|
||||
|
||||
command() provides a low level interface for executing
|
||||
@ -801,14 +817,14 @@ class ADBDevice(ADBCommand):
|
||||
"""Executes an adb command on the host against the device returning
|
||||
stdout.
|
||||
|
||||
:param cmds: list containing the command and its arguments to be
|
||||
executed.
|
||||
:param timeout: optional integer specifying the maximum time in seconds
|
||||
:param list cmds: The command and its arguments to be executed.
|
||||
:param timeout: The maximum time in seconds
|
||||
for any spawned adb process to complete before throwing
|
||||
an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:type timeout: integer or None
|
||||
:returns: string - content of stdout.
|
||||
|
||||
:raises: * ADBTimeoutError
|
||||
@ -824,8 +840,8 @@ class ADBDevice(ADBCommand):
|
||||
def _validate_port(self, port, is_local=True):
|
||||
"""Validate a port forwarding specifier. Raises ValueError on failure.
|
||||
|
||||
:param port: The port specifier to validate
|
||||
:is_local: Boolean indicating whether the port represents a local port.
|
||||
:param str port: The port specifier to validate
|
||||
:param bool is_local: Flag indicating whether the port represents a local port.
|
||||
"""
|
||||
prefixes = ["tcp", "localabstract", "localreserved", "localfilesystem", "dev"]
|
||||
|
||||
@ -847,14 +863,14 @@ class ADBDevice(ADBCommand):
|
||||
dev:<character device name>
|
||||
jdwp:<process pid> (remote only)
|
||||
|
||||
:param local: Local port to forward
|
||||
:param remote: Remote port to which to forward
|
||||
:param allow_rebind: Don't error if the local port is already forwarded
|
||||
:param timeout: optional integer specifying the maximum time in seconds
|
||||
:param str local: Local port to forward
|
||||
:param str remote: Remote port to which to forward
|
||||
:param bool allow_rebind: Don't error if the local port is already forwarded
|
||||
:param timeout: The maximum time in seconds
|
||||
for any spawned adb process to complete before throwing
|
||||
an ADBTimeoutError. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
|
||||
:type timeout: integer or None
|
||||
:raises: * ValueError
|
||||
* ADBTimeoutError
|
||||
* ADBError
|
||||
@ -873,11 +889,11 @@ class ADBDevice(ADBCommand):
|
||||
|
||||
Return values are of the form (device, local, remote).
|
||||
|
||||
:param timeout: optional integer specifying the maximum time in seconds
|
||||
:param timeout: The maximum time in seconds
|
||||
for any spawned adb process to complete before throwing
|
||||
an ADBTimeoutError. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
"""
|
||||
@ -889,11 +905,12 @@ class ADBDevice(ADBCommand):
|
||||
|
||||
:param local: local port specifier as for ADBDevice.forward. If local
|
||||
is not specified removes all forwards.
|
||||
:param timeout: optional integer specifying the maximum time in seconds
|
||||
:type local: str or None
|
||||
:param timeout: The maximum time in seconds
|
||||
for any spawned adb process to complete before throwing
|
||||
an ADBTimeoutError. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
|
||||
:type timeout: integer or None
|
||||
:raises: * ValueError
|
||||
* ADBTimeoutError
|
||||
* ADBError
|
||||
@ -912,17 +929,19 @@ class ADBDevice(ADBCommand):
|
||||
def shell(self, cmd, env=None, cwd=None, timeout=None, root=False):
|
||||
"""Executes a shell command on the device.
|
||||
|
||||
:param cmd: string containing the command to be executed.
|
||||
:param env: optional dictionary of environment variables and
|
||||
:param str cmd: The command to be executed.
|
||||
:param env: Contains the environment variables and
|
||||
their values.
|
||||
:param cwd: optional string containing the directory from which
|
||||
to execute.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:type env: dict or None
|
||||
:param cwd: The directory from which to execute.
|
||||
:type cwd: str or None
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError. This timeout is per adb call. The
|
||||
total time spent may exceed this value. If it is not
|
||||
specified, the value set in the ADBDevice constructor is used.
|
||||
:param root: optional boolean specifying if the command should
|
||||
:type timeout: integer or None
|
||||
:param bool root: Flag specifying if the command should
|
||||
be executed as root.
|
||||
:returns: :class:`mozdevice.ADBProcess`
|
||||
:raises: ADBRootError
|
||||
@ -1020,18 +1039,20 @@ class ADBDevice(ADBCommand):
|
||||
"""Executes a shell command on the device returning True on success
|
||||
and False on failure.
|
||||
|
||||
:param cmd: string containing the command to be executed.
|
||||
:param env: optional dictionary of environment variables and
|
||||
:param str cmd: The command to be executed.
|
||||
:param env: Contains the environment variables and
|
||||
their values.
|
||||
:param cwd: optional string containing the directory from which
|
||||
to execute.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:type env: dict or None
|
||||
:param cwd: The directory from which to execute.
|
||||
:type cwd: str or None
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:param root: optional boolean specifying if the command should
|
||||
:type timeout: integer or None
|
||||
:param bool root: Flag specifying if the command should
|
||||
be executed as root.
|
||||
:returns: boolean
|
||||
|
||||
@ -1054,18 +1075,19 @@ class ADBDevice(ADBCommand):
|
||||
def shell_output(self, cmd, env=None, cwd=None, timeout=None, root=False):
|
||||
"""Executes an adb shell on the device returning stdout.
|
||||
|
||||
:param cmd: string containing the command to be executed.
|
||||
:param env: optional dictionary of environment variables and
|
||||
their values.
|
||||
:param cwd: optional string containing the directory from which
|
||||
to execute.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param str cmd: The command to be executed.
|
||||
:param env: Contains the environment variables and their values.
|
||||
:type env: dict or None
|
||||
:param cwd: The directory from which to execute.
|
||||
:type cwd: str or None
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError. This timeout is per
|
||||
adb call. The total time spent may exceed this
|
||||
value. If it is not specified, the value set
|
||||
in the ADBDevice constructor is used. :param root:
|
||||
optional boolean specifying if the command
|
||||
in the ADBDevice constructor is used.
|
||||
:type timeout: integer or None
|
||||
:param bool root: Flag specifying if the command
|
||||
should be executed as root.
|
||||
:returns: string - content of stdout.
|
||||
:raises: * ADBTimeoutError
|
||||
@ -1118,13 +1140,14 @@ class ADBDevice(ADBCommand):
|
||||
def clear_logcat(self, timeout=None, buffers=["main"]):
|
||||
"""Clears logcat via adb logcat -c.
|
||||
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError. This timeout is per
|
||||
adb call. The total time spent may exceed this
|
||||
value. If it is not specified, the value set
|
||||
in the ADBDevice constructor is used.
|
||||
:param buffers: list of log buffers to clear. Valid buffers are
|
||||
:type timeout: integer or None
|
||||
:param list buffers: Log buffers to clear. Valid buffers are
|
||||
"radio", "events", and "main". Defaults to "main".
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
@ -1148,18 +1171,19 @@ class ADBDevice(ADBCommand):
|
||||
buffers=["main"]):
|
||||
"""Returns the contents of the logcat file as a list of strings.
|
||||
|
||||
:param filter_specs: optional list containing logcat messages to
|
||||
:param list filter_specs: Optional logcat messages to
|
||||
be included.
|
||||
:param format: optional logcat format.
|
||||
:param filterOutRexps: optional list of logcat messages to be
|
||||
:param str format: Optional logcat format.
|
||||
:param list filterOutRexps: Optional logcat messages to be
|
||||
excluded.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:param buffers: list of log buffers to retrieve. Valid buffers are
|
||||
:type timeout: integer or None
|
||||
:param list buffers: Log buffers to retrieve. Valid buffers are
|
||||
"radio", "events", and "main". Defaults to "main".
|
||||
:returns: list of lines logcat output.
|
||||
:raises: * ADBTimeoutError
|
||||
@ -1178,13 +1202,14 @@ class ADBDevice(ADBCommand):
|
||||
def get_prop(self, prop, timeout=None):
|
||||
"""Gets value of a property from the device via adb shell getprop.
|
||||
|
||||
:param prop: string containing the propery name.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param str prop: The propery name.
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:type timeout: integer or None
|
||||
:returns: string value of property.
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
@ -1196,12 +1221,13 @@ class ADBDevice(ADBCommand):
|
||||
def get_state(self, timeout=None):
|
||||
"""Returns the device's state via adb get-state.
|
||||
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before throwing
|
||||
an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:type timeout: integer or None
|
||||
:returns: string value of adb get-state.
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
@ -1213,14 +1239,16 @@ class ADBDevice(ADBCommand):
|
||||
def get_ip_address(self, interfaces=None, timeout=None):
|
||||
"""Returns the device's ip address, or None if it doesn't have one
|
||||
|
||||
:param interfaces: List of interfaces to allow, or None to alow any
|
||||
non-loopback interface
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param interfaces: Interfaces to allow, or None to allow any
|
||||
non-loopback interface.
|
||||
:type interfaces: list or None
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before throwing
|
||||
an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:type timeout: integer or None
|
||||
:returns: string ip address of the device or None if it could not
|
||||
be found.
|
||||
:raises: * ADBTimeoutError
|
||||
@ -1247,12 +1275,13 @@ class ADBDevice(ADBCommand):
|
||||
def remount(self, timeout=None):
|
||||
"""Remount /system/ in read/write mode
|
||||
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before throwing
|
||||
an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError"""
|
||||
|
||||
@ -1264,17 +1293,18 @@ class ADBDevice(ADBCommand):
|
||||
"""Recursively changes the permissions of a directory on the
|
||||
device.
|
||||
|
||||
:param path: string containing the directory name on the device.
|
||||
:param recursive: boolean specifying if the command should be
|
||||
:param str path: The directory name on the device.
|
||||
:param bool recursive: Flag specifying if the command should be
|
||||
executed recursively.
|
||||
:param mask: optional string containing the octal permissions.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param str mask: The octal permissions.
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before throwing
|
||||
an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:param root: optional boolean specifying if the command should
|
||||
:type timeout: integer or None
|
||||
:param bool root: Flag specifying if the command should
|
||||
be executed as root.
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBRootError
|
||||
@ -1313,14 +1343,15 @@ class ADBDevice(ADBCommand):
|
||||
def exists(self, path, timeout=None, root=False):
|
||||
"""Returns True if the path exists on the device.
|
||||
|
||||
:param path: string containing the directory name on the device.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param str path: The directory name on the device.
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:param root: optional boolean specifying if the command should be
|
||||
:type timeout: integer or None
|
||||
:param bool root: Flag specifying if the command should be
|
||||
executed as root.
|
||||
:returns: boolean - True if path exists.
|
||||
:raises: * ADBTimeoutError
|
||||
@ -1333,14 +1364,15 @@ class ADBDevice(ADBCommand):
|
||||
def is_dir(self, path, timeout=None, root=False):
|
||||
"""Returns True if path is an existing directory on the device.
|
||||
|
||||
:param path: string containing the path on the device.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param str path: The path on the device.
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:param root: optional boolean specifying if the command should
|
||||
:type timeout: integer or None
|
||||
:param bool root: Flag specifying if the command should
|
||||
be executed as root.
|
||||
:returns: boolean - True if path exists on the device and is a
|
||||
directory.
|
||||
@ -1354,14 +1386,15 @@ class ADBDevice(ADBCommand):
|
||||
def is_file(self, path, timeout=None, root=False):
|
||||
"""Returns True if path is an existing file on the device.
|
||||
|
||||
:param path: string containing the file name on the device.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param str path: The file name on the device.
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:param root: optional boolean specifying if the command should
|
||||
:type timeout: integer or None
|
||||
:param bool root: Flag specifying if the command should
|
||||
be executed as root.
|
||||
:returns: boolean - True if path exists on the device and is a
|
||||
file.
|
||||
@ -1378,14 +1411,15 @@ class ADBDevice(ADBCommand):
|
||||
"""Return a list of files/directories contained in a directory
|
||||
on the device.
|
||||
|
||||
:param path: string containing the directory name on the device.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param str path: The directory name on the device.
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:param root: optional boolean specifying if the command should
|
||||
:type timeout: integer or None
|
||||
:param bool root: Flag specifying if the command should
|
||||
be executed as root.
|
||||
:returns: list of files/directories contained in the directory.
|
||||
:raises: * ADBTimeoutError
|
||||
@ -1411,17 +1445,18 @@ class ADBDevice(ADBCommand):
|
||||
def mkdir(self, path, parents=False, timeout=None, root=False):
|
||||
"""Create a directory on the device.
|
||||
|
||||
:param path: string containing the directory name on the device
|
||||
:param str path: The directory name on the device
|
||||
to be created.
|
||||
:param parents: boolean indicating if the parent directories are
|
||||
:param bool parents: Flag indicating if the parent directories are
|
||||
also to be created. Think mkdir -p path.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:param root: optional boolean specifying if the command should
|
||||
:type timeout: integer or None
|
||||
:param bool root: Flag specifying if the command should
|
||||
be executed as root.
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBRootError
|
||||
@ -1456,16 +1491,17 @@ class ADBDevice(ADBCommand):
|
||||
def push(self, local, remote, timeout=None):
|
||||
"""Pushes a file or directory to the device.
|
||||
|
||||
:param local: string containing the name of the local file or
|
||||
:param str local: The name of the local file or
|
||||
directory name.
|
||||
:param remote: string containing the name of the remote file or
|
||||
:param str remote: The name of the remote file or
|
||||
directory name.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
|
||||
@ -1476,16 +1512,17 @@ class ADBDevice(ADBCommand):
|
||||
def pull(self, remote, local, timeout=None):
|
||||
"""Pulls a file or directory from the device.
|
||||
|
||||
:param remote: string containing the path of the remote file or
|
||||
:param str remote: The path of the remote file or
|
||||
directory.
|
||||
:param local: string containing the path of the local file or
|
||||
:param str local: The path of the local file or
|
||||
directory name.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
|
||||
@ -1496,20 +1533,20 @@ class ADBDevice(ADBCommand):
|
||||
def rm(self, path, recursive=False, force=False, timeout=None, root=False):
|
||||
"""Delete files or directories on the device.
|
||||
|
||||
:param path: string containing the path of the remote file or
|
||||
directory.
|
||||
:param recursive: optional boolean specifying if the command is
|
||||
:param str path: The path of the remote file or directory.
|
||||
:param bool recursive: Flag specifying if the command is
|
||||
to be applied recursively to the target. Default is False.
|
||||
:param force: optional boolean which if True will not raise an
|
||||
:param bool force: Flag which if True will not raise an
|
||||
error when attempting to delete a non-existent file. Default
|
||||
is False.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:param root: optional boolean specifying if the command should
|
||||
:type timeout: integer or None
|
||||
:param bool root: Flag specifying if the command should
|
||||
be executed as root.
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBRootError
|
||||
@ -1530,14 +1567,15 @@ class ADBDevice(ADBCommand):
|
||||
def rmdir(self, path, timeout=None, root=False):
|
||||
"""Delete empty directory on the device.
|
||||
|
||||
:param path: string containing the directory name on the device.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param str path: The directory name on the device.
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:param root: optional boolean specifying if the command should
|
||||
:type timeout: integer or None
|
||||
:param bool root: Flag specifying if the command should
|
||||
be executed as root.
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBRootError
|
||||
@ -1554,12 +1592,13 @@ class ADBDevice(ADBCommand):
|
||||
"""Returns list of tuples (pid, name, user) for running
|
||||
processes on device.
|
||||
|
||||
:param timeout: optional integer specifying the maximum time
|
||||
:param timeout: The maximum time
|
||||
in seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified,
|
||||
the value set in the ADBDevice constructor is used.
|
||||
:type timeout: integer or None
|
||||
:returns: list of (pid, name, user) tuples for running processes
|
||||
on the device.
|
||||
:raises: * ADBTimeoutError
|
||||
@ -1611,17 +1650,20 @@ class ADBDevice(ADBCommand):
|
||||
timeout=None, root=False):
|
||||
"""Kills processes on the device given a list of process ids.
|
||||
|
||||
:param pids: list of process ids to be killed.
|
||||
:param sig: optional signal to be sent to the process.
|
||||
:param attempts: number of attempts to try to kill the processes.
|
||||
:param wait: number of seconds to wait after each attempt.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param list pids: process ids to be killed.
|
||||
:param sig: signal to be sent to the process.
|
||||
:type sig: integer or None
|
||||
:param integer attempts: number of attempts to try to
|
||||
kill the processes.
|
||||
:param integer wait: number of seconds to wait after each attempt.
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:param root: optional boolean specifying if the command should
|
||||
:type timeout: integer or None
|
||||
:param bool root: Flag specifying if the command should
|
||||
be executed as root.
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBRootError
|
||||
@ -1656,19 +1698,22 @@ class ADBDevice(ADBCommand):
|
||||
timeout=None, root=False):
|
||||
"""Kills a processes on the device matching a name.
|
||||
|
||||
:param appname: string containing the app name of the process to
|
||||
:param str appname: The app name of the process to
|
||||
be killed. Note that only the first 75 characters of the
|
||||
process name are significant.
|
||||
:param sig: optional signal to be sent to the process.
|
||||
:param attempts: number of attempts to try to kill the processes.
|
||||
:param wait: number of seconds to wait after each attempt.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:type sig: integer or None
|
||||
:param integer attempts: number of attempts to try to
|
||||
kill the processes.
|
||||
:param integer wait: number of seconds to wait after each attempt.
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:param root: optional boolean specifying if the command should
|
||||
:type timeout: integer or None
|
||||
:param bool root: Flag specifying if the command should
|
||||
be executed as root.
|
||||
|
||||
:raises: * ADBTimeoutError
|
||||
@ -1694,15 +1739,16 @@ class ADBDevice(ADBCommand):
|
||||
"""Returns True if process with name process_name is running on
|
||||
device.
|
||||
|
||||
:param process_name: string containing the name of the process
|
||||
:param str process_name: The name of the process
|
||||
to check. Note that only the first 75 characters of the
|
||||
process name are significant.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:type timeout: integer or None
|
||||
:returns: boolean - True if process exists.
|
||||
|
||||
:raises: * ADBTimeoutError
|
||||
|
@ -18,12 +18,13 @@ class ADBAndroidMixin(object):
|
||||
def get_battery_percentage(self, timeout=None):
|
||||
"""Returns the battery charge as a percentage.
|
||||
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADBDevice constructor is used.
|
||||
:type timeout: integer or None
|
||||
:returns: battery charge as a percentage.
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
@ -57,12 +58,13 @@ class ADBAndroidMixin(object):
|
||||
This method uses the android only package manager to check for
|
||||
readiness.
|
||||
|
||||
:param timeout: optional integer specifying the maximum time
|
||||
:param timeout: The maximum time
|
||||
in seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADB constructor is used.
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
|
||||
@ -109,12 +111,13 @@ class ADBAndroidMixin(object):
|
||||
def power_on(self, timeout=None):
|
||||
"""Sets the device's power stayon value.
|
||||
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADB constructor is used.
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
|
||||
@ -134,12 +137,13 @@ class ADBAndroidMixin(object):
|
||||
This method uses the Android only package manager to determine
|
||||
if the device is ready after the reboot.
|
||||
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADB constructor is used.
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
|
||||
@ -157,14 +161,14 @@ class ADBAndroidMixin(object):
|
||||
def install_app(self, apk_path, timeout=None):
|
||||
"""Installs an app on the device.
|
||||
|
||||
:param apk_path: string containing the apk file name to be
|
||||
installed.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param str apk_path: The apk file name to be installed.
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADB constructor is used.
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
|
||||
@ -177,14 +181,14 @@ class ADBAndroidMixin(object):
|
||||
def is_app_installed(self, app_name, timeout=None):
|
||||
"""Returns True if an app is installed on the device.
|
||||
|
||||
:param app_name: string containing the name of the app to be
|
||||
checked.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param str app_name: The name of the app to be checked.
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADB constructor is used.
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
|
||||
@ -202,21 +206,24 @@ class ADBAndroidMixin(object):
|
||||
timeout=None):
|
||||
"""Launches an Android application
|
||||
|
||||
:param app_name: Name of application (e.g. `com.android.chrome`)
|
||||
:param activity_name: Name of activity to launch (e.g. `.Main`)
|
||||
:param intent: Intent to launch application with
|
||||
:param str app_name: Name of application (e.g. `com.android.chrome`)
|
||||
:param str activity_name: Name of activity to launch (e.g. `.Main`)
|
||||
:param str intent: Intent to launch application with
|
||||
:param url: URL to open
|
||||
:param extras: Dictionary of extra arguments for application.
|
||||
:param wait: If True, wait for application to start before
|
||||
:type url: str or None
|
||||
:param extras: Extra arguments for application.
|
||||
:type extras: dict or None
|
||||
:param bool wait: If True, wait for application to start before
|
||||
returning.
|
||||
:param fail_if_running: Raise an exception if instance of
|
||||
:param bool fail_if_running: Raise an exception if instance of
|
||||
application is already running.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADB constructor is used.
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
|
||||
@ -257,23 +264,27 @@ class ADBAndroidMixin(object):
|
||||
"""Convenience method to launch Fennec on Android with various
|
||||
debugging arguments
|
||||
|
||||
:param app_name: Name of fennec application (e.g.
|
||||
:param str app_name: Name of fennec application (e.g.
|
||||
`org.mozilla.fennec`)
|
||||
:param intent: Intent to launch application.
|
||||
:param str intent: Intent to launch application.
|
||||
:param moz_env: Mozilla specific environment to pass into
|
||||
application.
|
||||
:type moz_env: str or None
|
||||
:param extra_args: Extra arguments to be parsed by fennec.
|
||||
:type extra_args: str or None
|
||||
:param url: URL to open
|
||||
:param wait: If True, wait for application to start before
|
||||
returning
|
||||
:param fail_if_running: Raise an exception if instance of
|
||||
application is already running
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:type url: str or None
|
||||
:param bool wait: If True, wait for application to start before
|
||||
returning.
|
||||
:param bool fail_if_running: Raise an exception if instance of
|
||||
application is already running.
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADB constructor is used.
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
|
||||
@ -304,13 +315,16 @@ class ADBAndroidMixin(object):
|
||||
by the app repeatedly until none is around any more. This is
|
||||
less reliable and does require root.
|
||||
|
||||
:param app_name: Name of application (e.g. `com.android.chrome`)
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param str app_name: Name of application (e.g. `com.android.chrome`)
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADB constructor is used.
|
||||
:type timeout: integer or None
|
||||
:param bool root: Flag specifying if the command should be
|
||||
executed as root.
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
|
||||
@ -339,17 +353,18 @@ class ADBAndroidMixin(object):
|
||||
def uninstall_app(self, app_name, reboot=False, timeout=None):
|
||||
"""Uninstalls an app on the device.
|
||||
|
||||
:param app_name: string containing the name of the app to be
|
||||
:param str app_name: The name of the app to be
|
||||
uninstalled.
|
||||
:param reboot: boolean flag indicating that the device should
|
||||
:param bool reboot: Flag indicating that the device should
|
||||
be rebooted after the app is uninstalled. No reboot occurs
|
||||
if the app is not installed.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADB constructor is used.
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
|
||||
@ -365,14 +380,15 @@ class ADBAndroidMixin(object):
|
||||
def update_app(self, apk_path, timeout=None):
|
||||
"""Updates an app on the device and reboots.
|
||||
|
||||
:param apk_path: string containing the apk file name to be
|
||||
:param str apk_path: The apk file name to be
|
||||
updated.
|
||||
:param timeout: optional integer specifying the maximum time in
|
||||
:param timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError.
|
||||
This timeout is per adb call. The total time spent
|
||||
may exceed this value. If it is not specified, the value
|
||||
set in the ADB constructor is used.
|
||||
:type timeout: integer or None
|
||||
:raises: * ADBTimeoutError
|
||||
* ADBError
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user