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

Commit c1e8d636 authored by Michael Wachenschwanz's avatar Michael Wachenschwanz Committed by Android (Google) Code Review
Browse files

Merge changes I7940d56b,Iaec6ffe7,I0a6d3219,Idfd77557,Ia14d3260, ... into main

* changes:
  [7/N] Simplify Service/Provider policy method signatures
  [6/N] Delete OomAdjusterLegacyImpl and rename the Modern impl
  [5/N] Remove the ability to select the Legacy OomAdjuster impl
  [4/N] Remove unused code paths in each OomAdjuster impl
  [3/N] Copy OomAdjuster compute methods to individual impls
  [2/N] Move Legacy only methods calls to OomAdjusterLegacyImpl
  [1/N] Turn OomAdjuster into an abstract base class
parents 9a727bb9 e0058e6c
Loading
Loading
Loading
Loading
+0 −25
Original line number Diff line number Diff line
@@ -168,11 +168,6 @@ final class ActivityManagerConstants extends ContentObserver {
    static final String KEY_TIERED_CACHED_ADJ_DECAY_TIME = "tiered_cached_adj_decay_time";
    static final String KEY_TIERED_CACHED_ADJ_UI_TIER_SIZE = "tiered_cached_adj_ui_tier_size";

    /**
     * Whether or not to enable the new oom adjuster implementation.
     */
    static final String KEY_ENABLE_NEW_OOMADJ = "enable_new_oom_adj";

    /**
     * Whether or not to enable the batching of OOM adjuster calls to LMKD
     */
@@ -261,11 +256,6 @@ final class ActivityManagerConstants extends ContentObserver {
    private static final int TIERED_CACHED_ADJ_MAX_UI_TIER_SIZE = 50;
    private final int mDefaultTieredCachedAdjUiTierSize;

    /**
     * The default value to {@link #KEY_ENABLE_NEW_OOMADJ}.
     */
    private static final boolean DEFAULT_ENABLE_NEW_OOM_ADJ = Flags.oomadjusterCorrectnessRewrite();

    /**
     * The default value to {@link #KEY_ENABLE_BATCHING_OOM_ADJ}.
     */
@@ -1174,9 +1164,6 @@ final class ActivityManagerConstants extends ContentObserver {
    /** @see #KEY_TIERED_CACHED_ADJ_UI_TIER_SIZE */
    public int TIERED_CACHED_ADJ_UI_TIER_SIZE;

    /** @see #KEY_ENABLE_NEW_OOMADJ */
    public boolean ENABLE_NEW_OOMADJ = DEFAULT_ENABLE_NEW_OOM_ADJ;

    /** @see #KEY_ENABLE_BATCHING_OOM_ADJ */
    public boolean ENABLE_BATCHING_OOM_ADJ = DEFAULT_ENABLE_BATCHING_OOM_ADJ;

@@ -1555,8 +1542,6 @@ final class ActivityManagerConstants extends ContentObserver {
    }

    private void loadNativeBootDeviceConfigConstants() {
        ENABLE_NEW_OOMADJ = getDeviceConfigBoolean(KEY_ENABLE_NEW_OOMADJ,
                DEFAULT_ENABLE_NEW_OOM_ADJ);
        ENABLE_BATCHING_OOM_ADJ = getDeviceConfigBoolean(KEY_ENABLE_BATCHING_OOM_ADJ,
                DEFAULT_ENABLE_BATCHING_OOM_ADJ);
    }
@@ -2310,13 +2295,6 @@ final class ActivityManagerConstants extends ContentObserver {
                TIERED_CACHED_ADJ_MAX_UI_TIER_SIZE);
    }

    private void updateEnableNewOomAdj() {
        ENABLE_NEW_OOMADJ = DeviceConfig.getBoolean(
            DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_NATIVE_BOOT,
            KEY_ENABLE_NEW_OOMADJ,
            DEFAULT_ENABLE_NEW_OOM_ADJ);
    }

    private void updateFollowUpOomAdjUpdateWaitDuration() {
        FOLLOW_UP_OOMADJ_UPDATE_WAIT_DURATION = DeviceConfig.getLong(
                DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
@@ -2566,9 +2544,6 @@ final class ActivityManagerConstants extends ContentObserver {
        pw.print("  "); pw.print(KEY_TIERED_CACHED_ADJ_UI_TIER_SIZE);
        pw.print("="); pw.println(TIERED_CACHED_ADJ_UI_TIER_SIZE);

        pw.print("  "); pw.print(KEY_ENABLE_NEW_OOMADJ);
        pw.print("="); pw.println(ENABLE_NEW_OOMADJ);

        pw.print("  "); pw.print(KEY_FREEZER_CUTOFF_ADJ);
        pw.print("="); pw.println(FREEZER_CUTOFF_ADJ);

+0 −2
Original line number Diff line number Diff line
@@ -2422,7 +2422,6 @@ public class ActivityManagerService extends IActivityManager.Stub
        mPhantomProcessList = new PhantomProcessList(this);
        mProcessStateController = new ProcessStateController.Builder(this, mProcessList, activeUids)
                .setHandlerThread(handlerThread)
                .useModernOomAdjuster(mConstants.ENABLE_NEW_OOMADJ)
                .build();
        mOomAdjuster = mProcessStateController.getOomAdjuster();
@@ -2488,7 +2487,6 @@ public class ActivityManagerService extends IActivityManager.Stub
                new LowMemDetector(this));
        mPhantomProcessList = new PhantomProcessList(this);
        mProcessStateController = new ProcessStateController.Builder(this, mProcessList, activeUids)
                .useModernOomAdjuster(mConstants.ENABLE_NEW_OOMADJ)
                .build();
        mOomAdjuster = mProcessStateController.getOomAdjuster();
+2 −4
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.server.am;

import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
import static com.android.server.am.ProcessList.UNKNOWN_ADJ;

import android.annotation.Nullable;
import android.app.IServiceConnection;
@@ -38,7 +37,7 @@ import java.io.PrintWriter;
/**
 * Description of a single binding to a service.
 */
final class ConnectionRecord implements OomAdjusterModernImpl.Connection{
final class ConnectionRecord implements OomAdjusterImpl.Connection{
    final AppBindRecord binding;    // The application/service binding.
    final ActivityServiceConnectionsHolder<ConnectionRecord> activity;  // If non-null, the owning activity.
    final IServiceConnection conn;  // The client connection.
@@ -132,8 +131,7 @@ final class ConnectionRecord implements OomAdjusterModernImpl.Connection{
    public void computeHostOomAdjLSP(OomAdjuster oomAdjuster, ProcessRecord host,
            ProcessRecord client, long now, ProcessRecord topApp, boolean doingAll,
            int oomAdjReason, int cachedAdj) {
        oomAdjuster.computeServiceHostOomAdjLSP(this, host, client, now, topApp, doingAll, false,
                false, oomAdjReason, UNKNOWN_ADJ, false, false);
        oomAdjuster.computeServiceHostOomAdjLSP(this, host, client, now, false);
    }

    @Override
+2 −4
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.server.am;

import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_PROVIDER;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
import static com.android.server.am.ProcessList.UNKNOWN_ADJ;

import android.annotation.UserIdInt;
import android.os.Binder;
@@ -34,7 +33,7 @@ import com.android.internal.app.procstats.ProcessStats;
 * Represents a link between a content provider and client.
 */
public final class ContentProviderConnection extends Binder implements
        OomAdjusterModernImpl.Connection {
        OomAdjusterImpl.Connection {
    public final ContentProviderRecord provider;
    public final ProcessRecord client;
    public final String clientPackage;
@@ -78,8 +77,7 @@ public final class ContentProviderConnection extends Binder implements
    public void computeHostOomAdjLSP(OomAdjuster oomAdjuster, ProcessRecord host,
            ProcessRecord client, long now, ProcessRecord topApp, boolean doingAll,
            int oomAdjReason, int cachedAdj) {
        oomAdjuster.computeProviderHostOomAdjLSP(this, host, client, now, topApp, doingAll, false,
                false, oomAdjReason, UNKNOWN_ADJ, false, false);
        oomAdjuster.computeProviderHostOomAdjLSP(this, host, client, false);
    }

    @Override
+30 −1742

File changed.

Preview size limit exceeded, changes collapsed.

Loading