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

Commit 0d780554 authored by Eric Lok's avatar Eric Lok
Browse files

Fix failed MockingOomAdjusterTests when Perceptible Tasks is Enabled

The `WindowProcessController.getPerceptibleTaskStoppedTimeMillis()` is mocked and returns 0 by default which is wrong. Need to update to behave similarly to the real method, where tasks that are not enabled for perceptible tasks should return Long.MIN_VALUE by default.

Test: atest com.android.server.am.MockingOomAdjusterTests
BUG: 370890207
Flag: com.android.server.am.perceptible_tasks
Change-Id: I12ac5c022b5ac261416346c9537548fcd26e4b2c
parent ed93d797
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3955,6 +3955,9 @@ public class MockingOomAdjusterTests {
            final ProcessReceiverRecord receivers = app.mReceivers;
            final ProcessProfileRecord profile = app.mProfile;
            final ProcessProviderRecord providers = app.mProviders;
            doReturn(Long.MIN_VALUE)
                    .when(app.getWindowProcessController())
                    .getPerceptibleTaskStoppedTimeMillis();
            app.makeActive(mock(ApplicationThreadDeferred.class), mService.mProcessStats);
            app.setLastActivityTime(mLastActivityTime);
            app.setKilledByAm(mKilledByAm);