android_gym/gym_android/envs/android_device.py
def perform_action(self, action, emulator_id, list_of_ui_objects, tokens):
        """Obtain a list of UI objects from the device.

        Args:
          action: A list with two elements [index of an UI element, index of a token]
          emulator_id: The ID of the emulator.
          list_of_ui_objects: A list of UI elements on the current screen

        Returns:
          True or False
        """
        index = action[0]
        token = tokens[action[1]]

        number_of_elements = len(list_of_ui_objects)
        if index > number_of_elements - 1:
            return False
        else:
            elem = list_of_ui_objects[index]
            if self.is_element_editable(elem):
                print("action is TYPE {0} {1} - {2}".format(token, elem.resource_id, emulator_id))
                self._type_action(elem, token, emulator_id)
                return True
            else:
                if elem.clickable:
                    print("action is TAP {0} - {1}".format(elem.resource_id, emulator_id))
                    self._tap_action(elem, emulator_id)
                    return True
                else:                # If the element is neither clickable nor editable then
                    return False
Obtain a list of UI objects from the device.

        Args:
          action: A list with two elements [index of an UI element, index of a token]
          emulator_id: The ID of the emulator.
          list_of_ui_objects: A list of UI elements on the current screen

        Returns:
          True or False
        
Obtain a list of UI objects from the device.
Obtain a list of UI objects from the device .
def perform_action(self, action, emulator_id, list_of_ui_objects, tokens):
        index = action[0]
        token = tokens[action[1]]
        number_of_elements = len(list_of_ui_objects)
        if index > number_of_elements - 1:
            return False
        else:
            elem = list_of_ui_objects[index]
            if self.is_element_editable(elem):
                print("action is TYPE {0} {1} - {2}".format(token, elem.resource_id, emulator_id))
                self._type_action(elem, token, emulator_id)
                return True
            else:
                if elem.clickable:
                    print("action is TAP {0} - {1}".format(elem.resource_id, emulator_id))
                    self._tap_action(elem, emulator_id)
                    return True
                else:                
                    return False
def perform_action ( self , action , emulator_id , list_of_ui_objects , tokens ) : index = action [ 0 ] token = tokens [ action [ 1 ] ] number_of_elements = len ( list_of_ui_objects ) if index > number_of_elements - 1 : return False else : elem = list_of_ui_objects [ index ] if self . is_element_editable ( elem ) : print ( "action is TYPE {0} {1} - {2}" . format ( token , elem . resource_id , emulator_id ) ) self . _type_action ( elem , token , emulator_id ) return True else : if elem . clickable : print ( "action is TAP {0} - {1}" . format ( elem . resource_id , emulator_id ) ) self . _tap_action ( elem , emulator_id ) return True else : return False
Obtain a list of UI objects from the device.
Obtain a list of UI objects from the device .
"""Obtain a list of UI objects from the device.

        Args:
          action: A list with two elements [index of an UI element, index of a token]
          emulator_id: The ID of the emulator.
          list_of_ui_objects: A list of UI elements on the current screen

        Returns:
          True or False
        """ # If the element is neither clickable nor editable then
True or False
True or False
self
action
A list with two elements [index of an UI element, index of a token]
A list with two elements [ index of an UI element index of a token ]
emulator_id
The ID of the emulator.
The ID of the emulator .
list_of_ui_objects
A list of UI elements on the current screen
A list of UI elements on the current screen
tokens