sm6375-common: power-libperfmgr: allow powerhint calls as soon as service starts

Bug: 147840817
Test: boot
Change-Id: Ic1d6e04109683b999bb99484930e95dc9813fc59
This commit is contained in:
Wei Wang 2024-07-18 20:16:00 +05:30 committed by Anand S
commit 3a0fabd235
No known key found for this signature in database
GPG key ID: 3B2983FA448B3D61
5 changed files with 23 additions and 53 deletions

View file

@ -34,7 +34,7 @@ constexpr char kPowerHalConfigPath[] = "/vendor/etc/powerhint.json";
constexpr char kPowerHalInitProp[] = "vendor.powerhal.init";
int main() {
LOG(INFO) << "Power HAL AIDL Service for moto_sm6375 is starting.";
LOG(INFO) << "Power HAL AIDL Service for moto_sm6375 with Extension is starting.";
// Parse config but do not start the looper
std::shared_ptr<HintManager> hm = HintManager::GetFromJSON(kPowerHalConfigPath, false);
@ -45,14 +45,14 @@ int main() {
// single thread
ABinderProcess_setThreadPoolMaxThreadCount(0);
// power hal core service
// core service
std::shared_ptr<Power> pw = ndk::SharedRefBase::make<Power>(hm);
ndk::SpAIBinder pwBinder = pw->asBinder();
// making the extension service
// extension service
std::shared_ptr<PowerExt> pwExt = ndk::SharedRefBase::make<PowerExt>(hm);
// need to attach the extension to the same binder we will be registering
// attach the extension to the same binder we will be registering
CHECK(STATUS_OK == AIBinder_setExtension(pwBinder.get(), pwExt->asBinder().get()));
const std::string instance = std::string() + Power::descriptor + "/default";
@ -63,12 +63,10 @@ int main() {
std::thread initThread([&]() {
::android::base::WaitForProperty(kPowerHalInitProp, "1");
hm->Start();
pw->setReady();
pwExt->setReady();
});
initThread.detach();
ABinderProcess_joinThreadPool();
LOG(ERROR) << "Power HAL AIDL Service for moto_sm6375 died.";
LOG(ERROR) << "Power HAL AIDL Service for moto_sm6375 with Extension just died.";
return EXIT_FAILURE; // should not reach
}