summaryrefslogtreecommitdiff
path: root/hal/audio_perf.cpp
diff options
context:
space:
mode:
authorWei Wang <wvw@google.com>2020-03-04 11:44:58 -0800
committerArian <arian.kulmer@web.de>2021-12-06 15:58:33 +0100
commit52d52f8d6fa550d94ee4c77b7fc2a4a509961666 (patch)
tree694f71833f4c68de210f499eb4c15aa6a2b94414 /hal/audio_perf.cpp
parent17787bc7a50feb971c20a86e583b51d369bc0d89 (diff)
Probe PowerHAL HIDL first
Right now AIDL doesn't provide an API for vendor code to query if the AIDL HAL declared. This will lead to 1) long blocking call for device doesn't have the AIDL HAL and also 2) potential problem if the service starts late after 5s timeout. This is a workaround for addressing 1) on devices having HIDL, but still affects device that doesn't have HIDL service. Bug: 149797408 Test: build Change-Id: I60aada1ab1a044db965987bca5f6eee5b6262b20
Diffstat (limited to 'hal/audio_perf.cpp')
-rw-r--r--hal/audio_perf.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/hal/audio_perf.cpp b/hal/audio_perf.cpp
index 4623f192..e2620a1b 100644
--- a/hal/audio_perf.cpp
+++ b/hal/audio_perf.cpp
@@ -54,6 +54,21 @@ static hal_version connectPowerHalLocked() {
return NONE;
}
+ if (gPowerHalHidlExists) {
+ // (re)connect if handle is null
+ if (!gPowerHal_1_2_) {
+ gPowerHal_1_2_ =
+ android::hardware::power::V1_2::IPower::getService();
+ }
+ if (gPowerHal_1_2_) {
+ ALOGI("Successfully connected to Power Hal Hidl service.");
+ return HIDL_1_2;
+ } else {
+ // no more try on this handle
+ gPowerHalHidlExists = false;
+ }
+ }
+
if (gPowerHalAidlExists) {
// (re)connect if handle is null
if (!gPowerHal_Aidl_) {
@@ -70,21 +85,6 @@ static hal_version connectPowerHalLocked() {
}
}
- if (gPowerHalHidlExists) {
- // (re)connect if handle is null
- if (!gPowerHal_1_2_) {
- gPowerHal_1_2_ =
- android::hardware::power::V1_2::IPower::getService();
- }
- if (gPowerHal_1_2_) {
- ALOGI("Successfully connected to Power Hal Hidl service.");
- return HIDL_1_2;
- } else {
- // no more try on this handle
- gPowerHalHidlExists = false;
- }
- }
-
return NONE;
}