Merge "Guard against null component when binding KeyChain" into nyc-dev

am: 7854d58392

* commit '7854d58392738338a71506ceb81dad2b5a4656e7':
  Guard against null component when binding KeyChain
This commit is contained in:
Robin Lee
2016-03-03 19:15:24 +00:00
committed by android-build-merger

View File

@@ -547,11 +547,8 @@ public final class KeyChain {
Intent intent = new Intent(IKeyChainService.class.getName());
ComponentName comp = intent.resolveSystemService(context.getPackageManager(), 0);
intent.setComponent(comp);
boolean isBound = context.bindServiceAsUser(intent,
keyChainServiceConnection,
Context.BIND_AUTO_CREATE,
user);
if (!isBound) {
if (comp == null || !context.bindServiceAsUser(
intent, keyChainServiceConnection, Context.BIND_AUTO_CREATE, user)) {
throw new AssertionError("could not bind to KeyChainService");
}
return new KeyChainConnection(context, keyChainServiceConnection, q.take());