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

This commit is contained in:
Derek Jedral
2023-05-05 20:18:46 +00:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 1 deletions

View File

@@ -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

View File

@@ -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)