From ecc7a0a55a6c3213f04d3543c0a9b8fc922b6c57 Mon Sep 17 00:00:00 2001 From: lihuan3 Date: Fri, 25 Dec 2020 16:09:41 +0800 Subject: [PATCH] [Bugfix] Fix the wrong lastBackgroundTime in UidRecord Test:A process call into updateOomAdjLocked in background which will set its uidRec.lastBackgroundTime = SystemClock.uptimeMillis(); and then in the idleUidsLocked() method it will compare the lastBackgroundTime with the elapsedRealtime which may cause a process which just go into background a few seconds ago become idle state and then be killed by this Change-Id: I419a555ef2f6490c26290b19fc86756fde293551 Signed-off-by: lihuan3 --- services/core/java/com/android/server/am/OomAdjuster.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/OomAdjuster.java b/services/core/java/com/android/server/am/OomAdjuster.java index a2e8216a011a9..58f3894564dc1 100644 --- a/services/core/java/com/android/server/am/OomAdjuster.java +++ b/services/core/java/com/android/server/am/OomAdjuster.java @@ -387,7 +387,7 @@ public final class OomAdjuster { ActiveUids uids = mTmpUidRecords; uids.clear(); uids.put(uidRec.uid, uidRec); - updateUidsLocked(uids, now); + updateUidsLocked(uids, SystemClock.elapsedRealtime()); mProcessList.incrementProcStateSeqAndNotifyAppsLocked(uids); } }