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

Commit 89612698 authored by Michael Wachenschwanz's avatar Michael Wachenschwanz Committed by Android (Google) Code Review
Browse files

Merge "Automatically trigger OomAdjuster updates for RemoteRunningAnimation" into main

parents 3c4b1a2e 16a009fc
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1747,10 +1747,15 @@ class ProcessRecord extends ProcessRecordInternal implements WindowProcessListen
        synchronized (mService) {
            if (mService.mProcessStateController.setRunningRemoteAnimation(this,
                    runningRemoteAnimation)) {
                if (Flags.autoTriggerOomadjUpdates()) {
                    // Do nothing.
                    // ProcessStateController handled the update in setRunningRemoteAnimation.
                } else {
                    mService.mProcessStateController.runUpdate(this, OOM_ADJ_REASON_UI_VISIBILITY);
                }
            }
        }
    }

    public long getInputDispatchingTimeoutMillis() {
        return mWindowProcessController.getInputDispatchingTimeoutMillis();
+6 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.am;
import static android.app.ActivityManagerInternal.OOM_ADJ_REASON_ACTIVITY;
import static android.app.ActivityManagerInternal.OOM_ADJ_REASON_BACKUP;
import static android.app.ActivityManagerInternal.OOM_ADJ_REASON_SERVICE_BINDER_CALL;
import static android.app.ActivityManagerInternal.OOM_ADJ_REASON_UI_VISIBILITY;
import static android.app.ProcessMemoryState.HOSTING_COMPONENT_TYPE_BROADCAST_RECEIVER;

import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_OOM_ADJ;
@@ -464,6 +465,11 @@ public class ProcessStateController {
                    + " for pid=" + proc.getPid());
        }
        proc.setIsRunningRemoteAnimation(runningRemoteAnimation);

        if (Flags.autoTriggerOomadjUpdates()) {
            enqueueUpdateTarget(proc);
            runPendingUpdate(OOM_ADJ_REASON_UI_VISIBILITY);
        }
        return true;
    }

+7 −3
Original line number Diff line number Diff line
@@ -546,10 +546,14 @@ public class MockingOomAdjusterTests {
        ProcessRecord app = makeDefaultProcessRecord(MOCKAPP_PID, MOCKAPP_UID, MOCKAPP_PROCESSNAME,
                MOCKAPP_PACKAGENAME, true);
        setTopProcessState(PROCESS_STATE_TOP_SLEEPING);
        mProcessStateController.setRunningRemoteAnimation(app, true);
        setWakefulness(PowerManagerInternal.WAKEFULNESS_AWAKE);
        mProcessStateController.setRunningRemoteAnimation(app, true);

        if (Flags.autoTriggerOomadjUpdates()) {
            // Do not manually run the update.
        } else {
            updateOomAdj(app);
        setTopProcessState(PROCESS_STATE_TOP);
        }

        assertProcStates(app, PROCESS_STATE_TOP_SLEEPING, VISIBLE_APP_ADJ, SCHED_GROUP_TOP_APP);
        assertThatProcess(app).hasImplicitCpuTimeCapability();