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

Commit 444ad6a7 authored by Kweku Adams's avatar Kweku Adams
Browse files

Set defaults for cached and empty processes.

Values for cached and empty processes are read from DeviceConfig.
There's no reason to update the values when Settings constants change,
so removing that call.

Also, since we switched to loading DeviceConfig flags in a loop, the
defaults would never be set for cached and empty processes, so fixing
that by explicitly setting defaults, which is consistent with all the
other constants in this file.

Bug: N/A
Test: Android builds
Change-Id: Iec1973d9c7eb5440311a0a51d5616c87ee677f3f
parent 12ef2655
Loading
Loading
Loading
Loading
+5 −6
Original line number Original line Diff line number Diff line
@@ -304,18 +304,19 @@ final class ActivityManagerConstants extends ContentObserver {
    // we have no limit on the number of service, visible, foreground, or other such
    // we have no limit on the number of service, visible, foreground, or other such
    // processes and the number of those processes does not count against the cached
    // processes and the number of those processes does not count against the cached
    // process limit.
    // process limit.
    public int CUR_MAX_CACHED_PROCESSES;
    public int CUR_MAX_CACHED_PROCESSES = DEFAULT_MAX_CACHED_PROCESSES;


    // The maximum number of empty app processes we will let sit around.
    // The maximum number of empty app processes we will let sit around.
    public int CUR_MAX_EMPTY_PROCESSES;
    public int CUR_MAX_EMPTY_PROCESSES = computeEmptyProcessLimit(CUR_MAX_CACHED_PROCESSES);


    // The number of empty apps at which we don't consider it necessary to do
    // The number of empty apps at which we don't consider it necessary to do
    // memory trimming.
    // memory trimming.
    public int CUR_TRIM_EMPTY_PROCESSES;
    public int CUR_TRIM_EMPTY_PROCESSES = computeEmptyProcessLimit(MAX_CACHED_PROCESSES) / 2;


    // The number of cached at which we don't consider it necessary to do
    // The number of cached at which we don't consider it necessary to do
    // memory trimming.
    // memory trimming.
    public int CUR_TRIM_CACHED_PROCESSES;
    public int CUR_TRIM_CACHED_PROCESSES =
            (MAX_CACHED_PROCESSES - computeEmptyProcessLimit(MAX_CACHED_PROCESSES)) / 3;


    /**
    /**
     * Packages that can't be killed even if it's requested to be killed on imperceptible.
     * Packages that can't be killed even if it's requested to be killed on imperceptible.
@@ -550,8 +551,6 @@ final class ActivityManagerConstants extends ContentObserver {


            // For new flags that are intended for server-side experiments, please use the new
            // For new flags that are intended for server-side experiments, please use the new
            // DeviceConfig package.
            // DeviceConfig package.

            updateMaxCachedProcesses();
        }
        }
    }
    }