summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2012-01-18 18:02:46 -0800
committerGilles Debunne <debunne@google.com>2012-01-18 18:39:10 -0800
commitf0d3b7ff72511c9f6b9bf228e5b14ba6a2e35f34 (patch)
treeaf23380126249dfe67a0116d18069ab20a59d8f6
parentb2d81fead90f556279d611b6f15881c663558ad5 (diff)
downloadframeworks_base-f0d3b7ff72511c9f6b9bf228e5b14ba6a2e35f34.zip
frameworks_base-f0d3b7ff72511c9f6b9bf228e5b14ba6a2e35f34.tar.gz
frameworks_base-f0d3b7ff72511c9f6b9bf228e5b14ba6a2e35f34.tar.bz2
AOOB in AutoComplete
Bug 5749557 Not clear how we can get an AOOB in that case. tmp will always have the right length, and indeed the stack trace attached to that bug shows a correct size of 10. However, there is an index issue when we build the new completion array. i is not the correct index to use. Note however that the original buildDropDown method mentioned is no longer present in the file. I tried to backtrack, but the use of arraycopy always seemed correct. Change-Id: Idf749c74b38923b5d18596c8e8f6ea887cc897d6
-rw-r--r--core/java/android/widget/AutoCompleteTextView.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index 07523e3..f7a6b27 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -1085,10 +1085,11 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
for (int i = 0; i < count; i++) {
if (adapter.isEnabled(i)) {
- realCount++;
Object item = adapter.getItem(i);
long id = adapter.getItemId(i);
- completions[i] = new CompletionInfo(id, i, convertSelectionToString(item));
+ completions[realCount] = new CompletionInfo(id, realCount,
+ convertSelectionToString(item));
+ realCount++;
}
}