These tests test the "trust" part of the platform primarily implemented via TrustManagerService in the system server and TrustAgentService in system apps.
Tests are separated into separate files based on major groupings. When creating new tests, find a closely matching existing test file or create a new test file. Prefer many test files over large test files.
Each test file has its own trust agent. To create a new trust agent:
BaseTrustAgentService
class in your test file<service>
stanza to AndroidManifest.xml
in this directory for the new agent following the pattern fo the existing agents.To run:
atest TrustTests
TrustAgentService
, your agent created by the TrustAgentRule
and accessible via the agent
property of the rule.grantTrust
) directly on the agentonUserRequestedUnlock
) by implementing the method in your test's agent class and tracking invocations. See UserUnlockRequestTest
for an example.TrustManager
which is the interface the rest of the system (e.g. SystemUI) has to the service.reportUnlockAttempt
).TrustListener
which is the interface the rest of the system (e.g. SystemUI) uses to receive events from the service.LockStateTrackingRule
.