Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4f1df11 authored by Kihong Seong's avatar Kihong Seong
Browse files

Close cursor with try resource statement in CallLogPullRequest

Bug: 267098091
Test: atest BluetoothInstrumentationTests
Change-Id: Ia3e748a9e8cfcb5f827292eede44edb7338477e7
parent b1f046b8
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ public class CallLogPullRequest extends PullRequest {
            values.put(ContactsContract.RawContacts.TIMES_CONTACTED, mCallCounter.get(key));
            Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI,
                    Uri.encode(key));
            Cursor c = mContext.getContentResolver().query(uri, null, null, null);
            try (Cursor c = mContext.getContentResolver().query(uri, null, null, null)) {
                if (c != null && c.getCount() > 0) {
                    c.moveToNext();
                    String contactId = c.getString(c.getColumnIndex(
@@ -160,6 +160,7 @@ public class CallLogPullRequest extends PullRequest {
                            ContactsContract.RawContacts.CONTENT_URI, values, where, null);
                }
            }
        }
        if (DBG) {
            Log.d(TAG, "Updated TIMES_CONTACTED");
        }