original_docstring: 
          Waiting for device loading to IDLE state (home or setup screen).
  
          Args:
              timeout (int, default :data:`.constants.DEFAULT_WAIT_DEVICE_TIMEOUT`): Timeout in seconds
              sleep_time (int, default :data:`.constants.DEFAULT_SLEEP_FOR_WAIT_IDLE`): Sleep time in seconds after
                  Idle was detected.
              windows_threshold (int, default :data:`.constants.DEFAULT_WINDOWS_THRESHOLD_FOR_DETECT_IDLE`): Windows
                  threshold to make sure Idle is detected
  
          Raises:
              TimeoutExpiredError
          
docstring: Waiting for device loading to IDLE state (home or setup screen).
  
  
docstring_tokens: Waiting for device loading to IDLE state ( home or setup screen ) .
code: def wait_idle(self, timeout=DEFAULT_WAIT_DEVICE_TIMEOUT, sleep_time=DEFAULT_SLEEP_FOR_WAIT_IDLE,
                    windows_threshold=DEFAULT_WINDOWS_THRESHOLD_FOR_DETECT_IDLE, **kwargs):
          """
          Waiting for device loading to IDLE state (home or setup screen).
  
          Args:
              timeout (int, default :data:`.constants.DEFAULT_WAIT_DEVICE_TIMEOUT`): Timeout in seconds
              sleep_time (int, default :data:`.constants.DEFAULT_SLEEP_FOR_WAIT_IDLE`): Sleep time in seconds after
                  Idle was detected.
              windows_threshold (int, default :data:`.constants.DEFAULT_WINDOWS_THRESHOLD_FOR_DETECT_IDLE`): Windows
                  threshold to make sure Idle is detected
  
          Raises:
              TimeoutExpiredError
          """
          # wait device in ADB
          start_time = time()
          verbose = kwargs.get('verbose', DEFAULT_MANAGER_COMMAND_VERBOSE)
          kwargs['verbose'] = False
          self.wait_for('adb', timeout=timeout, **kwargs)
          timeout, start_time = self._reduce_timeout(start_time, timeout)
  
          printed = False  # used for print message once
          # wait for Idle
          t = time()
          shell_timeout = timeout
          while time() - t < timeout:
              find = re.findall('Window\s*([#\d]+)\s', self.sh('dumpsys window w | grep Window', errors=False, empty=True,
                                                               timeout=shell_timeout, **kwargs), re.I)
              self.syslogger.info('WAITIDLE Windows found: %d' % len(find))
              if len(find) >= windows_threshold:
                  # sleep after Idle was detected but only once
                  if self.saved_mode not in ['idle', 'service']:
                      # update saved mode to skip sleep timeout next time
                      self.__update_saved_mode('idle')
                      sleep(sleep_time)
                  if verbose and printed:
                      self.logger.done()
                  return
              else:
                  if verbose and not printed:
                      printed = True
                      self.logger.info('Waiting for device in IDLE mode...')
                  sleep(1)
              shell_timeout, start_time = self._reduce_timeout(start_time, timeout)
          raise TimeoutExpiredError('Wait for device in IDLE timeout expired !')
code_tokens: def wait_idle ( self , timeout = DEFAULT_WAIT_DEVICE_TIMEOUT , sleep_time = DEFAULT_SLEEP_FOR_WAIT_IDLE , windows_threshold = DEFAULT_WINDOWS_THRESHOLD_FOR_DETECT_IDLE , ** kwargs ) : start_time = time ( ) verbose = kwargs . get ( 'verbose' , DEFAULT_MANAGER_COMMAND_VERBOSE ) kwargs [ 'verbose' ] = False self . wait_for ( 'adb' , timeout = timeout , ** kwargs ) timeout , start_time = self . _reduce_timeout ( start_time , timeout ) printed = False t = time ( ) shell_timeout = timeout while time ( ) - t < timeout : find = re . findall ( 'Window\s*([#\d]+)\s' , self . sh ( 'dumpsys window w | grep Window' , errors = False , empty = True , timeout = shell_timeout , ** kwargs ) , re . I ) self . syslogger . info ( 'WAITIDLE Windows found: %d' % len ( find ) ) if len ( find ) >= windows_threshold : if self . saved_mode not in [ 'idle' , 'service' ] : self . __update_saved_mode ( 'idle' ) sleep ( sleep_time ) if verbose and printed : self . logger . done ( ) return else : if verbose and not printed : printed = True self . logger . info ( 'Waiting for device in IDLE mode...' ) sleep ( 1 ) shell_timeout , start_time = self . _reduce_timeout ( start_time , timeout ) raise TimeoutExpiredError ( 'Wait for device in IDLE timeout expired !' )
short_docstring: Waiting for device loading to IDLE state (home or setup screen).
short_docstring_tokens: Waiting for device loading to IDLE state ( home or setup screen ) .
comment: """
          Waiting for device loading to IDLE state (home or setup screen).
  
          Args:
              timeout (int, default :data:`.constants.DEFAULT_WAIT_DEVICE_TIMEOUT`): Timeout in seconds
              sleep_time (int, default :data:`.constants.DEFAULT_SLEEP_FOR_WAIT_IDLE`): Sleep time in seconds after
                  Idle was detected.
              windows_threshold (int, default :data:`.constants.DEFAULT_WINDOWS_THRESHOLD_FOR_DETECT_IDLE`): Windows
                  threshold to make sure Idle is detected
  
          Raises:
              TimeoutExpiredError
          """$SEP$# wait device in ADB$SEP$# used for print message once$SEP$# wait for Idle$SEP$# sleep after Idle was detected but only once$SEP$# update saved mode to skip sleep timeout next time