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

Commit 31d0cedc authored by Qasid Ahmad Sadiq's avatar Qasid Ahmad Sadiq Committed by Qasid Sadiq
Browse files

Deprecate boundsInParent in favor of boundInScreen.

If the service has boundsInScreen the boundsinparent can be computed.
Also for its whole existence, boundsInParent is the bounds within the
ViewParent's coordinates. But the ViewParent is quite often not the
AccessibilityParent (if it isn't important for accessibility), so the
service can't really do anything with that information because the
service doesn't have access to the ViewParent, only the
AccessibilityParent.

Test: It builds.
Bug: 1084662
Change-Id: If88dcaac6dcb824d72d7f483c05cbb544314423c
parent d4b6ff81
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -52311,7 +52311,7 @@ package android.view.accessibility {
    method public java.util.List<android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction> getActionList();
    method @Deprecated public int getActions();
    method public java.util.List<java.lang.String> getAvailableExtraData();
    method public void getBoundsInParent(android.graphics.Rect);
    method @Deprecated public void getBoundsInParent(android.graphics.Rect);
    method public void getBoundsInScreen(android.graphics.Rect);
    method public android.view.accessibility.AccessibilityNodeInfo getChild(int);
    method public int getChildCount();
@@ -52380,7 +52380,7 @@ package android.view.accessibility {
    method public boolean removeChild(android.view.View, int);
    method public void setAccessibilityFocused(boolean);
    method public void setAvailableExtraData(java.util.List<java.lang.String>);
    method public void setBoundsInParent(android.graphics.Rect);
    method @Deprecated public void setBoundsInParent(android.graphics.Rect);
    method public void setBoundsInScreen(android.graphics.Rect);
    method public void setCanOpenPopup(boolean);
    method public void setCheckable(boolean);
+16 −2
Original line number Diff line number Diff line
@@ -1682,17 +1682,29 @@ public class AccessibilityNodeInfo implements Parcelable {
    }

    /**
     * Gets the node bounds in parent coordinates.
     * Gets the node bounds in the viewParent's coordinates.
     * {@link #getParent()} does not represent the source's viewParent.
     * Instead it represents the result of {@link View#getParentForAccessibility()},
     * which returns the closest ancestor where {@link View#isImportantForAccessibility()} is true.
     * So this method is not reliable.
     *
     * @param outBounds The output node bounds.
     * @deprecated Use {@link #getBoundsInScreen(Rect)} instead.
     *
     */
    @Deprecated
    public void getBoundsInParent(Rect outBounds) {
        outBounds.set(mBoundsInParent.left, mBoundsInParent.top,
                mBoundsInParent.right, mBoundsInParent.bottom);
    }

    /**
     * Sets the node bounds in parent coordinates.
     * Sets the node bounds in the viewParent's coordinates.
     * {@link #getParent()} does not represent the source's viewParent.
     * Instead it represents the result of {@link View#getParentForAccessibility()},
     * which returns the closest ancestor where {@link View#isImportantForAccessibility()} is true.
     * So this method is not reliable.
     *
     * <p>
     *   <strong>Note:</strong> Cannot be called from an
     *   {@link android.accessibilityservice.AccessibilityService}.
@@ -1702,7 +1714,9 @@ public class AccessibilityNodeInfo implements Parcelable {
     * @param bounds The node bounds.
     *
     * @throws IllegalStateException If called from an AccessibilityService.
     * @deprecated Accessibility services should not care about these bounds.
     */
    @Deprecated
    public void setBoundsInParent(Rect bounds) {
        enforceNotSealed();
        mBoundsInParent.set(bounds.left, bounds.top, bounds.right, bounds.bottom);