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

Commit a73a8b3a authored by Kevin Jeon's avatar Kevin Jeon Committed by Gerrit Code Review
Browse files

Merge "[Optimize][am_kill]add pss for process exit due to am_kill" into main

parents 792d5b0e a3916fb3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ option java_package com.android.server.am
30017 am_low_memory (Num Processes|1|1)

# Kill a process to reclaim memory.
30023 am_kill (User|1|5),(PID|1|5),(Process Name|3),(OomAdj|1|5),(Reason|3)
30023 am_kill (User|1|5),(PID|1|5),(Process Name|3),(OomAdj|1|5),(Reason|3),(Rss|2|2)
# Discard an undelivered serialized broadcast (timeout/ANR/crash)
30024 am_broadcast_discard_filter (User|1|5),(Broadcast|1|5),(Action|3),(Receiver Number|1|1),(BroadcastFilter|1|5)
30025 am_broadcast_discard_app (User|1|5),(Broadcast|1|5),(Action|3),(Receiver Number|1|1),(App|3)
+6 −1
Original line number Diff line number Diff line
@@ -105,6 +105,11 @@ public final class PhantomProcessRecord {
        }
    }

    public long getRss(int pid) {
        long[] rss = Process.getRss(pid);
        return (rss != null && rss.length > 0) ? rss[0] : 0;
    }

    @GuardedBy("mLock")
    void killLocked(String reason, boolean noisy) {
        if (!mKilled) {
@@ -115,7 +120,7 @@ public final class PhantomProcessRecord {
            }
            if (mPid > 0) {
                EventLog.writeEvent(EventLogTags.AM_KILL, UserHandle.getUserId(mUid),
                        mPid, mProcessName, mAdj, reason);
                        mPid, mProcessName, mAdj, reason, getRss(mPid));
                if (!Process.supportsPidFd()) {
                    onProcDied(false);
                } else {
+6 −1
Original line number Diff line number Diff line
@@ -1170,6 +1170,11 @@ class ProcessRecord implements WindowProcessListener {
        }
    }

    public long getRss(int pid) {
        long[] rss = Process.getRss(pid);
        return (rss != null && rss.length > 0) ? rss[0] : 0;
    }

    @GuardedBy("mService")
    void killLocked(String reason, @Reason int reasonCode, boolean noisy) {
        killLocked(reason, reasonCode, ApplicationExitInfo.SUBREASON_UNKNOWN, noisy, true);
@@ -1213,7 +1218,7 @@ class ProcessRecord implements WindowProcessListener {
            if (mPid > 0) {
                mService.mProcessList.noteAppKill(this, reasonCode, subReason, description);
                EventLog.writeEvent(EventLogTags.AM_KILL,
                        userId, mPid, processName, mState.getSetAdj(), reason);
                        userId, mPid, processName, mState.getSetAdj(), reason, getRss(mPid));
                Process.killProcessQuiet(mPid);
                killProcessGroupIfNecessaryLocked(asyncKPG);
            } else {