Check AServiceManager_isDeclared before AServiceManager_getService
Call AServiceManager_isDeclared before calling AServiceManager_getService to avoid the waiting time when aidl service is not available. Bug: 286969060 Test: run VtsHalGatekeeperTarget Change-Id: I7d652a546cb810a601338a68950f01d065aea7a5
This commit is contained in:
parent
3c962eee3a
commit
32e1c70f27
1 changed files with 7 additions and 3 deletions
|
@ -63,9 +63,13 @@ constexpr const char gatekeeperServiceName[] = "android.hardware.gatekeeper.IGat
|
|||
|
||||
GateKeeperProxy::GateKeeperProxy() {
|
||||
clear_state_if_needed_done = false;
|
||||
hw_device = IGatekeeper::getService();
|
||||
::ndk::SpAIBinder ks2Binder(AServiceManager_getService(gatekeeperServiceName));
|
||||
aidl_hw_device = AidlIGatekeeper::fromBinder(ks2Binder);
|
||||
if (AServiceManager_isDeclared(gatekeeperServiceName)) {
|
||||
::ndk::SpAIBinder ks2Binder(AServiceManager_waitForService(gatekeeperServiceName));
|
||||
aidl_hw_device = AidlIGatekeeper::fromBinder(ks2Binder);
|
||||
}
|
||||
if (!aidl_hw_device) {
|
||||
hw_device = IGatekeeper::getService();
|
||||
}
|
||||
is_running_gsi = android::base::GetBoolProperty(android::gsi::kGsiBootedProp, false);
|
||||
|
||||
if (!aidl_hw_device && !hw_device) {
|
||||
|
|
Loading…
Reference in a new issue