summaryrefslogtreecommitdiff
path: root/services/powermanager/PowerHalController.cpp
diff options
context:
space:
mode:
author Matt Buckley <mattbuckley@google.com> 2022-09-01 21:17:15 +0000
committer Matt Buckley <mattbuckley@google.com> 2022-10-13 00:18:19 +0000
commitc3894a4df8d8362fe5b1ccb9ee0ddb6ead046003 (patch)
tree147006b58f8e2411d9251eac97201901a41bfd39 /services/powermanager/PowerHalController.cpp
parentcf1fb689002563d03d3f72e434caa357f3a6dfff (diff)
Extend PowerHalWrapper to support HIDL 1.2 and 1.3
* Added support for 1.2 and 1.3 HIDL calls to the PowerHalWrapper * Expanded the wrapper and loader tests to cover these new versions * Lightly tweaked the existing tests to make them more comprehensive Bug: b/244631171 Test: atest libpowermanager_test Change-Id: I5890106817b7cf243cdd21b3acf22ff7fcd8174e
Diffstat (limited to 'services/powermanager/PowerHalController.cpp')
-rw-r--r--services/powermanager/PowerHalController.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/services/powermanager/PowerHalController.cpp b/services/powermanager/PowerHalController.cpp
index 8c225d5d02..f89035fd1c 100644
--- a/services/powermanager/PowerHalController.cpp
+++ b/services/powermanager/PowerHalController.cpp
@@ -33,16 +33,20 @@ namespace power {
// -------------------------------------------------------------------------------------------------
std::unique_ptr<HalWrapper> HalConnector::connect() {
- sp<IPower> halAidl = PowerHalLoader::loadAidl();
- if (halAidl) {
+ if (sp<IPower> halAidl = PowerHalLoader::loadAidl()) {
return std::make_unique<AidlHalWrapper>(halAidl);
}
- sp<V1_0::IPower> halHidlV1_0 = PowerHalLoader::loadHidlV1_0();
- sp<V1_1::IPower> halHidlV1_1 = PowerHalLoader::loadHidlV1_1();
- if (halHidlV1_1) {
- return std::make_unique<HidlHalWrapperV1_1>(halHidlV1_0, halHidlV1_1);
- }
- if (halHidlV1_0) {
+ // If V1_0 isn't defined, none of them are
+ if (sp<V1_0::IPower> halHidlV1_0 = PowerHalLoader::loadHidlV1_0()) {
+ if (sp<V1_3::IPower> halHidlV1_3 = PowerHalLoader::loadHidlV1_3()) {
+ return std::make_unique<HidlHalWrapperV1_3>(halHidlV1_3);
+ }
+ if (sp<V1_2::IPower> halHidlV1_2 = PowerHalLoader::loadHidlV1_2()) {
+ return std::make_unique<HidlHalWrapperV1_2>(halHidlV1_2);
+ }
+ if (sp<V1_1::IPower> halHidlV1_1 = PowerHalLoader::loadHidlV1_1()) {
+ return std::make_unique<HidlHalWrapperV1_1>(halHidlV1_1);
+ }
return std::make_unique<HidlHalWrapperV1_0>(halHidlV1_0);
}
return nullptr;