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

Commit 97e29daa authored by Kevin Jeon's avatar Kevin Jeon Committed by Android (Google) Code Review
Browse files

Merge "Add collectRssInBackground()" into main

parents 072eeea8 cd734679
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -690,18 +690,6 @@ public final class ProcessState {
        }
    }

    public void reportCachedKill(ArrayMap<String, ProcessStateHolder> pkgList, long pss) {
        ensureNotDead();
        mCommonProcess.addCachedKill(1, pss, pss, pss);
        if (!mCommonProcess.mMultiPackage) {
            return;
        }

        for (int ip=pkgList.size()-1; ip>=0; ip--) {
            pullFixedProc(pkgList, ip).addCachedKill(1, pss, pss, pss);
        }
    }

    public ProcessState pullFixedProc(String pkgName) {
        if (mMultiPackage) {
            // The array map is still pointing to a common process state
+4 −0
Original line number Diff line number Diff line
@@ -6806,6 +6806,10 @@
    <!-- Whether or not ActivityManager PSS profiling is disabled. -->
    <bool name="config_am_disablePssProfiling">false</bool>

    <!-- The modifier used to adjust AM's PSS threshold for downgrading services to service B if
         RSS is being collected instead. -->
    <item name="config_am_pssToRssThresholdModifier" format="float" type="dimen">1.5</item>

    <!-- Whether unlocking and waking a device are sequenced -->
    <bool name="config_orderUnlockAndWake">false</bool>

+1 −0
Original line number Diff line number Diff line
@@ -5270,6 +5270,7 @@

  <!-- For ActivityManager PSS profiling configurability -->
  <java-symbol type="bool" name="config_am_disablePssProfiling" />
  <java-symbol type="dimen" name="config_am_pssToRssThresholdModifier" />

  <java-symbol type="raw" name="default_ringtone_vibration_effect" />

+26 −0
Original line number Diff line number Diff line
@@ -1076,6 +1076,16 @@ final class ActivityManagerConstants extends ContentObserver {

    public boolean APP_PROFILER_PSS_PROFILING_DISABLED;

    /**
     * The modifier used to adjust PSS thresholds in OomAdjuster when RSS is collected instead.
     */
    static final String KEY_PSS_TO_RSS_THRESHOLD_MODIFIER =
            "pss_to_rss_threshold_modifier";

    private final float mDefaultPssToRssThresholdModifier;

    public float PSS_TO_RSS_THRESHOLD_MODIFIER;

    private final OnPropertiesChangedListener mOnDeviceConfigChangedListener =
            new OnPropertiesChangedListener() {
                @Override
@@ -1254,6 +1264,9 @@ final class ActivityManagerConstants extends ContentObserver {
                            case KEY_DISABLE_APP_PROFILER_PSS_PROFILING:
                                updateDisableAppProfilerPssProfiling();
                                break;
                            case KEY_PSS_TO_RSS_THRESHOLD_MODIFIER:
                                updatePssToRssThresholdModifier();
                                break;
                            default:
                                updateFGSPermissionEnforcementFlagsIfNecessary(name);
                                break;
@@ -1339,6 +1352,10 @@ final class ActivityManagerConstants extends ContentObserver {
        mDefaultDisableAppProfilerPssProfiling = context.getResources().getBoolean(
                R.bool.config_am_disablePssProfiling);
        APP_PROFILER_PSS_PROFILING_DISABLED = mDefaultDisableAppProfilerPssProfiling;

        mDefaultPssToRssThresholdModifier = context.getResources().getFloat(
                com.android.internal.R.dimen.config_am_pssToRssThresholdModifier);
        PSS_TO_RSS_THRESHOLD_MODIFIER = mDefaultPssToRssThresholdModifier;
    }

    public void start(ContentResolver resolver) {
@@ -2051,6 +2068,12 @@ final class ActivityManagerConstants extends ContentObserver {
                mDefaultDisableAppProfilerPssProfiling);
    }

    private void updatePssToRssThresholdModifier() {
        PSS_TO_RSS_THRESHOLD_MODIFIER = DeviceConfig.getFloat(
                DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, KEY_PSS_TO_RSS_THRESHOLD_MODIFIER,
                mDefaultPssToRssThresholdModifier);
    }

    @NeverCompile // Avoid size overhead of debugging code.
    void dump(PrintWriter pw) {
        pw.println("ACTIVITY MANAGER SETTINGS (dumpsys activity settings) "
@@ -2242,6 +2265,9 @@ final class ActivityManagerConstants extends ContentObserver {
        pw.print("  "); pw.print(KEY_DISABLE_APP_PROFILER_PSS_PROFILING);
        pw.print("="); pw.println(APP_PROFILER_PSS_PROFILING_DISABLED);

        pw.print("  "); pw.print(KEY_PSS_TO_RSS_THRESHOLD_MODIFIER);
        pw.print("="); pw.println(PSS_TO_RSS_THRESHOLD_MODIFIER);

        pw.println();
        if (mOverrideMaxCachedProcesses >= 0) {
            pw.print("  mOverrideMaxCachedProcesses="); pw.println(mOverrideMaxCachedProcesses);
+2 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ class ActivityManagerDebugConfig {
    static final boolean DEBUG_PROCESSES = DEBUG_ALL || false;
    static final boolean DEBUG_PROVIDER = DEBUG_ALL || false;
    static final boolean DEBUG_PSS = DEBUG_ALL || false;
    static final boolean DEBUG_RSS = DEBUG_ALL || false;
    static final boolean DEBUG_SERVICE = DEBUG_ALL || false;
    static final boolean DEBUG_FOREGROUND_SERVICE = DEBUG_ALL || false;
    static final boolean DEBUG_SERVICE_EXECUTING = DEBUG_ALL || false;
@@ -91,6 +92,7 @@ class ActivityManagerDebugConfig {
            ? "_ProcessObservers" : "";
    static final String POSTFIX_PROCESSES = (APPEND_CATEGORY_NAME) ? "_Processes" : "";
    static final String POSTFIX_PSS = (APPEND_CATEGORY_NAME) ? "_Pss" : "";
    static final String POSTFIX_RSS = (APPEND_CATEGORY_NAME) ? "_Rss" : "";
    static final String POSTFIX_SERVICE = (APPEND_CATEGORY_NAME) ? "_Service" : "";
    static final String POSTFIX_SERVICE_EXECUTING =
            (APPEND_CATEGORY_NAME) ? "_ServiceExecuting" : "";
Loading