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

Commit bbaef0ba authored by Ricky Wai's avatar Ricky Wai
Browse files

Fix cannot generate network watchlist report when database is empty

It should still generate watchlist report when no apps visited watchlist.

Bug: 63908748
Test: Confirm that watchlist report will still be generated no record in db
Change-Id: Iea4893bc6e40086b9756492abaa00812021a6fa8
parent 7f0087be
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -186,6 +186,10 @@ class WatchlistLoggingHandler extends Handler {
                    System.currentTimeMillis());
            final WatchlistReportDbHelper.AggregatedResult aggregatedResult =
                    mDbHelper.getAggregatedRecords();
            if (aggregatedResult == null) {
                Slog.i(TAG, "Cannot get result from database");
                return;
            }
            // Get all digests for watchlist report, it should include all installed
            // application digests and previously recorded app digests.
            final List<String> digestsForReport = getAllDigestsForReport(aggregatedResult);
+3 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.net.watchlist;

import android.annotation.Nullable;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
@@ -79,7 +80,7 @@ class WatchlistReportDbHelper extends SQLiteOpenHelper {
        final Set<String> appDigestList;

        // The c&c domain or ip visited before.
        final String cncDomainVisited;
        @Nullable final String cncDomainVisited;

        // A list of app digests and c&c domain visited.
        final HashMap<String, String> appDigestCNCList;
@@ -155,7 +156,7 @@ class WatchlistReportDbHelper extends SQLiteOpenHelper {
                    WhiteListReportContract.TABLE, DIGEST_DOMAIN_PROJECTION, selectStatement,
                    new String[]{"" + twoDaysBefore, "" + yesterday}, null, null,
                    null, null);
            if (c == null || c.getCount() == 0) {
            if (c == null) {
                return null;
            }
            final HashSet<String> appDigestList = new HashSet<>();