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

Commit 6127b8af authored by Hugo Benichi's avatar Hugo Benichi
Browse files

am: hide details of OomAdjObserver from OomAdjuster

This patch moves reportOomAdjMessageLocked() from OomAdjuster to
ActivityManagerService to hide certain AMS variables from OomAdjuster.

A future patch will abstract further this method by exposing it to
OomAdjuster through an interface or dependency class agnostics of AMS.

Bug: 425766486
Test: m services.core
Test: atest MockingOomAdjusterTests OomAdjusterTests
Test: atest FrameworksServicesTestsRavenwood_ProcessStateController
Test: atest FrameworksMockingServicesTests_android_server_am_broadcast
Flag: EXEMPT pure refactor

Change-Id: Iabf6039868c437b7bf189934297c87eaf3f1626b
parent 88fa9ced
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -3244,6 +3244,14 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
    }
    void reportOomAdjMessageLocked(String msg) {
        synchronized (mOomAdjObserverLock) {
            if (mCurOomAdjObserver != null) {
                mUiHandler.obtainMessage(DISPATCH_OOM_ADJ_OBSERVER_MSG, msg).sendToTarget();
            }
        }
    }
    /**
     * @deprecated use {@link #startActivityWithFeature} instead
     */
+1 −7
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_PROCESS_OBS
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_PSS;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_UID_OBSERVERS;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_USAGE_STATS;
import static com.android.server.am.ActivityManagerService.DISPATCH_OOM_ADJ_OBSERVER_MSG;
import static com.android.server.am.ActivityManagerService.FOLLOW_UP_OOMADJUSTER_UPDATE_MSG;
import static com.android.server.am.ActivityManagerService.IDLE_UIDS_MSG;
import static com.android.server.am.ActivityManagerService.TAG_LRU;
@@ -2189,12 +2188,7 @@ public abstract class OomAdjuster {
    @GuardedBy("mService")
    protected void reportOomAdjMessageLocked(String tag, String msg) {
        Slog.d(tag, msg);
        synchronized (mService.mOomAdjObserverLock) {
            if (mService.mCurOomAdjObserver != null) {
                mService.mUiHandler.obtainMessage(DISPATCH_OOM_ADJ_OBSERVER_MSG, msg)
                        .sendToTarget();
            }
        }
        mService.reportOomAdjMessageLocked(msg);
    }

    void onWakefulnessChanged(int wakefulness) {