diff options
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/uiautomator/library/core-src/com/android/uiautomator/core/AccessibilityNodeInfoHelper.java | 7 | ||||
-rw-r--r-- | cmds/uiautomator/library/core-src/com/android/uiautomator/core/UiObject.java | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/cmds/uiautomator/library/core-src/com/android/uiautomator/core/AccessibilityNodeInfoHelper.java b/cmds/uiautomator/library/core-src/com/android/uiautomator/core/AccessibilityNodeInfoHelper.java index 54835e3..de2fec0 100644 --- a/cmds/uiautomator/library/core-src/com/android/uiautomator/core/AccessibilityNodeInfoHelper.java +++ b/cmds/uiautomator/library/core-src/com/android/uiautomator/core/AccessibilityNodeInfoHelper.java @@ -46,7 +46,10 @@ class AccessibilityNodeInfoHelper { displayRect.right = width; displayRect.bottom = height; - nodeRect.intersect(displayRect); - return nodeRect; + if (nodeRect.intersect(displayRect)) { + return nodeRect; + } else { + return new Rect(); + } } } diff --git a/cmds/uiautomator/library/core-src/com/android/uiautomator/core/UiObject.java b/cmds/uiautomator/library/core-src/com/android/uiautomator/core/UiObject.java index 4bb99cd..2118da8 100644 --- a/cmds/uiautomator/library/core-src/com/android/uiautomator/core/UiObject.java +++ b/cmds/uiautomator/library/core-src/com/android/uiautomator/core/UiObject.java @@ -353,8 +353,12 @@ public class UiObject { Rect parentRect = AccessibilityNodeInfoHelper .getVisibleBoundsInScreen(scrollableParentNode, w, h); // adjust for partial clipping of targeted by parent node if required - nodeRect.intersect(parentRect); - return nodeRect; + if (nodeRect.intersect(parentRect)) { + return nodeRect; + } else { + // Node rect has no intersection with parent Rect + return new Rect(); + } } /** |