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

Commit 9a8117c4 authored by Steve Kondik's avatar Steve Kondik
Browse files

am: Allow more hidden apps on devices with lots of RAM

 * If more than 1.5GB is present, allow up to 40 hidden apps.
 * Number is somewhat arbitrary, but was found to work well on D2.
 * Also look at the sys.mem.max_hidden_apps value if given.

Change-Id: I2d3cf6e0dad1bc0b482cc37bf9c61ed2f2b4be51
parent e943a896
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import com.android.internal.util.MemInfoReader;
import com.android.server.wm.WindowManagerService;

import android.graphics.Point;
import android.os.SystemProperties;
import android.util.Slog;

/**
@@ -100,7 +101,15 @@ class ProcessList {
    // The maximum number of hidden processes we will keep around before
    // killing them; this is just a control to not let us go too crazy with
    // keeping around processes on devices with large amounts of RAM.
    static final int MAX_HIDDEN_APPS = 15;
    static final int MAX_HIDDEN_APPS;

    static {
        // Allow more hidden apps on huge memory devices (1.5GB or higher)
        // or fetch from the system property
        MemInfoReader mi = new MemInfoReader();
        MAX_HIDDEN_APPS = SystemProperties.getInt("sys.mem.max_hidden_apps",
                mi.getTotalSize() > 1572864 ? 40 : 15);
    }

    // We put empty content processes after any hidden processes that have
    // been idle for less than 15 seconds.