diff options
| author | Qasid Ahmad Sadiq <qasid@google.com> | 2019-03-18 18:08:14 -0700 |
|---|---|---|
| committer | Qasid Sadiq <qasid@google.com> | 2019-03-27 23:52:05 +0000 |
| commit | 31d0cedcc40df60359e28799925b21aa2b48840e (patch) | |
| tree | a9ca9bf28c360bc337af99e78901cc499b917939 /core/java/android | |
| parent | d4b6ff816dea494b89bd1ac606abae5347b22f62 (diff) | |
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
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/view/accessibility/AccessibilityNodeInfo.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java index 385d491f49ef..774a359e5d6c 100644 --- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java +++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java @@ -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); |
