From e451771a8fd90d4edcc5a93b607d51560ca46905 Mon Sep 17 00:00:00 2001 From: Richard Gaywood Date: Fri, 5 Feb 2021 15:53:00 +0000 Subject: [PATCH] Stop passing in statsFile fds as they will be leaked when returned to the caller. This is safe, as getCommittedStatsMerged() supports null-able values for the List. Test: local compile and test; atom still pulls successfully. Change-Id: I083ea1150f54c5970fbf60ae320809d27c4f3207 Bug: 179008261 --- .../com/android/server/stats/pull/StatsPullAtomService.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java index 263776c63db6c..5e681c674d8ba 100644 --- a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java +++ b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java @@ -2509,7 +2509,6 @@ public class StatsPullAtomService extends SystemService { try { // force procstats to flush & combine old files into one store long lastHighWaterMark = readProcStatsHighWaterMark(section); - List statsFiles = new ArrayList<>(); ProtoOutputStream[] protoStreams = new ProtoOutputStream[MAX_PROCSTATS_SHARDS]; for (int i = 0; i < protoStreams.length; i++) { @@ -2519,7 +2518,7 @@ public class StatsPullAtomService extends SystemService { ProcessStats procStats = new ProcessStats(false); // Force processStatsService to aggregate all in-storage and in-memory data. long highWaterMark = processStatsService.getCommittedStatsMerged( - lastHighWaterMark, section, true, statsFiles, procStats); + lastHighWaterMark, section, true, null, procStats); procStats.dumpAggregatedProtoForStatsd(protoStreams, MAX_PROCSTATS_RAW_SHARD_SIZE); for (int i = 0; i < protoStreams.length; i++) {