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

Commit 716998e6 authored by Jing Ji's avatar Jing Ji
Browse files

Reset pending oomadj target list after oomadj update

Bug: 188060432
Test: atest ActivityManagerFgsBgStartTest
Test: atest FrameworksServicesTests:ActivityManagerTest
Test: atest MockingOomAdjusterTests
Test: atest CtsAppTestCases:ActivityManagerProcessStateTest
Change-Id: I68b80e9ad767f8508b43589734ed0aa18138a555
parent 24367cc0
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -694,6 +694,8 @@ public class OomAdjuster {
        boolean containsCycle = collectReachableProcessesLocked(mPendingProcessSet,
                processes, uids);

        // Clear the pending set as they should've been included in 'processes'.
        mPendingProcessSet.clear();
        // Reset the flag
        state.setReachable(false);
        // Remove this app from the return list because we've done the computation on it.
@@ -767,10 +769,6 @@ public class OomAdjuster {
                }
                queue.offer(service);
                service.mState.setReachable(true);
                // During scanning the reachable dependants, remove them from the pending oomadj
                // targets list if it's possible, as they've been added into the immediate
                // oomadj targets list 'processes' above.
                mPendingProcessSet.remove(service);
            }
            final ProcessProviderRecord ppr = pr.mProviders;
            for (int i = ppr.numberOfProviderConnections() - 1; i >= 0; i--) {
@@ -786,10 +784,6 @@ public class OomAdjuster {
                }
                queue.offer(provider);
                provider.mState.setReachable(true);
                // During scanning the reachable dependants, remove them from the pending oomadj
                // targets list if it's possible, as they've been added into the immediate
                // oomadj targets list 'processes' above.
                mPendingProcessSet.remove(provider);
            }
        }

@@ -887,11 +881,11 @@ public class OomAdjuster {
        final ArrayList<ProcessRecord> processes = mTmpProcessList;
        final ActiveUids uids = mTmpUidRecords;
        collectReachableProcessesLocked(mPendingProcessSet, processes, uids);
        mPendingProcessSet.clear();
        synchronized (mProcLock) {
            updateOomAdjInnerLSP(oomAdjReason, topApp, processes, uids, true, false);
        }
        processes.clear();
        mPendingProcessSet.clear();

        mService.mOomAdjProfiler.oomAdjEnded();
        Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);