sm6375-common: power-libperfmgr: add a property for config file
Test: build Bug: 173222103 Signed-off-by: Wei Wang <wvw@google.com> Change-Id: I14e7e0aa349e446f6889cbfc9a914f5314438e6b
This commit is contained in:
parent
6544285109
commit
79dc67e98c
1 changed files with 11 additions and 6 deletions
|
@ -30,16 +30,21 @@ using aidl::google::hardware::power::impl::pixel::Power;
|
||||||
using aidl::google::hardware::power::impl::pixel::PowerExt;
|
using aidl::google::hardware::power::impl::pixel::PowerExt;
|
||||||
using ::android::perfmgr::HintManager;
|
using ::android::perfmgr::HintManager;
|
||||||
|
|
||||||
constexpr char kPowerHalConfigPath[] = "/vendor/etc/powerhint.json";
|
constexpr std::string_view kPowerHalInitProp("vendor.powerhal.init");
|
||||||
constexpr char kPowerHalInitProp[] = "vendor.powerhal.init";
|
constexpr std::string_view kConfigProperty("vendor.powerhal.config");
|
||||||
|
constexpr std::string_view kConfigDefaultFileName("powerhint.json");
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
LOG(INFO) << "Power HAL AIDL Service for moto_sm6375 with Extension is starting.";
|
const std::string config_path =
|
||||||
|
"/vendor/etc/" +
|
||||||
|
android::base::GetProperty(kConfigProperty.data(), kConfigDefaultFileName.data());
|
||||||
|
LOG(INFO) << "Power HAL AIDL Service for moto_sm6375 with Extension is starting with config: "
|
||||||
|
<< config_path;
|
||||||
|
|
||||||
// Parse config but do not start the looper
|
// Parse config but do not start the looper
|
||||||
std::shared_ptr<HintManager> hm = HintManager::GetFromJSON(kPowerHalConfigPath, false);
|
std::shared_ptr<HintManager> hm = HintManager::GetFromJSON(config_path, false);
|
||||||
if (!hm) {
|
if (!hm) {
|
||||||
LOG(FATAL) << "Invalid config: " << kPowerHalConfigPath;
|
LOG(FATAL) << "Invalid config: " << config_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
// single thread
|
// single thread
|
||||||
|
@ -61,7 +66,7 @@ int main() {
|
||||||
LOG(INFO) << "Power HAL AIDL Service for moto_sm6375 is started.";
|
LOG(INFO) << "Power HAL AIDL Service for moto_sm6375 is started.";
|
||||||
|
|
||||||
std::thread initThread([&]() {
|
std::thread initThread([&]() {
|
||||||
::android::base::WaitForProperty(kPowerHalInitProp, "1");
|
::android::base::WaitForProperty(kPowerHalInitProp.data(), "1");
|
||||||
hm->Start();
|
hm->Start();
|
||||||
});
|
});
|
||||||
initThread.detach();
|
initThread.detach();
|
||||||
|
|
Loading…
Reference in a new issue