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
diff --git a/services/powermanager/tests/PowerHalWrapperHidlV1_0Test.cpp b/services/powermanager/tests/PowerHalWrapperHidlV1_0Test.cpp
index b54762c..0cd2e22 100644
--- a/services/powermanager/tests/PowerHalWrapperHidlV1_0Test.cpp
+++ b/services/powermanager/tests/PowerHalWrapperHidlV1_0Test.cpp
@@ -87,18 +87,28 @@
}
TEST_F(PowerHalWrapperHidlV1_0Test, TestSetBoostUnsupported) {
+ EXPECT_CALL(*mMockHal.get(), powerHint(_, _)).Times(0);
+ EXPECT_CALL(*mMockHal.get(), setInteractive(_)).Times(0);
+ EXPECT_CALL(*mMockHal.get(), setFeature(_, _)).Times(0);
+
auto result = mWrapper->setBoost(Boost::CAMERA_LAUNCH, 10);
ASSERT_TRUE(result.isUnsupported());
+ result = mWrapper->setBoost(Boost::ML_ACC, 10);
+ ASSERT_TRUE(result.isUnsupported());
+ result = mWrapper->setBoost(Boost::DISPLAY_UPDATE_IMMINENT, 10);
+ ASSERT_TRUE(result.isUnsupported());
}
TEST_F(PowerHalWrapperHidlV1_0Test, TestSetModeSuccessful) {
{
InSequence seq;
- EXPECT_CALL(*mMockHal.get(), powerHint(Eq(PowerHint::LAUNCH), Eq(1))).Times(Exactly(1));
- EXPECT_CALL(*mMockHal.get(), powerHint(Eq(PowerHint::LOW_POWER), Eq(0))).Times(Exactly(1));
- EXPECT_CALL(*mMockHal.get(), powerHint(Eq(PowerHint::SUSTAINED_PERFORMANCE), Eq(1)))
+ EXPECT_CALL(*mMockHal.get(), powerHint(Eq(PowerHint::LAUNCH), Eq(true))).Times(Exactly(1));
+ EXPECT_CALL(*mMockHal.get(), powerHint(Eq(PowerHint::LOW_POWER), Eq(false)))
.Times(Exactly(1));
- EXPECT_CALL(*mMockHal.get(), powerHint(Eq(PowerHint::VR_MODE), Eq(0))).Times(Exactly(1));
+ EXPECT_CALL(*mMockHal.get(), powerHint(Eq(PowerHint::SUSTAINED_PERFORMANCE), Eq(true)))
+ .Times(Exactly(1));
+ EXPECT_CALL(*mMockHal.get(), powerHint(Eq(PowerHint::VR_MODE), Eq(false)))
+ .Times(Exactly(1));
EXPECT_CALL(*mMockHal.get(), setInteractive(Eq(true))).Times(Exactly(1));
EXPECT_CALL(*mMockHal.get(),
setFeature(Eq(Feature::POWER_FEATURE_DOUBLE_TAP_TO_WAKE), Eq(false)))
@@ -131,6 +141,16 @@
}
TEST_F(PowerHalWrapperHidlV1_0Test, TestSetModeIgnored) {
+ EXPECT_CALL(*mMockHal.get(), powerHint(_, _)).Times(0);
+ EXPECT_CALL(*mMockHal.get(), setInteractive(_)).Times(0);
+ EXPECT_CALL(*mMockHal.get(), setFeature(_, _)).Times(0);
+
auto result = mWrapper->setMode(Mode::CAMERA_STREAMING_HIGH, true);
ASSERT_TRUE(result.isUnsupported());
+ result = mWrapper->setMode(Mode::EXPENSIVE_RENDERING, false);
+ ASSERT_TRUE(result.isUnsupported());
+ result = mWrapper->setMode(Mode::FIXED_PERFORMANCE, true);
+ ASSERT_TRUE(result.isUnsupported());
+ result = mWrapper->setMode(Mode::GAME_LOADING, false);
+ ASSERT_TRUE(result.isUnsupported());
}