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

Commit f222cf91 authored by Stephen Bird's avatar Stephen Bird
Browse files

InCallMetrics: null check our content resolver query

This fixes a crash on boot with encrypted devices

Change-Id: Ica0343a2713708a27cbce1594dfee742022f35ce
Ticket: NIGHTLIES-2825
parent 9e8a087d
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ public class InCallMetricsReceiver extends IntentService {
    }

    @VisibleForTesting
    /* package */ static ArrayList<Event> lookupCallsSince(long time,
    /* package */ static void lookupCallsSince(long time,
            ContentResolver contentResolver) {

        Uri uri = CallLogConstants.CONTENT_ALL_URI.buildUpon().build();
@@ -96,6 +96,11 @@ public class InCallMetricsReceiver extends IntentService {

        Cursor c = contentResolver.query(uri, projection, where, args, null);

        // Ensure that our ContentProvider was available to return a cursor
        if (c == null) {
            return;
        }

        HashMap<String, HashMap<String, Object>> keys = new HashMap<>();

        while (c.moveToNext()) {
@@ -176,7 +181,6 @@ public class InCallMetricsReceiver extends IntentService {

        c.close();

        ArrayList<Event> listOfEvents = new ArrayList<>();
        for (String key : keys.keySet()) {
            // Shippit
            HashMap<String, Object> value = keys.get(key);
@@ -214,14 +218,10 @@ public class InCallMetricsReceiver extends IntentService {
                }
            }

            Event sentEvent = InCallMetricsHelper.sendEvent(InCallMetricsHelper
                    .Categories.CALLS, event, params,
            InCallMetricsHelper.sendEvent(InCallMetricsHelper.Categories.CALLS, event, params,
                    ComponentName.unflattenFromString(pluginComponent));


            listOfEvents.add(sentEvent);
        }
        return listOfEvents;
    }
}