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

Commit 0c9f7342 authored by Xiang Wang's avatar Xiang Wang
Browse files

Use a non-existing PID for cleanup

9999 could be a valid PID and pass the cleanup during test,
the max number should be bound by 32,768 usually or at max
4 million.

Bug: 363972064
Flag: TEST_ONLY
Test: atest PerformanceHintTests
Change-Id: I9465eac3f926a7fa3d20c4782a77d0d72a6445d5
parent 502cec5a
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -631,7 +631,7 @@ public class HintManagerServiceTest {
        CountDownLatch stopLatch2 = new CountDownLatch(1);
        CountDownLatch stopLatch2 = new CountDownLatch(1);
        // negative value used for test only to avoid conflicting with any real thread that exists
        // negative value used for test only to avoid conflicting with any real thread that exists
        int isoProc1 = -100;
        int isoProc1 = -100;
        int isoProc2 = 9999;
        int isoProc2 = 99999999;
        when(mAmInternalMock.getIsolatedProcesses(eq(UID))).thenReturn(List.of(0));
        when(mAmInternalMock.getIsolatedProcesses(eq(UID))).thenReturn(List.of(0));
        int[] tids2 = createThreads(threadCount, stopLatch2);
        int[] tids2 = createThreads(threadCount, stopLatch2);
        int[] tids2WithIsolated = Arrays.copyOf(tids2, tids2.length + 2);
        int[] tids2WithIsolated = Arrays.copyOf(tids2, tids2.length + 2);
@@ -658,7 +658,7 @@ public class HintManagerServiceTest {
        verify(mNativeWrapperMock, never()).halSetThreads(eq(sessionPtr1), any());
        verify(mNativeWrapperMock, never()).halSetThreads(eq(sessionPtr1), any());
        verify(mNativeWrapperMock, never()).halSetThreads(eq(sessionPtr2), any());
        verify(mNativeWrapperMock, never()).halSetThreads(eq(sessionPtr2), any());
        // the new TIDs pending list should be updated
        // the new TIDs pending list should be updated
        assertArrayEquals(session2.getTidsInternal(), expectedTids2);
        assertArrayEquals(expectedTids2, session2.getTidsInternal());
        reset(mNativeWrapperMock);
        reset(mNativeWrapperMock);


        // this should resume and update the threads so those never-existed invalid isolated
        // this should resume and update the threads so those never-existed invalid isolated
@@ -713,8 +713,8 @@ public class HintManagerServiceTest {
        // in background, set threads for session 1 then it should not be force paused next time
        // in background, set threads for session 1 then it should not be force paused next time
        session1.setThreads(SESSION_TIDS_A);
        session1.setThreads(SESSION_TIDS_A);
        // the new TIDs pending list should be updated
        // the new TIDs pending list should be updated
        assertArrayEquals(session1.getTidsInternal(), SESSION_TIDS_A);
        assertArrayEquals(SESSION_TIDS_A, session1.getTidsInternal());
        assertArrayEquals(session2.getTidsInternal(), expectedTids2);
        assertArrayEquals(expectedTids2, session2.getTidsInternal());
        verifyAllHintsEnabled(session1, false);
        verifyAllHintsEnabled(session1, false);
        verifyAllHintsEnabled(session2, false);
        verifyAllHintsEnabled(session2, false);
        reset(mNativeWrapperMock);
        reset(mNativeWrapperMock);