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

Commit a90f5361 authored by Derek Jedral's avatar Derek Jedral Committed by Automerger Merge Worker
Browse files

Merge "Report correct userId in onUserMayRequestUnlock." into udc-dev am: c0553faf

parents b8c110a1 c0553faf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1573,7 +1573,7 @@ public class TrustManagerService extends SystemService {
        @Override
        public void reportUserMayRequestUnlock(int userId) throws RemoteException {
            enforceReportPermission();
            mHandler.obtainMessage(MSG_USER_MAY_REQUEST_UNLOCK, userId).sendToTarget();
            mHandler.obtainMessage(MSG_USER_MAY_REQUEST_UNLOCK, userId, /*arg2=*/ 0).sendToTarget();
        }

        @Override
+10 −0
Original line number Diff line number Diff line
@@ -79,6 +79,16 @@ class UserUnlockRequestTest {
            .isEqualTo(oldCount + 1)
    }

    @Test
    fun reportUserMayRequestUnlock_differentUserId_doesNotPropagateToAgent() {
        val oldCount = trustAgentRule.agent.onUserMayRequestUnlockCallCount
        trustManager.reportUserMayRequestUnlock(userId + 1)
        await()

        assertThat(trustAgentRule.agent.onUserMayRequestUnlockCallCount)
            .isEqualTo(oldCount)
    }

    companion object {
        private const val TAG = "UserUnlockRequestTest"
        private fun await() = Thread.sleep(250)