Use consistent helper class for keystore authorization
Currently the IKeystoreAuthorization service is intended to be accessed through the helper class android.security.Authorization. However, because Authorization provides only static methods, it can only be unit-tested by static mocking, which is only available in mockingservicestests. BiometricService works around this in two different ways: (a) using IKeystoreAuthorization directly, and (b) using android.security.KeyStore, which is an obsolete class which is now almost empty and just contains a couple random helpers. I'd like to remove it to avoid confusion with java.security.KeyStore. This CL solves the testability problem in a consistent way by renaming Authorization to KeyStoreAuthorization and changing all public static methods to instance methods. It updates all callers of the keystore authorization service to go through a KeyStoreAuthorization instance. Finally, it updates the unit tests for TrustManagerService and BiometricService to inject a mock KeyStoreAuthorization. Bug: 326508120 Test: atest TrustManagerServiceTest Test: atest FrameworksServicesTests:{BiometricServiceTest,AuthSessionTest} Test: atest CtsBiometricsTestCases:BiometricSimpleTests Flag: N/A. Refactoring with no behavior change intended. Change-Id: I68504f447b1b880c08a60cf027b13f77a6567ec9
Loading
Please register or sign in to comment