summaryrefslogtreecommitdiff
path: root/identity
diff options
context:
space:
mode:
authorDavid Zeuthen <zeuthen@google.com>2020-01-31 11:37:51 -0500
committerDavid Zeuthen <zeuthen@google.com>2020-01-31 11:37:51 -0500
commit91aa2dd5079780464d2a3c8d1c8e2bf4e128732f (patch)
treef27998ff7684a1666073947c4eb7851bbaa18efc /identity
parent48f7f07d525138a54f57fbc7fdb4c81d511a0aa4 (diff)
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
Diffstat (limited to 'identity')
-rw-r--r--identity/java/android/security/identity/CredstoreIdentityCredentialStore.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/identity/java/android/security/identity/CredstoreIdentityCredentialStore.java b/identity/java/android/security/identity/CredstoreIdentityCredentialStore.java
index dcc6b95aec02..129063361b35 100644
--- a/identity/java/android/security/identity/CredstoreIdentityCredentialStore.java
+++ b/identity/java/android/security/identity/CredstoreIdentityCredentialStore.java
@@ -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 {