(self)
Checks if adb is available
Checks if adb is available
Checks if adb is available
def _check_min_required(self):
        """ Checks if adb is available
        """
        self._adb_available = False
        try:
            adb_version = utils.do_shell_command('adb --version')
            if adb_version:
                if adb_version and 'Android Debug Bridge' in adb_version:
                    self._adb_available = True
                else:
                    self._adb_available = False

            if self._adb_available:
                self._adb_available = False
                adb_devices = utils.do_shell_command('adb devices')

                try:
                    if adb_devices:
                        adb_devices = adb_devices.split(os.linesep)

                        for i, adb_device in enumerate(adb_devices):
                            if not adb_device: # skip empty lines at bottom
                                continue
                            if i == 0: # skip first line 'List of devices attached'
                                continue
                            if adb_device.startswith('*'): # skip these lines '* daemon started successfully *'
                                continue

                            self._adb_available = True

                    if not self._adb_available:
                        print('No Devices! Make sure \'Usb-Debugging\' is enabled in DeveloperSettings')

                except Exception as e:
                    print(e)

        # io error is handled here not in do_shell_command
        # if adb isnt there it gives file not found
        except IOError as io_error:
            # file not found
            if io_error.errno == 2:
                self._adb_available = False
def _check_min_required ( self ) : self . _adb_available = False try : adb_version = utils . do_shell_command ( 'adb --version' ) if adb_version : if adb_version and 'Android Debug Bridge' in adb_version : self . _adb_available = True else : self . _adb_available = False if self . _adb_available : self . _adb_available = False adb_devices = utils . do_shell_command ( 'adb devices' ) try : if adb_devices : adb_devices = adb_devices . split ( os . linesep ) for i , adb_device in enumerate ( adb_devices ) : if not adb_device : # skip empty lines at bottom continue if i == 0 : # skip first line 'List of devices attached' continue if adb_device . startswith ( '*' ) : # skip these lines '* daemon started successfully *' continue self . _adb_available = True if not self . _adb_available : print ( 'No Devices! Make sure \'Usb-Debugging\' is enabled in DeveloperSettings' ) except Exception as e : print ( e ) # io error is handled here not in do_shell_command # if adb isnt there it gives file not found except IOError as io_error : # file not found if io_error . errno == 2 : self . _adb_available = False