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

Commit f759a58e authored by Hui Yu's avatar Hui Yu
Browse files

If didSomething condition is reversed.

updateOomAdjLocked() should be called when didSomething is true.

When startActivity, WindowManager post a runnable to DisplayThread and
ActivityManagerService to update UidRecord's proc state, because the
thread switch, sometimes proc state does not get updated on time.

This fix will make updateOomAdjLocked() is called immediately after
startActivity.

Bug: 155110902
Test: regression test
atest cts/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java

Change-Id: Icdb93fbd25c3c281c7dfdaafe190765630e7b64e
parent a29a359c
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -5364,7 +5364,7 @@ public class ActivityManagerService extends IActivityManager.Stub
            return false;
            return false;
        }
        }
        if (!didSomething) {
        if (didSomething) {
            updateOomAdjLocked(app, OomAdjuster.OOM_ADJ_REASON_PROCESS_BEGIN);
            updateOomAdjLocked(app, OomAdjuster.OOM_ADJ_REASON_PROCESS_BEGIN);
            checkTime(startTime, "attachApplicationLocked: after updateOomAdjLocked");
            checkTime(startTime, "attachApplicationLocked: after updateOomAdjLocked");
        }
        }