Don't freeze apps in the power exemption allow list.

Set the "should not freeze" flag in oom adjuster if the app
is in the power exemption allow list, as it doesn't make sense
to freeze such kind of apps. There is an existing call to
update the oom adj when the power exemption list changes.

Bug: 237178259
Bug: 231253560
Test: Manual - see b/237178259#comment20
Test: atest CachedAppOptimizerTest
Change-Id: I5fd1e623f60680b34096f0e58a088f72bf1089cb
This commit is contained in:
Jing Ji
2022-06-30 16:15:46 -07:00
parent bf0730ed68
commit 60e35ca3df

View File

@@ -1482,7 +1482,9 @@ public class OomAdjuster {
if (!cycleReEval) {
// Don't reset this flag when doing cycles re-evaluation.
state.setNoKillOnBgRestrictedAndIdle(false);
app.mOptRecord.setShouldNotFreeze(false);
// If this UID is currently allowlisted, it should not be frozen.
final UidRecord uidRec = app.getUidRecord();
app.mOptRecord.setShouldNotFreeze(uidRec != null && uidRec.isCurAllowListed());
}
final int appUid = app.info.uid;