Fix early hint missing safety margin
Currently only late hints have the safety margin included, due to
inconsistency in the hint-sending methods. This patch makes said
methods consistent. In the future it's worth de-duplicating
said methods but for now this will suffice as a bugfix without
changing the logic or tests.
Bug: b/236411353
Bug: b/195990840
Test: manual
Change-Id: I0c8311e2992df69ae0826404da7d775882b5b81a
diff --git a/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp b/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
index f844845..40b1132 100644
--- a/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
+++ b/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
@@ -238,7 +238,8 @@
std::lock_guard lock(mPowerHalMutex);
HalWrapper* const halWrapper = getPowerHal();
if (halWrapper != nullptr) {
- halWrapper->sendActualWorkDuration(*predictedDuration, systemTime());
+ halWrapper->sendActualWorkDuration(*predictedDuration + kTargetSafetyMargin.count(),
+ systemTime());
}
}
}