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

Commit 1e35d99e authored by Michael Wachenschwanz's avatar Michael Wachenschwanz
Browse files

Init some time Process stats with very negative numbers

mLastTopTime was initialized as 0, meaning early on in the boot
OomAdjuster would mistakenly think apps had recently been in the TOP
state.

Also, changed mLastProviderTime even though it had some logic (now
removed) to avoid the mistake.

Test: atest MockingOomAdjustertest (ideally immediatly after boot)
Fixes: 300106850
Change-Id: I399d34e1a9a19b7211413e51099721ea49efa7ad
parent ce36021d
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -2373,8 +2373,7 @@ public class OomAdjuster {
            }
        }

        if (ppr.getLastProviderTime() > 0
                && (ppr.getLastProviderTime() + mConstants.CONTENT_PROVIDER_RETAIN_TIME) > now) {
        if ((ppr.getLastProviderTime() + mConstants.CONTENT_PROVIDER_RETAIN_TIME) > now) {
            if (adj > PREVIOUS_APP_ADJ) {
                adj = PREVIOUS_APP_ADJ;
                schedGroup = SCHED_GROUP_BACKGROUND;
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ final class ProcessProviderRecord {
    /**
     * The last time someone else was using a provider in this process.
     */
    private long mLastProviderTime;
    private long mLastProviderTime = Long.MIN_VALUE;

    /**
     * class (String) -> ContentProviderRecord.
+1 −1
Original line number Diff line number Diff line
@@ -280,7 +280,7 @@ final class ProcessStateRecord {
     * The last time the process was in the TOP state or greater.
     */
    @GuardedBy("mService")
    private long mLastTopTime;
    private long mLastTopTime = Long.MIN_VALUE;

    /**
     * Is this an empty background process?
+1 −1
Original line number Diff line number Diff line
@@ -2629,7 +2629,7 @@ public class MockingOomAdjusterTests {
                PROCESS_STATE_NONEXISTENT, PROCESS_STATE_NONEXISTENT,
                0, 0, false, false, false, ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE,
                false, false, false, hasShownUi, false, false, false, false, false, false, null,
                0, 0, 0, true, 0, null, false);
                0, Long.MIN_VALUE, Long.MIN_VALUE, true, 0, null, false);
    }

    private ProcessRecord makeProcessRecord(ActivityManagerService service, int pid, int uid,