parameters: (self, enabled, timeout=None, retries=None)
docstring: Enables or disables Java asserts.
  
      Args:
        enabled: A boolean indicating whether Java asserts should be enabled
                 or disabled.
        timeout: timeout in seconds
        retries: number of retries
  
      Returns:
        True if the device-side property changed and a restart is required as a
        result, False otherwise.
  
      Raises:
        CommandTimeoutError on timeout.
docstring_summary: Enables or disables Java asserts.
docstring_tokens: Enables or disables Java asserts .
function: def SetJavaAsserts(self, enabled, timeout=None, retries=None):
      """Enables or disables Java asserts.
  
      Args:
        enabled: A boolean indicating whether Java asserts should be enabled
                 or disabled.
        timeout: timeout in seconds
        retries: number of retries
  
      Returns:
        True if the device-side property changed and a restart is required as a
        result, False otherwise.
  
      Raises:
        CommandTimeoutError on timeout.
      """
      def find_property(lines, property_name):
        for index, line in enumerate(lines):
          if line.strip() == '':
            continue
          key_value = tuple(s.strip() for s in line.split('=', 1))
          if len(key_value) != 2:
            continue
          key, value = key_value
          if key == property_name:
            return index, value
        return None, ''
  
      new_value = 'all' if enabled else ''
  
      # First ensure the desired property is persisted.
      try:
        properties = self.ReadFile(self.LOCAL_PROPERTIES_PATH).splitlines()
      except device_errors.CommandFailedError:
        properties = []
      index, value = find_property(properties, self.JAVA_ASSERT_PROPERTY)
      if new_value != value:
        if new_value:
          new_line = '%s=%s' % (self.JAVA_ASSERT_PROPERTY, new_value)
          if index is None:
            properties.append(new_line)
          else:
            properties[index] = new_line
        else:
          assert index is not None  # since new_value == '' and new_value != value
          properties.pop(index)
        self.WriteFile(self.LOCAL_PROPERTIES_PATH, _JoinLines(properties))
  
      # Next, check the current runtime value is what we need, and
      # if not, set it and report that a reboot is required.
      value = self.GetProp(self.JAVA_ASSERT_PROPERTY)
      if new_value != value:
        self.SetProp(self.JAVA_ASSERT_PROPERTY, new_value)
        return True
      else:
        return False
function_tokens: def SetJavaAsserts ( self , enabled , timeout = None , retries = None ) : def find_property ( lines , property_name ) : for index , line in enumerate ( lines ) : if line . strip ( ) == '' : continue key_value = tuple ( s . strip ( ) for s in line . split ( '=' , 1 ) ) if len ( key_value ) != 2 : continue key , value = key_value if key == property_name : return index , value return None , '' new_value = 'all' if enabled else '' # First ensure the desired property is persisted. try : properties = self . ReadFile ( self . LOCAL_PROPERTIES_PATH ) . splitlines ( ) except device_errors . CommandFailedError : properties = [ ] index , value = find_property ( properties , self . JAVA_ASSERT_PROPERTY ) if new_value != value : if new_value : new_line = '%s=%s' % ( self . JAVA_ASSERT_PROPERTY , new_value ) if index is None : properties . append ( new_line ) else : properties [ index ] = new_line else : assert index is not None # since new_value == '' and new_value != value properties . pop ( index ) self . WriteFile ( self . LOCAL_PROPERTIES_PATH , _JoinLines ( properties ) ) # Next, check the current runtime value is what we need, and # if not, set it and report that a reboot is required. value = self . GetProp ( self . JAVA_ASSERT_PROPERTY ) if new_value != value : self . SetProp ( self . JAVA_ASSERT_PROPERTY , new_value ) return True else : return False