Avoid forced compactions from sending stats

This is because forced compactions do not need to pollute our metrics
and they would allow compacting things that we usually would not allow
they are used either for debugging or for lab testing.

Bug: 264598052
Change-Id: I1ddad48aa02b72afacfdedd8bb54feb9d48f41a6
This commit is contained in:
Edgar Arriaga
2023-01-06 00:45:33 +00:00
parent 718b40ddaf
commit 046bfa0c09

View File

@@ -1860,7 +1860,10 @@ public final class CachedAppOptimizer {
mLastCompactionStats.remove(pid);
mLastCompactionStats.put(pid, memStats);
mCompactionStatsHistory.add(memStats);
memStats.sendStat();
if (!forceCompaction) {
// Avoid polluting field metrics with forced compactions.
memStats.sendStat();
}
break;
default:
// We likely missed adding this category, it needs to be added