Beispiel #1
0
 def __init__(self,
              serial="",
              product_type=ANDROID_PRODUCT_TYPE_UNKNOWN,
              device_callback_port=5010,
              shell_default_nohup=False):
     self.serial = serial
     self._product_type = product_type
     self.device_command_port = None
     self.device_callback_port = device_callback_port
     self.log = AndroidDeviceLoggerAdapter(logging.getLogger(),
                                           {"serial": self.serial})
     base_log_path = getattr(logging, "log_path", "/tmp/logs/")
     self.log_path = os.path.join(base_log_path, "AndroidDevice%s" % serial)
     self.adb_logcat_process = None
     self.adb_logcat_file_path = None
     self.vts_agent_process = None
     self.adb = adb.AdbProxy(serial)
     self.fastboot = fastboot.FastbootProxy(serial)
     if not self.isBootloaderMode:
         self.rootAdb()
     self.host_command_port = None
     self.host_callback_port = adb.get_available_host_port()
     if self.device_callback_port >= 0:
         self.adb.reverse_tcp_forward(self.device_callback_port,
                                      self.host_callback_port)
     self.hal = None
     self.lib = None
     self.shell = None
     self.shell_default_nohup = shell_default_nohup
     self.fatal_error = False
 def __init__(self, serial="", product_type=ANDROID_PRODUCT_TYPE_UNKNOWN,
              device_callback_port=5010):
     self.serial = serial
     self._product_type = product_type
     self.device_command_port = None
     self.device_callback_port = device_callback_port
     self.log = AndroidDeviceLoggerAdapter(logging.getLogger(),
                                           {"serial": self.serial})
     base_log_path = getattr(logging, "log_path", "/tmp/logs/")
     self.log_path = os.path.join(base_log_path, "AndroidDevice%s" % serial)
     self.adb_logcat_process = None
     self.adb_logcat_file_path = None
     self.vts_agent_process = None
     self.adb = adb.AdbProxy(serial)
     self.fastboot = fastboot.FastbootProxy(serial)
     if not self.isBootloaderMode:
         self.rootAdb()
     self.host_command_port = None
     self.host_callback_port = adb.get_available_host_port()
     self.adb.reverse_tcp_forward(self.device_callback_port,
                                  self.host_callback_port)
     self.hal = None
     self.lib = None
     self.shell = None
     self.sl4a_host_port = None
     # TODO: figure out a good way to detect which port is available
     # on the target side, instead of hard coding a port number.
     self.sl4a_target_port = 8082
Beispiel #3
0
def list_fastboot_devices():
    """List all android devices connected to the computer that are in in
    fastboot mode. These are detected by fastboot.

    Returns:
        A list of android device serials. Empty if there's none.
    """
    out = fastboot.FastbootProxy().devices()
    return _parse_device_list(out, "fastboot")