PowerAdvisor: Wait for boot finished
Adds a call to PowerAdvisor so it can gate calls to
notifyDisplayUpdateImminent until the boot has finished. This prevents
PowerAdvisor from attempting to connect to the Power HAL, which can
delay the boot animation if SF comes up first.
Bug: 152131148
Test: libsurfaceflinger_unittest
Test: libcompositionengine_test
Test: Manual, check that boot is not delayed
Change-Id: Idf59e9bb62a03360925aa06d95a7b4caea36be83
diff --git a/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp b/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
index 06e0cbb..1d8179c 100644
--- a/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
+++ b/services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp
@@ -72,6 +72,10 @@
}
}
+void PowerAdvisor::onBootFinished() {
+ mBootFinished.store(true);
+}
+
void PowerAdvisor::setExpensiveRenderingExpected(DisplayId displayId, bool expected) {
if (expected) {
mExpensiveDisplays.insert(displayId);
@@ -97,6 +101,12 @@
}
void PowerAdvisor::notifyDisplayUpdateImminent() {
+ // Only start sending this notification once the system has booted so we don't introduce an
+ // early-boot dependency on Power HAL
+ if (!mBootFinished.load()) {
+ return;
+ }
+
if (mSendUpdateImminent.load()) {
HalWrapper* const halWrapper = getPowerHal();
if (halWrapper == nullptr) {