summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yabin Huang <yabinh@google.com> 2020-01-16 13:32:59 -0800
committer Yabin Huang <yabinh@google.com> 2020-01-16 14:29:16 -0800
commitef8a8ac927ba131c1d4a44bcc97663f389e8f6ac (patch)
treef31a32a4d2bed254a29ed494a9a88b5133632546
parent794d53e7ffadbab7b4fb28de47ae9d5f4e7c813d (diff)
Don't use View ID to search next focus backward View
There might be several Views with the same ID in View hierarchy, and if we search the user specified next focused view by comparing the View ID, it may return the wrong View with the same ID. To fix that, we should compare the View itself. Fixes: 147829061 Test: manual Change-Id: I3eeb68ed3ea30ce9461165eea56227cb81b21929
-rw-r--r--core/java/android/view/View.java3
1 files changed, 1 insertions, 2 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 562ed0eb8e70..6724e9d3289d 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -12602,11 +12602,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
return findViewInsideOutShouldExist(root, mNextFocusForwardId);
case FOCUS_BACKWARD: {
if (mID == View.NO_ID) return null;
- final int id = mID;
return root.findViewByPredicateInsideOut(this, new Predicate<View>() {
@Override
public boolean test(View t) {
- return t.mNextFocusForwardId == id;
+ return t.findViewById(t.mNextFocusForwardId) == View.this;
}
});
}