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

Commit 62f869b6 authored by Lee George Thomas's avatar Lee George Thomas Committed by Automerger Merge Worker
Browse files

Merge "Signal lmkd to start psi monitoring after boot." into udc-dev-plus-aosp...

Merge "Signal lmkd to start psi monitoring after boot." into udc-dev-plus-aosp am: 816b3904 am: 5f804732 am: 0bfd34c7

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



Change-Id: I06d5e7d1d5479041e5e63f9d335678bb7f5fb034
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 50bf705e 0bfd34c7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -5083,6 +5083,10 @@ public class ActivityManagerService extends IActivityManager.Stub
            // Tell anyone interested that we are done booting!
            SystemProperties.set("sys.boot_completed", "1");
            SystemProperties.set("dev.bootcomplete", "1");
            // Start PSI monitoring in LMKD if it was skipped earlier.
            ProcessList.startPsiMonitoringAfterBoot();
            mUserController.onBootComplete(
                    new IIntentReceiver.Stub() {
                        @Override
+10 −0
Original line number Diff line number Diff line
@@ -357,6 +357,7 @@ public final class ProcessList {
    static final byte LMK_UPDATE_PROPS = 7;
    static final byte LMK_KILL_OCCURRED = 8; // Msg to subscribed clients on kill occurred event
    static final byte LMK_STATE_CHANGED = 9; // Msg to subscribed clients on state changed
    static final byte LMK_START_MONITORING = 9; // Start monitoring if delayed earlier

    // Low Memory Killer Daemon command codes.
    // These must be kept in sync with async_event_type definitions in lmkd.h
@@ -1568,6 +1569,15 @@ public final class ProcessList {
        return true;
    }

    /**
     * {@hide}
     */
    public static void startPsiMonitoringAfterBoot() {
        ByteBuffer buf = ByteBuffer.allocate(4);
        buf.putInt(LMK_START_MONITORING);
        writeLmkd(buf, null);
    }

    private static boolean writeLmkd(ByteBuffer buf, ByteBuffer repl) {
        if (!sLmkdConnection.isConnected()) {
            // try to connect immediately and then keep retrying