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. Merged-In: If80954497a75da0d41c8d75126e42eaae1330003 Change-Id: Ie06da78b7b9435d134c99627de53d6292def58b1 Signed-off-by: George Lee <geolee@google.com>
This commit is contained in:
parent
4a94625bce
commit
2a2ebf1d78
1 changed files with 3 additions and 3 deletions
|
@ -67,7 +67,7 @@ const struct MitigationConfig::Config cfg = {
|
||||||
const char kReadyFilePath[] = "/sys/devices/virtual/pmic/mitigation/instruction/ready";
|
const char kReadyFilePath[] = "/sys/devices/virtual/pmic/mitigation/instruction/ready";
|
||||||
const char kReadyProperty[] = "vendor.brownout.mitigation.ready";
|
const char kReadyProperty[] = "vendor.brownout.mitigation.ready";
|
||||||
const char kLastMealPath[] = "/data/vendor/mitigation/lastmeal.txt";
|
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+$");
|
const std::regex kTimestampRegex("^\\S+\\s[0-9]+:[0-9]+:[0-9]+\\S+$");
|
||||||
|
|
||||||
int main(int /*argc*/, char ** /*argv*/) {
|
int main(int /*argc*/, char ** /*argv*/) {
|
||||||
|
@ -80,8 +80,8 @@ int main(int /*argc*/, char ** /*argv*/) {
|
||||||
cfg.LogFilePath,
|
cfg.LogFilePath,
|
||||||
cfg.TimestampFormat,
|
cfg.TimestampFormat,
|
||||||
kTimestampRegex);
|
kTimestampRegex);
|
||||||
int startupBugreport = android::base::GetIntProperty(kBRRequestedProperty, 0);
|
std::string reason = android::base::GetProperty(kBRRequestedProperty, "");
|
||||||
if (startupBugreport && mitigationLogTimeValid) {
|
if (!reason.empty() && mitigationLogTimeValid) {
|
||||||
std::ifstream src(cfg.LogFilePath, std::ios::in);
|
std::ifstream src(cfg.LogFilePath, std::ios::in);
|
||||||
std::ofstream dst(kLastMealPath, std::ios::out);
|
std::ofstream dst(kLastMealPath, std::ios::out);
|
||||||
dst << src.rdbuf();
|
dst << src.rdbuf();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue