thermal: Dynamically decide thermal config to use
Add service which will device thermal config on basis of following conditions: - No display panel / proto, use thermal_info_config_proto Bug: 315096213 Test: Build and verify on all device variations Change-Id: Ic1f652dcf38888150200bb80b35aad740058e85f
This commit is contained in:
parent
242d7789a3
commit
edb8b488e5
8 changed files with 580 additions and 887 deletions
49
thermal/init_thermal_config.cpp
Normal file
49
thermal/init_thermal_config.cpp
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/properties.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace {
|
||||
using android::base::GetProperty;
|
||||
bool useThermalBackupConfig() {
|
||||
const auto panel_drv = GetProperty("ro.boot.primary_panel_drv", "");
|
||||
const auto is_panel_available = (panel_drv.find("panel-google-ct3a") != std::string::npos) ||
|
||||
(panel_drv.find("panel-google-ct3b") != std::string::npos);
|
||||
if (!is_panel_available) {
|
||||
LOG(INFO) << "Using backup thermal config as unknown panel [" << panel_drv << "] found.";
|
||||
return true;
|
||||
}
|
||||
const auto hardware_revision = GetProperty("ro.boot.hardware.revision", "");
|
||||
if (hardware_revision == "PROTO1.0" || hardware_revision == "PROTO1.1") {
|
||||
LOG(INFO) << "Using backup thermal config as hardware revision [" << hardware_revision
|
||||
<< "] found.";
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main() {
|
||||
if (useThermalBackupConfig()) {
|
||||
if (!android::base::SetProperty("vendor.thermal.config",
|
||||
"thermal_info_config_backup.json")) {
|
||||
LOG(FATAL) << "Failed to set property vendor.thermal.config to "
|
||||
"thermal_info_config_backup.";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue