Merge "Guard against null component when binding KeyChain" into nyc-dev
This commit is contained in:
@@ -547,11 +547,8 @@ public final class KeyChain {
|
|||||||
Intent intent = new Intent(IKeyChainService.class.getName());
|
Intent intent = new Intent(IKeyChainService.class.getName());
|
||||||
ComponentName comp = intent.resolveSystemService(context.getPackageManager(), 0);
|
ComponentName comp = intent.resolveSystemService(context.getPackageManager(), 0);
|
||||||
intent.setComponent(comp);
|
intent.setComponent(comp);
|
||||||
boolean isBound = context.bindServiceAsUser(intent,
|
if (comp == null || !context.bindServiceAsUser(
|
||||||
keyChainServiceConnection,
|
intent, keyChainServiceConnection, Context.BIND_AUTO_CREATE, user)) {
|
||||||
Context.BIND_AUTO_CREATE,
|
|
||||||
user);
|
|
||||||
if (!isBound) {
|
|
||||||
throw new AssertionError("could not bind to KeyChainService");
|
throw new AssertionError("could not bind to KeyChainService");
|
||||||
}
|
}
|
||||||
return new KeyChainConnection(context, keyChainServiceConnection, q.take());
|
return new KeyChainConnection(context, keyChainServiceConnection, q.take());
|
||||||
|
|||||||
Reference in New Issue
Block a user