Follow-up on previous fix.
Correctly handle the case of a null country iso when working with an
upgraded call log.
The syntax for nulls requires the value to be passes as "IS NULL"
instead of using "= ?" and passing a null value.
Bug: 5638376
Change-Id: Icdc0278570495d4abff453e8505649c2b7425c99
diff --git a/src/com/android/contacts/calllog/CallLogAdapter.java b/src/com/android/contacts/calllog/CallLogAdapter.java
index 37beba3..99ba8e8 100644
--- a/src/com/android/contacts/calllog/CallLogAdapter.java
+++ b/src/com/android/contacts/calllog/CallLogAdapter.java
@@ -650,14 +650,15 @@
return;
}
- StringBuilder where = new StringBuilder();
- where.append(Calls.NUMBER);
- where.append(" = ? AND ");
- where.append(Calls.COUNTRY_ISO);
- where.append(" = ?");
-
- mContext.getContentResolver().update(Calls.CONTENT_URI_WITH_VOICEMAIL, values,
- where.toString(), new String[]{ number, countryIso });
+ if (countryIso == null) {
+ mContext.getContentResolver().update(Calls.CONTENT_URI_WITH_VOICEMAIL, values,
+ Calls.NUMBER + " = ? AND " + Calls.COUNTRY_ISO + " IS NULL",
+ new String[]{ number });
+ } else {
+ mContext.getContentResolver().update(Calls.CONTENT_URI_WITH_VOICEMAIL, values,
+ Calls.NUMBER + " = ? AND " + Calls.COUNTRY_ISO + " = ?",
+ new String[]{ number, countryIso });
+ }
}
/** Returns the contact information as stored in the call log. */