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

Commit 240ad971 authored by Ricky Wai's avatar Ricky Wai Committed by Android (Google) Code Review
Browse files

Merge "Fix cannot generate network watchlist report when database is empty"

parents 0d2d90d2 bbaef0ba
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -186,6 +186,10 @@ class WatchlistLoggingHandler extends Handler {
                    System.currentTimeMillis());
                    System.currentTimeMillis());
            final WatchlistReportDbHelper.AggregatedResult aggregatedResult =
            final WatchlistReportDbHelper.AggregatedResult aggregatedResult =
                    mDbHelper.getAggregatedRecords();
                    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
            // Get all digests for watchlist report, it should include all installed
            // application digests and previously recorded app digests.
            // application digests and previously recorded app digests.
            final List<String> digestsForReport = getAllDigestsForReport(aggregatedResult);
            final List<String> digestsForReport = getAllDigestsForReport(aggregatedResult);
+3 −2
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.server.net.watchlist;
package com.android.server.net.watchlist;


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


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