Battery Mitigation: Use Brownout Reason
Brownout Reason replaces startup_bugreport_requested. Battery Mitigation needs to be updated. Bug: 237287659 Test: Ensure lastmeal.txt is properly generated. Change-Id: I33791886e0ea8fcfb3324c0f64384ffe245808d3 Signed-off-by: George Lee <geolee@google.com>
This commit is contained in:
@ -67,7 +67,7 @@ const struct MitigationConfig::Config cfg = {
|
||||
const char kReadyFilePath[] = "/sys/devices/virtual/pmic/mitigation/instruction/ready";
|
||||
const char kReadyProperty[] = "vendor.brownout.mitigation.ready";
|
||||
const char kLastMealPath[] = "/data/vendor/mitigation/lastmeal.txt";
|
||||
const char kBRRequestedProperty[] = "vendor.startup_bugreport_requested";
|
||||
const char kBRRequestedProperty[] = "vendor.brownout_reason";
|
||||
const std::regex kTimestampRegex("^\\S+\\s[0-9]+:[0-9]+:[0-9]+\\S+$");
|
||||
|
||||
int main(int /*argc*/, char ** /*argv*/) {
|
||||
@ -80,8 +80,8 @@ int main(int /*argc*/, char ** /*argv*/) {
|
||||
cfg.LogFilePath,
|
||||
cfg.TimestampFormat,
|
||||
kTimestampRegex);
|
||||
int startupBugreport = android::base::GetIntProperty(kBRRequestedProperty, 0);
|
||||
if (startupBugreport && mitigationLogTimeValid) {
|
||||
std::string reason = android::base::GetProperty(kBRRequestedProperty, "");
|
||||
if (!reason.empty() && mitigationLogTimeValid) {
|
||||
std::ifstream src(cfg.LogFilePath, std::ios::in);
|
||||
std::ofstream dst(kLastMealPath, std::ios::out);
|
||||
dst << src.rdbuf();
|
||||
|
@ -2,6 +2,7 @@ type battery_mitigation, domain;
|
||||
type battery_mitigation_exec, exec_type, vendor_file_type, file_type;
|
||||
init_daemon_domain(battery_mitigation)
|
||||
get_prop(battery_mitigation, boot_status_prop)
|
||||
get_prop(battery_mitigation, vendor_brownout_reason_prop)
|
||||
set_prop(battery_mitigation, vendor_mitigation_ready_prop)
|
||||
|
||||
hal_client_domain(battery_mitigation, hal_thermal);
|
||||
|
Reference in New Issue
Block a user