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

Commit 29ebbfa6 authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

Considering prototypeAggressiveFreezing in test

The assignment of implicit_cpu_time can change depending on
the state of prototypeAggressiveFreezing.
Also adding the missing annotation to enable the base
cpu_time-capability flag.

Flag: com.android.server.am.prototype_aggressive_freezing

Test: atest FrameworksMockingServicesTests:MockingOomAdjusterTests

Bug: 370798593

Change-Id: Ibeb200c08e67e10da0a862273bddb0619095fe8d
parent f1e7e3b2
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -3657,6 +3657,7 @@ public class MockingOomAdjusterTests {

    @SuppressWarnings("GuardedBy")
    @Test
    @EnableFlags(Flags.FLAG_CPU_TIME_CAPABILITY_BASED_FREEZE_POLICY)
    public void testUpdateOomAdj_DoAll_BindUiServiceFromClientHome() {
        ProcessRecord app = makeDefaultProcessRecord(MOCKAPP_PID, MOCKAPP_UID, MOCKAPP_PROCESSNAME,
                MOCKAPP_PACKAGENAME, true);
@@ -3673,10 +3674,19 @@ public class MockingOomAdjusterTests {
                ? sFirstUiCachedAdj : sFirstCachedAdj;
        assertProcStates(app, PROCESS_STATE_HOME, expectedAdj, SCHED_GROUP_BACKGROUND,
                "cch-bound-ui-services");
        // This UI service oom score was elevated above the freeze cutoff, but the client is not
        // frozen, so neither should the service.
        // CPU_TIME is not granted to the client and so cannot be propagated to the service.
        assertNoCpuTime(client);
        assertNoCpuTime(app);
        // Granting of IMPLICIT_CPU_TIME will depend on the freezer oomAdj cutoff and will be
        // propagated to the service from the client when available.
        if (Flags.prototypeAggressiveFreezing()) {
            assertNoImplicitCpuTime(client);
            assertNoImplicitCpuTime(app);
        } else {
            assertImplicitCpuTime(client);
            assertImplicitCpuTime(app);
        }
    }

    @SuppressWarnings("GuardedBy")
    @Test