Skip to content

Commit 08bab56

Browse files
committed
fix wrong substring
The tokenOffsets is the offset from trimed contentLine. But it is used in substring as the offset from un-trimed contentLine. How to reproduce bug (ICS and before): 1. Add a contact record with name and a phone number (ex. 090-1111-2222) 2. Search by "0" in Contacts app 3. Contacts shows a wrong number something like "0900111102222" Change-Id: I1e1cb2f3bd135d98e1573a50aa6ddc021af35b9f
1 parent 9f7fa4c commit 08bab56

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/java/android/provider/ContactsContract.java

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8362,7 +8362,7 @@ public static String snippetize(String content, String displayName, String query
83628362
// Line contains the query string - now search for it at the start of tokens.
83638363
List<String> lineTokens = new ArrayList<String>();
83648364
List<Integer> tokenOffsets = new ArrayList<Integer>();
8365-
split(contentLine.trim(), lineTokens, tokenOffsets);
8365+
split(contentLine, lineTokens, tokenOffsets);
83668366

83678367
// As we find matches against the query, we'll populate this list with the marked
83688368
// (or unchanged) tokens.

0 commit comments

Comments
 (0)