Only query for columns we need in PhoneStateChangedReceiver. Hopefully fixes SQLite crash on Galaxy SII

pull/14/head
Sam Bosley 12 years ago
parent c538daf22a
commit 9a45aae5e2

@ -58,7 +58,7 @@ public class PhoneStateChangedReceiver extends BroadcastReceiver {
AndroidUtilities.sleepDeep(WAIT_BEFORE_READ_LOG); AndroidUtilities.sleepDeep(WAIT_BEFORE_READ_LOG);
Cursor calls = context.getContentResolver().query( Cursor calls = context.getContentResolver().query(
Calls.CONTENT_URI, Calls.CONTENT_URI,
null, new String[] { Calls.NUMBER, Calls.DATE, Calls.CACHED_NAME },
Calls.TYPE + " = ? AND " + Calls.NEW + " = ?", Calls.TYPE + " = ? AND " + Calls.NEW + " = ?",
new String[] { Integer.toString(Calls.MISSED_TYPE), "1" }, new String[] { Integer.toString(Calls.MISSED_TYPE), "1" },
Calls.DATE + " DESC" Calls.DATE + " DESC"
@ -89,9 +89,7 @@ public class PhoneStateChangedReceiver extends BroadcastReceiver {
int nameIndex = calls.getColumnIndex(Calls.CACHED_NAME); int nameIndex = calls.getColumnIndex(Calls.CACHED_NAME);
String name = calls.getString(nameIndex); String name = calls.getString(nameIndex);
int timeIndex = calls.getColumnIndex(Calls.DATE); String timeString = DateUtilities.getTimeString(context, new Date(date));
long time = calls.getLong(timeIndex);
String timeString = DateUtilities.getTimeString(context, new Date(time));
long contactId = getContactIdFromNumber(context, number); long contactId = getContactIdFromNumber(context, number);

Loading…
Cancel
Save