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

Commit 9b48e987 authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Ensure that a Cursor that throws an Exception is logged properly

Bug: 297858375
Test: atest CtsTelecomTestCases:ThirdPartyCallScreeningServiceTest
Change-Id: Iab621d7d8837b36878c27796891b197610c212a4
parent 2303698c
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -664,19 +664,16 @@ public final class CallLogManager extends CallsManagerListenerBase {
            }
            int maxCallId = -1;
            int numFound;
            Cursor countCursor = resolver.query(providerUri,
            try (Cursor countCursor = resolver.query(providerUri,
                    new String[]{Calls._ID},
                    null,
                    null,
                    Calls._ID + " DESC");
            try {
                    Calls._ID + " DESC")) {
                numFound = countCursor.getCount();
                if (numFound > 0) {
                    countCursor.moveToFirst();
                    maxCallId = countCursor.getInt(0);
                }
            } finally {
                countCursor.close();
            }
            return new Pair<>(numFound, maxCallId);
        } catch (Exception e) {