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

Commit c34a41e5 authored by Kazuki Nakayama's avatar Kazuki Nakayama Committed by Steve Kondik
Browse files

Avoid overwriting SYSTEM_ADJ with PERSISTENT_PROC_ADJ

If an application running on system_process has a persistent flag,
the oom_adj value for system_process is unexpectedly overwritten
to PERSISTENT_PROC_ADJ (-12).

We must keep SYSTEM_ADJ (-16) for system_process.
This change guards against overwriting SYSTEM_ADJ with
PERSISTENT_PROC_ADJ

Change-Id: I8f334d93b82271f9a0cfbbef34a75af2dacb186b
parent fe57d721
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -10244,8 +10244,14 @@ public final class ActivityManagerService extends ActivityManagerNative
        if ((info.flags & PERSISTENT_MASK) == PERSISTENT_MASK) {
            app.persistent = true;
            // The Adj score defines an order of processes to be killed.
            // If a process is shared by multiple apps, maxAdj must be set by the highest
            // prioritized app to avoid being killed.
            if (app.maxAdj >= ProcessList.PERSISTENT_PROC_ADJ) {
                app.maxAdj = ProcessList.PERSISTENT_PROC_ADJ;
            }
        }
        if (app.thread == null && mPersistentStartingProcesses.indexOf(app) < 0) {
            mPersistentStartingProcesses.add(app);
            startProcessLocked(app, "added application", app.processName, abiOverride,