Use AServiceManager_waitForService() to connect to keystore2

Vold currently uses AServiceManager_getService() to connect to
keystore2, which has an internal timeout of 5s. Since a lot of vold
keystore2 connection failures are fatal, we instead use
AServiceManager_waitForService(), which will wait efficiently for
keystore2 to start, instead of timing out after 5s.

Bug: 185934601
Test: Cuttlefish boots.
Change-Id: Ib4e977a997e020082382e0686f448d1aa72834ec
This commit is contained in:
Satya Tangirala 2021-04-12 15:00:33 -07:00
parent 93dd933d85
commit 6ef4e37351

View file

@ -104,7 +104,7 @@ bool KeymasterOperation::finish(std::string* output) {
}
Keymaster::Keymaster() {
::ndk::SpAIBinder binder(AServiceManager_getService(keystore2_service_name));
::ndk::SpAIBinder binder(AServiceManager_waitForService(keystore2_service_name));
auto keystore2Service = ks2::IKeystoreService::fromBinder(binder);
if (!keystore2Service) {