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

Commit 0aa1af24 authored by Chiawei Wang's avatar Chiawei Wang Committed by Automerger Merge Worker
Browse files

Merge "Add config_customizedMaxCachedProcesses to symbols.xml" into sc-dev am: bb8c2fa6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14972863

Change-Id: I02166e9dc4e30e68f2413e143928b4e07c61f548
parents 4718d33e bb8c2fa6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -5041,4 +5041,7 @@
    <!-- The default number of times per second that the seconds hand on AnalogClock ticks. If set
         to 0, the seconds hand will be disabled. -->
    <integer name="config_defaultAnalogClockSecondsHandFps">1</integer>

    <!-- the number of the max cached processes in the system. -->
    <integer name="config_customizedMaxCachedProcesses">32</integer>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -4423,4 +4423,6 @@
  <java-symbol type="dimen" name="config_wallpaperDimAmount" />

  <java-symbol type="bool" name="config_volumeShowRemoteSessions" />

  <java-symbol type="integer" name="config_customizedMaxCachedProcesses" />
</resources>
+13 −6
Original line number Diff line number Diff line
@@ -506,6 +506,7 @@ final class ActivityManagerConstants extends ContentObserver {
    private final KeyValueListParser mParser = new KeyValueListParser(',');

    private int mOverrideMaxCachedProcesses = -1;
    private final int mCustomizedMaxCachedProcesses;

    // The maximum number of cached processes we will keep around before killing them.
    // NOTE: this constant is *only* a control to not let us go too crazy with
@@ -515,11 +516,12 @@ final class ActivityManagerConstants extends ContentObserver {
    // kill them.  Also note that this limit only applies to cached background processes;
    // 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
    // process limit.
    public int CUR_MAX_CACHED_PROCESSES = DEFAULT_MAX_CACHED_PROCESSES;
    // process limit. This will be initialized in the constructor.
    public int CUR_MAX_CACHED_PROCESSES;

    // The maximum number of empty app processes we will let sit around.
    public int CUR_MAX_EMPTY_PROCESSES = computeEmptyProcessLimit(CUR_MAX_CACHED_PROCESSES);
    // The maximum number of empty app processes we will let sit around.  This will be
    // initialized in the constructor.
    public int CUR_MAX_EMPTY_PROCESSES;

    // The number of empty apps at which we don't consider it necessary to do
    // memory trimming.
@@ -762,6 +764,10 @@ final class ActivityManagerConstants extends ContentObserver {
                context.getResources().getStringArray(
                        com.android.internal.R.array.config_keep_warming_services))
                .map(ComponentName::unflattenFromString).collect(Collectors.toSet()));
        mCustomizedMaxCachedProcesses = context.getResources().getInteger(
                com.android.internal.R.integer.config_customizedMaxCachedProcesses);
        CUR_MAX_CACHED_PROCESSES = mCustomizedMaxCachedProcesses;
        CUR_MAX_EMPTY_PROCESSES = computeEmptyProcessLimit(CUR_MAX_CACHED_PROCESSES);
    }

    public void start(ContentResolver resolver) {
@@ -1105,13 +1111,13 @@ final class ActivityManagerConstants extends ContentObserver {
        try {
            CUR_MAX_CACHED_PROCESSES = mOverrideMaxCachedProcesses < 0
                    ? (TextUtils.isEmpty(maxCachedProcessesFlag)
                    ? DEFAULT_MAX_CACHED_PROCESSES : Integer.parseInt(maxCachedProcessesFlag))
                    ? mCustomizedMaxCachedProcesses : Integer.parseInt(maxCachedProcessesFlag))
                    : mOverrideMaxCachedProcesses;
        } catch (NumberFormatException e) {
            // Bad flag value from Phenotype, revert to default.
            Slog.e(TAG,
                    "Unable to parse flag for max_cached_processes: " + maxCachedProcessesFlag, e);
            CUR_MAX_CACHED_PROCESSES = DEFAULT_MAX_CACHED_PROCESSES;
            CUR_MAX_CACHED_PROCESSES = mCustomizedMaxCachedProcesses;
        }
        CUR_MAX_EMPTY_PROCESSES = computeEmptyProcessLimit(CUR_MAX_CACHED_PROCESSES);

@@ -1288,6 +1294,7 @@ final class ActivityManagerConstants extends ContentObserver {
        if (mOverrideMaxCachedProcesses >= 0) {
            pw.print("  mOverrideMaxCachedProcesses="); pw.println(mOverrideMaxCachedProcesses);
        }
        pw.print("  mCustomizedMaxCachedProcesses="); pw.println(mCustomizedMaxCachedProcesses);
        pw.print("  CUR_MAX_CACHED_PROCESSES="); pw.println(CUR_MAX_CACHED_PROCESSES);
        pw.print("  CUR_MAX_EMPTY_PROCESSES="); pw.println(CUR_MAX_EMPTY_PROCESSES);
        pw.print("  CUR_TRIM_EMPTY_PROCESSES="); pw.println(CUR_TRIM_EMPTY_PROCESSES);