MAP: Handle SMS address database query exception.
Handle white space in SMS address entry (TEXT String)
while running a database query . SMS address is generally
numerical digits without spaces. This is a good to have
fix to handle exceptional cases.
Change-Id: Ib5c8719e14ae765551cf80b85a05698265dacd97
CRs-fixed: 518526
diff --git a/src/org/codeaurora/bluetooth/map/BluetoothMasAppSmsMms.java b/src/org/codeaurora/bluetooth/map/BluetoothMasAppSmsMms.java
index 69fe818..55e967b 100644
--- a/src/org/codeaurora/bluetooth/map/BluetoothMasAppSmsMms.java
+++ b/src/org/codeaurora/bluetooth/map/BluetoothMasAppSmsMms.java
@@ -772,8 +772,9 @@
String address = cr.getString(cr.getColumnIndex("address"));
// Search the database for the given address
- Cursor crThreadId = mContext.getContentResolver().query(Uri.parse("content://sms/"),
- null, "address = " + address + " AND thread_id != -1", null, null);
+ String whereClause = "address = '" + address + "' AND thread_id != -1" ;
+ Cursor crThreadId = mContext.getContentResolver().query(Uri.parse("content://sms/"),null,
+ whereClause, null, null);
if (crThreadId != null && crThreadId.moveToFirst()) {
// A thread for the given address exists in the database
String threadIdStr = crThreadId.getString(crThreadId.getColumnIndex("thread_id"));