Fix carpowerpolicyd notificaitons
Update CarPowerPolicyServer to use the accumulated policy when notifying
clients of a power policy change.
Bug: 277944063
Test: manual
Change-Id: I055c7c83b7ccc5d897fe058ff323c4bd2be0b366
diff --git a/cpp/powerpolicy/server/src/CarPowerPolicyServer.cpp b/cpp/powerpolicy/server/src/CarPowerPolicyServer.cpp
index 9633dc9..bd5cde3 100644
--- a/cpp/powerpolicy/server/src/CarPowerPolicyServer.cpp
+++ b/cpp/powerpolicy/server/src/CarPowerPolicyServer.cpp
@@ -598,8 +598,10 @@
ALOGW("Failed to tell VHAL the new power policy(%s): %s", policyId.c_str(),
ret.error().message().c_str());
}
+ auto accumulatedPolicy = mComponentHandler.getAccumulatedPolicy();
for (auto client : clients) {
- ICarPowerPolicyChangeCallback::fromBinder(client.binder)->onPolicyChanged(*policy);
+ ICarPowerPolicyChangeCallback::fromBinder(client.binder)
+ ->onPolicyChanged(*accumulatedPolicy);
}
ALOGI("The current power policy is %s", policyId.c_str());
return {};