Avoid full compaction when apps move within Cached bucket

This patch reduces the amount of times we trigger full compactions
that currently happen at any OOM adjust change when the app is
within the Cached state bucket as it was identified that there
were many instances of this situation.

Bug: 232311101
Test: Checked that the number of full compactions went down in
dumpsys activity

Change-Id: If4995432cbf770227ebd60dad2889522d98b103d
This commit is contained in:
Edgar Arriaga
2022-05-11 18:32:19 -07:00
committed by Edgar Arriaga García
parent 414923e81a
commit 7f4d90343c

View File

@@ -1235,7 +1235,8 @@ public final class CachedAppOptimizer {
&& (newAdj == ProcessList.PREVIOUS_APP_ADJ || newAdj == ProcessList.HOME_APP_ADJ)) {
// Perform a minor compaction when a perceptible app becomes the prev/home app
compactAppSome(app, false);
} else if (newAdj >= ProcessList.CACHED_APP_MIN_ADJ
} else if (oldAdj < ProcessList.CACHED_APP_MIN_ADJ
&& newAdj >= ProcessList.CACHED_APP_MIN_ADJ
&& newAdj <= ProcessList.CACHED_APP_MAX_ADJ) {
// Perform a major compaction when any app enters cached
compactAppFull(app, false);