Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1616269a authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android (Google) Code Review
Browse files

Merge "Adding API for refreshing the state of an AccessibilityNodeInfo."

parents 563dc542 0b0afb49
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -26240,6 +26240,7 @@ package android.view.accessibility {
    method public boolean performAction(int);
    method public boolean performAction(int, android.os.Bundle);
    method public void recycle();
    method public boolean refresh();
    method public void setAccessibilityFocused(boolean);
    method public void setBoundsInParent(android.graphics.Rect);
    method public void setBoundsInScreen(android.graphics.Rect);
+25 −0
Original line number Diff line number Diff line
@@ -485,6 +485,31 @@ public class AccessibilityNodeInfo implements Parcelable {
        return mWindowId;
    }

    /**
     * Refreshes this info with the latest state of the view it represents.
     * <p>
     * <strong>Note:</strong> If this method returns false this info is obsolete
     * since it represents a view that is no longer in the view tree and should
     * be recycled.
     * </p>
     * @return Whether the refresh succeeded.
     */
    public boolean refresh() {
        enforceSealed();
        if (!canPerformRequestOverConnection(mSourceNodeId)) {
            return false;
        }
        AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance();
        AccessibilityNodeInfo refreshedInfo = client.findAccessibilityNodeInfoByAccessibilityId(
                mConnectionId, mWindowId, mSourceNodeId, 0);
        if (refreshedInfo == null) {
            return false;
        }
        init(refreshedInfo);
        refreshedInfo.recycle();
        return true;
    }

    /**
     * @return The ids of the children.
     *