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

Commit 4cb165d0 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 dfca28ba
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -10069,8 +10069,14 @@ public final class ActivityManagerService extends ActivityManagerNative
        if ((info.flags&(ApplicationInfo.FLAG_SYSTEM|ApplicationInfo.FLAG_PERSISTENT))
                == (ApplicationInfo.FLAG_SYSTEM|ApplicationInfo.FLAG_PERSISTENT)) {
            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,