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

Commit 17072cef authored by Tim Murray's avatar Tim Murray
Browse files

OomAdjuster: skip persistent/system processes in cycle detection

Apps with negative oom_adj scores are either system_server or
persistent. As a result, those apps don't need to be considered in
cycle detection because no binding to that app can possibly promote
the persistent process to a more important process state.

Bug: 260854804
Test: atest MockingOomAdjusterTests

Change-Id: I632dc41a5660935b9c49af3c01243314dab4cc0a
parent 465e1a92
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -704,7 +704,9 @@ public class OomAdjuster {
                ConnectionRecord cr = psr.getConnectionAt(i);
                ProcessRecord service = (cr.flags & ServiceInfo.FLAG_ISOLATED_PROCESS) != 0
                        ? cr.binding.service.isolationHostProc : cr.binding.service.app;
                if (service == null || service == pr) {
                if (service == null || service == pr
                        || ((service.mState.getMaxAdj() >= ProcessList.SYSTEM_ADJ)
                                && (service.mState.getMaxAdj() < FOREGROUND_APP_ADJ))) {
                    continue;
                }
                containsCycle |= service.mState.isReachable();
@@ -724,7 +726,9 @@ public class OomAdjuster {
            for (int i = ppr.numberOfProviderConnections() - 1; i >= 0; i--) {
                ContentProviderConnection cpc = ppr.getProviderConnectionAt(i);
                ProcessRecord provider = cpc.provider.proc;
                if (provider == null || provider == pr) {
                if (provider == null || provider == pr
                        || ((provider.mState.getMaxAdj() >= ProcessList.SYSTEM_ADJ)
                                && (provider.mState.getMaxAdj() < FOREGROUND_APP_ADJ))) {
                    continue;
                }
                containsCycle |= provider.mState.isReachable();