Skip to content

Commit 427e333

Browse files
weivincewangAndroid (Google) Code Review
authored andcommitted
Merge "Revert "Update SF to use createHintSessionWithConfig"" into main
2 parents a107648 + 48cca92 commit 427e333

3 files changed

Lines changed: 10 additions & 19 deletions

File tree

services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ namespace impl {
4848
using aidl::android::hardware::power::Boost;
4949
using aidl::android::hardware::power::Mode;
5050
using aidl::android::hardware::power::SessionHint;
51-
using aidl::android::hardware::power::SessionTag;
5251
using aidl::android::hardware::power::WorkDuration;
5352

5453
PowerAdvisor::~PowerAdvisor() = default;
@@ -207,12 +206,9 @@ bool PowerAdvisor::supportsPowerHintSession() {
207206

208207
bool PowerAdvisor::ensurePowerHintSessionRunning() {
209208
if (mHintSession == nullptr && !mHintSessionThreadIds.empty() && usePowerHintSession()) {
210-
auto ret =
211-
getPowerHal().createHintSessionWithConfig(getpid(), static_cast<int32_t>(getuid()),
212-
mHintSessionThreadIds,
213-
mTargetDuration.ns(),
214-
SessionTag::SURFACEFLINGER,
215-
&mSessionConfig);
209+
auto ret = getPowerHal().createHintSession(getpid(), static_cast<int32_t>(getuid()),
210+
mHintSessionThreadIds, mTargetDuration.ns());
211+
216212
if (ret.isOk()) {
217213
mHintSession = ret.value();
218214
}

services/surfaceflinger/DisplayHardware/PowerAdvisor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,6 @@ class PowerAdvisor final : public Hwc2::PowerAdvisor {
292292
// Whether we should send reportActualWorkDuration calls
293293
static const bool sUseReportActualDuration;
294294

295-
// Metadata about the session returned from PowerHAL
296-
aidl::android::hardware::power::SessionConfig mSessionConfig;
297-
298295
// How long we expect hwc to run after the present call until it waits for the fence
299296
static constexpr const Duration kFenceWaitStartDelayValidated{150us};
300297
static constexpr const Duration kFenceWaitStartDelaySkippedValidate{250us};

services/surfaceflinger/tests/unittests/PowerAdvisorTest.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,12 @@ void PowerAdvisorTest::SetUp() {
7474
void PowerAdvisorTest::startPowerHintSession(bool returnValidSession) {
7575
mMockPowerHintSession = ndk::SharedRefBase::make<NiceMock<MockIPowerHintSession>>();
7676
if (returnValidSession) {
77-
ON_CALL(*mMockPowerHalController, createHintSessionWithConfig)
78-
.WillByDefault(DoAll(SetArgPointee<5>(aidl::android::hardware::power::SessionConfig{
79-
.id = 12}),
80-
Return(HalResult<std::shared_ptr<IPowerHintSession>>::
81-
fromStatus(binder::Status::ok(),
82-
mMockPowerHintSession))));
77+
ON_CALL(*mMockPowerHalController, createHintSession)
78+
.WillByDefault(
79+
Return(HalResult<std::shared_ptr<IPowerHintSession>>::
80+
fromStatus(binder::Status::ok(), mMockPowerHintSession)));
8381
} else {
84-
ON_CALL(*mMockPowerHalController, createHintSessionWithConfig)
82+
ON_CALL(*mMockPowerHalController, createHintSession)
8583
.WillByDefault(Return(HalResult<std::shared_ptr<IPowerHintSession>>::
8684
fromStatus(binder::Status::ok(), nullptr)));
8785
}
@@ -285,7 +283,7 @@ TEST_F(PowerAdvisorTest, hintSessionValidWhenNullFromPowerHAL) {
285283
}
286284

287285
TEST_F(PowerAdvisorTest, hintSessionOnlyCreatedOnce) {
288-
EXPECT_CALL(*mMockPowerHalController, createHintSessionWithConfig(_, _, _, _, _, _)).Times(1);
286+
EXPECT_CALL(*mMockPowerHalController, createHintSession(_, _, _, _)).Times(1);
289287
mPowerAdvisor->onBootFinished();
290288
startPowerHintSession();
291289
mPowerAdvisor->startPowerHintSession({1, 2, 3});
@@ -337,7 +335,7 @@ TEST_F(PowerAdvisorTest, hintSessionTestNotifyReportRace) {
337335
return ndk::ScopedAStatus::fromExceptionCode(-127);
338336
});
339337

340-
ON_CALL(*mMockPowerHalController, createHintSessionWithConfig)
338+
ON_CALL(*mMockPowerHalController, createHintSession)
341339
.WillByDefault(Return(
342340
HalResult<std::shared_ptr<IPowerHintSession>>::
343341
fromStatus(ndk::ScopedAStatus::fromExceptionCode(-127), nullptr)));

0 commit comments

Comments
 (0)