Make IdentityCredentialStore.getInstance() return null if credstore is not installed.

Having this method return null is the expected and documented behavior
when either the IC HAL or credstore isn't available.

Test: atest android.security.identity.cts (with credstore not running)
Bug: 148495024
Change-Id: Ifa17c58a84057499b1aeb8404959d5c0badfe52a
This commit is contained in:
David Zeuthen
2020-01-31 11:37:51 -05:00
parent 48f7f07d52
commit 91aa2dd507

View File

@@ -38,6 +38,10 @@ class CredstoreIdentityCredentialStore extends IdentityCredentialStore {
ICredentialStoreFactory storeFactory =
ICredentialStoreFactory.Stub.asInterface(
ServiceManager.getService("android.security.identity"));
if (storeFactory == null) {
// This can happen if credstore is not running or not installed.
return null;
}
ICredentialStore credStore = null;
try {