Fixes for UiSelector ignoring instance criterion
Reported by an external user. Information is in associated
bug: 8657729
Change-Id: I5f6314d132dc167be3f06dca315947408d54d713
diff --git a/uiautomator/library/core-src/com/android/uiautomator/core/UiSelector.java b/uiautomator/library/core-src/com/android/uiautomator/core/UiSelector.java
index c1ddb32..a5b188a 100644
--- a/uiautomator/library/core-src/com/android/uiautomator/core/UiSelector.java
+++ b/uiautomator/library/core-src/com/android/uiautomator/core/UiSelector.java
@@ -787,13 +787,13 @@
int currentSelectorInstance = 0;
// matched attributes - now check for matching instance number
- if(mSelectorAttributes.indexOfKey(UiSelector.SELECTOR_INSTANCE) > 0) {
+ if(mSelectorAttributes.indexOfKey(UiSelector.SELECTOR_INSTANCE) >= 0) {
currentSelectorInstance =
(Integer)mSelectorAttributes.get(UiSelector.SELECTOR_INSTANCE);
}
// instance is required. Add count if not already counting
- if(mSelectorAttributes.indexOfKey(UiSelector.SELECTOR_COUNT) > 0) {
+ if(mSelectorAttributes.indexOfKey(UiSelector.SELECTOR_COUNT) >= 0) {
currentSelectorCounter = (Integer)mSelectorAttributes.get(UiSelector.SELECTOR_COUNT);
}