Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cherry-pick Fix for GB upgrade issue with phone lookups.

This is a cherrypick from master for this CL
Iea81bc4163cb89169946f9a33f9e15b13e8868ad

This just generalizes a fix that Shaopeng had for Brazilian phone
numbers, in which it was possible that the caller ID number being
checked was shorter than the normalized number we had stored.  We
essentially accept a phone number as a match if the shorter of
either (caller ID, normalized number) is a trailing prefix of the
other.

Bug: 5638376
Change-Id: Id61d5295272106a05af14d3c2ce1695eaf2dd372
  • Loading branch information...
commit 1bc8603830a07b4ff641bf74227c654c99a8473b 1 parent a02fe8b
Dave Santoro authored Katherine Kuan committed
Showing with 11 additions and 11 deletions.
  1. +11 −11 src/com/android/providers/contacts/ContactsDatabaseHelper.java
View
22 src/com/android/providers/contacts/ContactsDatabaseHelper.java
@@ -4209,20 +4209,20 @@ private void appendPhoneLookupSelection(StringBuilder sb, String number, String
sb.append(',');
sb.append(numberLen);
sb.append(" - lookup.len + 1) = lookup.normalized_number");
+
// Some countries (e.g. Brazil) can have incoming calls which contain only the local
// number (no country calling code and no area code). This case is handled below.
// Details see b/5197612.
- if (!hasNumberE164) {
- sb.append(" OR (");
- sb.append(" lookup.len > ");
- sb.append(numberLen);
- sb.append(" AND substr(lookup.normalized_number,");
- sb.append("lookup.len + 1 - ");
- sb.append(numberLen);
- sb.append(") = ");
- DatabaseUtils.appendEscapedSQLString(sb, number);
- sb.append(")");
- }
+ // This also handles a Gingerbread -> ICS upgrade issue; see b/5638376.
+ sb.append(" OR (");
+ sb.append(" lookup.len > ");
+ sb.append(numberLen);
+ sb.append(" AND substr(lookup.normalized_number,");
+ sb.append("lookup.len + 1 - ");
+ sb.append(numberLen);
+ sb.append(") = ");
+ DatabaseUtils.appendEscapedSQLString(sb, number);
+ sb.append(")");
}
sb.append(')');
}
Please sign in to comment.
Something went wrong with that request. Please try again.