From 08bab56f687a354a436925ec44567da434c10cbb Mon Sep 17 00:00:00 2001 From: Masanori Ogino Date: Thu, 23 Aug 2012 14:06:45 +0900 Subject: [PATCH] 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 --- core/java/android/provider/ContactsContract.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 core/java/android/provider/ContactsContract.java diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java old mode 100644 new mode 100755 index 8e123ac63f0ad..e7b0579726f04 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -8362,7 +8362,7 @@ public final class ContactsContract { // Line contains the query string - now search for it at the start of tokens. List lineTokens = new ArrayList(); List tokenOffsets = new ArrayList(); - split(contentLine.trim(), lineTokens, tokenOffsets); + split(contentLine, lineTokens, tokenOffsets); // As we find matches against the query, we'll populate this list with the marked // (or unchanged) tokens.