IT. Expert System.

Android Reference

UiTestAutomationBridge


android.accessibilityservice

Class UiTestAutomationBridge



  • public class UiTestAutomationBridge
    extends Object
    This class represents a bridge that can be used for UI test automation. It is responsible for connecting to the system, keeping track of the last accessibility event, and exposing window content querying APIs. This class is designed to be used from both an Android application and a Java program run from the shell.
    • Constructor Detail

      • UiTestAutomationBridge

        public UiTestAutomationBridge()
    • Method Detail

      • onAccessibilityEvent

        public void onAccessibilityEvent(AccessibilityEvent event)
        Callback for receiving an AccessibilityEvent. Note: This method is NOT executed on the application main thread. The client are responsible for proper synchronization.
        Parameters:
        event - The received event.
      • onInterrupt

        public void onInterrupt()
        Callback for requests to stop feedback. Note: This method is NOT executed on the application main thread. The client are responsible for proper synchronization.
      • connect

        public void connect()
        Connects this service.
        Throws:
        IllegalStateException - If already connected.
      • disconnect

        public void disconnect()
        Disconnects this service.
        Throws:
        IllegalStateException - If already disconnected.
      • isConnected

        public boolean isConnected()
        Gets whether this service is connected.
        Returns:
        True if connected.
      • executeCommandAndWaitForAccessibilityEvent

        public AccessibilityEvent executeCommandAndWaitForAccessibilityEvent(Runnable command,
                                                                    com.android.internal.util.Predicate<AccessibilityEvent> predicate,
                                                                    long timeoutMillis)
                                                                      throws TimeoutException,
                                                                             Exception
        Executes a command and waits for a specific accessibility event type up to a given timeout.
        Parameters:
        command - The command to execute before starting to wait for the event.
        predicate - Predicate for recognizing the awaited event.
        timeoutMillis - The max wait time in milliseconds.
        Throws:
        TimeoutException
        Exception
      • waitForIdle

        public void waitForIdle(long idleTimeout,
                       long globalTimeout)
        Waits for the accessibility event stream to become idle, which is not to have received a new accessibility event within idleTimeout, and do so within a maximal global timeout as specified by globalTimeout.
        Parameters:
        idleTimeout - The timeout between two event to consider the device idle.
        globalTimeout - The maximal global timeout in which to wait for idle.
      • findAccessibilityNodeInfoByAccessibilityIdInActiveWindow

        public AccessibilityNodeInfo findAccessibilityNodeInfoByAccessibilityIdInActiveWindow(long accessibilityNodeId)
        Finds an AccessibilityNodeInfo by accessibility id in the active window. The search is performed from the root node.
        Parameters:
        accessibilityNodeId - A unique view id or virtual descendant id for which to search.
        Returns:
        The current window scale, where zero means a failure.
      • findAccessibilityNodeInfoByAccessibilityId

        public AccessibilityNodeInfo findAccessibilityNodeInfoByAccessibilityId(int accessibilityWindowId,
                                                                       long accessibilityNodeId)
        Finds an AccessibilityNodeInfo by accessibility id.
        Parameters:
        accessibilityWindowId - A unique window id. Use ACTIVE_WINDOW_ID to query the currently active window.
        accessibilityNodeId - A unique view id or virtual descendant id for which to search.
        Returns:
        The current window scale, where zero means a failure.
      • findAccessibilityNodeInfoByViewIdInActiveWindow

        public AccessibilityNodeInfo findAccessibilityNodeInfoByViewIdInActiveWindow(int viewId)
        Finds an AccessibilityNodeInfo by View id in the active window. The search is performed from the root node.
        Parameters:
        viewId - The id of a View.
        Returns:
        The current window scale, where zero means a failure.
      • findAccessibilityNodeInfoByViewId

        public AccessibilityNodeInfo findAccessibilityNodeInfoByViewId(int accessibilityWindowId,
                                                              long accessibilityNodeId,
                                                              int viewId)
        Finds an AccessibilityNodeInfo by View id. The search is performed in the window whose id is specified and starts from the node whose accessibility id is specified.
        Parameters:
        accessibilityWindowId - A unique window id. Use ACTIVE_WINDOW_ID to query the currently active window.
        accessibilityNodeId - A unique view id or virtual descendant id from where to start the search. Use ROOT_NODE_ID to start from the root.
        viewId - The id of a View.
        Returns:
        The current window scale, where zero means a failure.
      • findAccessibilityNodeInfosByTextInActiveWindow

        public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByTextInActiveWindow(String text)
        Finds AccessibilityNodeInfos by View text in the active window. The search is performed from the root node.
        Parameters:
        text - The searched text.
        Returns:
        The current window scale, where zero means a failure.
      • findAccessibilityNodeInfosByText

        public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText(int accessibilityWindowId,
                                                                   long accessibilityNodeId,
                                                                   String text)
        Finds AccessibilityNodeInfos by View text. The match is case insensitive containment. The search is performed in the window whose id is specified and starts from the node whose accessibility id is specified.
        Parameters:
        accessibilityWindowId - A unique window id. Use ACTIVE_WINDOW_ID to query the currently active window.
        accessibilityNodeId - A unique view id or virtual descendant id from where to start the search. Use ROOT_NODE_ID to start from the root.
        text - The searched text.
        Returns:
        The current window scale, where zero means a failure.
      • performAccessibilityActionInActiveWindow

        public boolean performAccessibilityActionInActiveWindow(long accessibilityNodeId,
                                                       int action,
                                                       Bundle arguments)
        Performs an accessibility action on an AccessibilityNodeInfo in the active window.
        Parameters:
        accessibilityNodeId - A unique node id (accessibility and virtual descendant id).
        action - The action to perform.
        arguments - Optional action arguments.
        Returns:
        Whether the action was performed.
      • performAccessibilityAction

        public boolean performAccessibilityAction(int accessibilityWindowId,
                                         long accessibilityNodeId,
                                         int action,
                                         Bundle arguments)
        Performs an accessibility action on an AccessibilityNodeInfo.
        Parameters:
        accessibilityWindowId - A unique window id. Use ACTIVE_WINDOW_ID to query the currently active window.
        accessibilityNodeId - A unique node id (accessibility and virtual descendant id).
        action - The action to perform.
        arguments - Optional action arguments.
        Returns:
        Whether the action was performed.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 2166 / . Delta: 0.00756 с