Loading src/com/android/dialer/SpecialCharSequenceMgr.java +27 −22 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.view.WindowManager; import android.widget.EditText; import android.widget.Toast; import com.android.common.io.MoreCloseables; import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler; /** Loading Loading @@ -377,6 +378,7 @@ public class SpecialCharSequenceMgr { */ @Override protected void onNotNullableQueryComplete(int token, Object cookie, Cursor c) { try { sPreviousAdnQueryHandler = null; if (mCanceled) { return; Loading Loading @@ -406,6 +408,9 @@ public class SpecialCharSequenceMgr { Toast.makeText(context, name, Toast.LENGTH_SHORT) .show(); } } finally { MoreCloseables.closeQuietly(c); } } public void cancel() { Loading src/com/android/dialer/calllog/CallLogAdapter.java +6 −3 Original line number Diff line number Diff line Loading @@ -1299,11 +1299,14 @@ public class CallLogAdapter extends GroupingListAdapter Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, number), PhoneQuery._PROJECTION, null, null, null); if (phonesCursor != null) { try { if (phonesCursor.moveToFirst()) { matchingNumber = phonesCursor.getString(PhoneQuery.MATCHED_NUMBER); } } finally { phonesCursor.close(); } } } catch (Exception e) { // Use the number from the call log } Loading src/com/android/dialer/database/DialerDatabaseHelper.java +46 −43 Original line number Diff line number Diff line Loading @@ -441,11 +441,12 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { public String getProperty(SQLiteDatabase db, String key, String defaultValue) { try { String value = null; final Cursor cursor = db.query(Tables.PROPERTIES, new String[] {PropertiesColumns.PROPERTY_VALUE}, PropertiesColumns.PROPERTY_KEY + "=?", new String[] {key}, null, null, null); String value = null; if (cursor != null) { try { if (cursor.moveToFirst()) { value = cursor.getString(0); Loading @@ -453,6 +454,7 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { } finally { cursor.close(); } } return value != null ? value : defaultValue; } catch (SQLiteException e) { return defaultValue; Loading Loading @@ -770,21 +772,21 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { final Cursor updatedContactCursor = mContext.getContentResolver().query(PhoneQuery.URI, PhoneQuery.PROJECTION, PhoneQuery.SELECTION, new String[]{lastUpdateMillis}, null); if (updatedContactCursor == null) { if (DEBUG) { Log.e(TAG, "SmartDial query received null for cursor"); } return; } /** Sets the time after querying the database as the current update time. */ final Long currentMillis = System.currentTimeMillis(); try { if (DEBUG) { stopWatch.lap("Queried the Contacts database"); } if (updatedContactCursor == null) { if (DEBUG) { Log.e(TAG, "SmartDial query received null for cursor"); } return; } /** Prevents the app from reading the dialer database when updating. */ sInUpdate.getAndSet(true); Loading @@ -796,7 +798,6 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { stopWatch.lap("Finished deleting deleted entries"); } try { /** If the database did not exist before, jump through deletion as there is nothing * to delete. */ Loading Loading @@ -830,12 +831,12 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { " WHERE " + SmartDialDbColumns.LAST_SMARTDIAL_UPDATE_TIME + " = " + Long.toString(currentMillis), new String[] {}); if (nameCursor != null) { try { if (DEBUG) { stopWatch.lap("Queried the smart dial table for contact names"); } if (nameCursor != null) { try { /** Inserts prefixes of names into the prefix table.*/ insertNamePrefixes(db, nameCursor); if (DEBUG) { Loading Loading @@ -936,7 +937,10 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { " LIKE '" + looseQuery + "')" + " ORDER BY " + SmartDialSortingOrder.SORT_ORDER, new String[] {currentTimeStamp}); if (cursor == null) { return result; } try { if (DEBUG) { stopWatch.lap("Prefix query completed"); } Loading @@ -954,7 +958,6 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { final Set<ContactMatch> duplicates = new HashSet<ContactMatch>(); int counter = 0; try { if (DEBUG) { stopWatch.lap("Moved cursor to start"); } Loading src/com/android/dialer/interactions/PhoneNumberInteraction.java +25 −22 Original line number Diff line number Diff line Loading @@ -380,13 +380,17 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { @Override public void onLoadComplete(Loader<Cursor> loader, Cursor cursor) { if (cursor == null || !isSafeToCommitTransactions()) { if (cursor == null) { onDismiss(); return; } try { ArrayList<PhoneItem> phoneList = new ArrayList<PhoneItem>(); String primaryPhone = null; try { if (!isSafeToCommitTransactions()) { onDismiss(); return; } while (cursor.moveToNext()) { if (mContactId == UNKNOWN_CONTACT_ID) { mContactId = cursor.getLong(CONTACT_ID); Loading @@ -408,9 +412,6 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { phoneList.add(item); } } finally { cursor.close(); } if (mUseDefault && primaryPhone != null) { performAction(primaryPhone); Loading @@ -419,7 +420,6 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { } Collapser.collapseList(phoneList, mContext); if (phoneList.size() == 0) { onDismiss(); } else if (phoneList.size() == 1) { Loading @@ -430,6 +430,9 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { // There are multiple candidates. Let the user choose one. showDisambiguationDialog(phoneList); } } finally { cursor.close(); } } private boolean isSafeToCommitTransactions() { Loading Loading
src/com/android/dialer/SpecialCharSequenceMgr.java +27 −22 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.view.WindowManager; import android.widget.EditText; import android.widget.Toast; import com.android.common.io.MoreCloseables; import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler; /** Loading Loading @@ -377,6 +378,7 @@ public class SpecialCharSequenceMgr { */ @Override protected void onNotNullableQueryComplete(int token, Object cookie, Cursor c) { try { sPreviousAdnQueryHandler = null; if (mCanceled) { return; Loading Loading @@ -406,6 +408,9 @@ public class SpecialCharSequenceMgr { Toast.makeText(context, name, Toast.LENGTH_SHORT) .show(); } } finally { MoreCloseables.closeQuietly(c); } } public void cancel() { Loading
src/com/android/dialer/calllog/CallLogAdapter.java +6 −3 Original line number Diff line number Diff line Loading @@ -1299,11 +1299,14 @@ public class CallLogAdapter extends GroupingListAdapter Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, number), PhoneQuery._PROJECTION, null, null, null); if (phonesCursor != null) { try { if (phonesCursor.moveToFirst()) { matchingNumber = phonesCursor.getString(PhoneQuery.MATCHED_NUMBER); } } finally { phonesCursor.close(); } } } catch (Exception e) { // Use the number from the call log } Loading
src/com/android/dialer/database/DialerDatabaseHelper.java +46 −43 Original line number Diff line number Diff line Loading @@ -441,11 +441,12 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { public String getProperty(SQLiteDatabase db, String key, String defaultValue) { try { String value = null; final Cursor cursor = db.query(Tables.PROPERTIES, new String[] {PropertiesColumns.PROPERTY_VALUE}, PropertiesColumns.PROPERTY_KEY + "=?", new String[] {key}, null, null, null); String value = null; if (cursor != null) { try { if (cursor.moveToFirst()) { value = cursor.getString(0); Loading @@ -453,6 +454,7 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { } finally { cursor.close(); } } return value != null ? value : defaultValue; } catch (SQLiteException e) { return defaultValue; Loading Loading @@ -770,21 +772,21 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { final Cursor updatedContactCursor = mContext.getContentResolver().query(PhoneQuery.URI, PhoneQuery.PROJECTION, PhoneQuery.SELECTION, new String[]{lastUpdateMillis}, null); if (updatedContactCursor == null) { if (DEBUG) { Log.e(TAG, "SmartDial query received null for cursor"); } return; } /** Sets the time after querying the database as the current update time. */ final Long currentMillis = System.currentTimeMillis(); try { if (DEBUG) { stopWatch.lap("Queried the Contacts database"); } if (updatedContactCursor == null) { if (DEBUG) { Log.e(TAG, "SmartDial query received null for cursor"); } return; } /** Prevents the app from reading the dialer database when updating. */ sInUpdate.getAndSet(true); Loading @@ -796,7 +798,6 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { stopWatch.lap("Finished deleting deleted entries"); } try { /** If the database did not exist before, jump through deletion as there is nothing * to delete. */ Loading Loading @@ -830,12 +831,12 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { " WHERE " + SmartDialDbColumns.LAST_SMARTDIAL_UPDATE_TIME + " = " + Long.toString(currentMillis), new String[] {}); if (nameCursor != null) { try { if (DEBUG) { stopWatch.lap("Queried the smart dial table for contact names"); } if (nameCursor != null) { try { /** Inserts prefixes of names into the prefix table.*/ insertNamePrefixes(db, nameCursor); if (DEBUG) { Loading Loading @@ -936,7 +937,10 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { " LIKE '" + looseQuery + "')" + " ORDER BY " + SmartDialSortingOrder.SORT_ORDER, new String[] {currentTimeStamp}); if (cursor == null) { return result; } try { if (DEBUG) { stopWatch.lap("Prefix query completed"); } Loading @@ -954,7 +958,6 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { final Set<ContactMatch> duplicates = new HashSet<ContactMatch>(); int counter = 0; try { if (DEBUG) { stopWatch.lap("Moved cursor to start"); } Loading
src/com/android/dialer/interactions/PhoneNumberInteraction.java +25 −22 Original line number Diff line number Diff line Loading @@ -380,13 +380,17 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { @Override public void onLoadComplete(Loader<Cursor> loader, Cursor cursor) { if (cursor == null || !isSafeToCommitTransactions()) { if (cursor == null) { onDismiss(); return; } try { ArrayList<PhoneItem> phoneList = new ArrayList<PhoneItem>(); String primaryPhone = null; try { if (!isSafeToCommitTransactions()) { onDismiss(); return; } while (cursor.moveToNext()) { if (mContactId == UNKNOWN_CONTACT_ID) { mContactId = cursor.getLong(CONTACT_ID); Loading @@ -408,9 +412,6 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { phoneList.add(item); } } finally { cursor.close(); } if (mUseDefault && primaryPhone != null) { performAction(primaryPhone); Loading @@ -419,7 +420,6 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { } Collapser.collapseList(phoneList, mContext); if (phoneList.size() == 0) { onDismiss(); } else if (phoneList.size() == 1) { Loading @@ -430,6 +430,9 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { // There are multiple candidates. Let the user choose one. showDisambiguationDialog(phoneList); } } finally { cursor.close(); } } private boolean isSafeToCommitTransactions() { Loading