summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Rubin Xu <rubinxu@google.com> 2022-02-24 15:36:06 +0000
committer Rubin Xu <rubinxu@google.com> 2022-02-24 15:44:55 +0000
commitc96b611d14090bc299d6af6b8b6436d154b92c4c (patch)
treead0939774d419ee4014abed8fd8d8f25015502ef
parent80c4b33ddf612c831b1cb94a7d66ad45e310ff9a (diff)
KeyChain: always unbind service
Context.unbindService() should always be called even if the previous bindService() call returns false. Otherwise the service might be left dangling. Bug: 211582968 Test: None Change-Id: Ic1705096254afa12993d8992303432896bfecd57
-rw-r--r--keystore/java/android/security/KeyChain.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/keystore/java/android/security/KeyChain.java b/keystore/java/android/security/KeyChain.java
index 02cdeef77bec..4b367e0e5b4b 100644
--- a/keystore/java/android/security/KeyChain.java
+++ b/keystore/java/android/security/KeyChain.java
@@ -1117,6 +1117,7 @@ public final class KeyChain {
intent, keyChainServiceConnection, Context.BIND_AUTO_CREATE, user);
}
if (!bindSucceed) {
+ context.unbindService(keyChainServiceConnection);
throw new AssertionError("could not bind to KeyChainService");
}
countDownLatch.await();