From 56fa8128ada4f43542ac6bbeb2fc2a99732e2e6c Mon Sep 17 00:00:00 2001 From: Ziyi Cui Date: Wed, 25 Jan 2023 00:00:32 +0000 Subject: [PATCH 1/3] gs-common: Update path reading for temperature residency metrics Bug: 260915419 Test: Verified the existence of atom adb shell cmd stats print-stats | grep 105045 Change-Id: Ice71b6ac9bf6fa41673f9ff89880b06b92741324 Signed-off-by: Ziyi Cui --- pixel_metrics/sepolicy/genfs_contexts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pixel_metrics/sepolicy/genfs_contexts b/pixel_metrics/sepolicy/genfs_contexts index b914014..b17bb4a 100644 --- a/pixel_metrics/sepolicy/genfs_contexts +++ b/pixel_metrics/sepolicy/genfs_contexts @@ -1,4 +1,6 @@ #vendor-metrics genfscon sysfs /kernel/metrics/resume_latency/resume_latency_metrics u:object_r:sysfs_vendor_metrics:s0 genfscon sysfs /kernel/metrics/irq/long_irq_metrics u:object_r:sysfs_vendor_metrics:s0 -genfscon sysfs /kernel/metrics/temp_residency/temp_residency_all/stats u:object_r:sysfs_vendor_metrics:s0 + +genfscon sysfs /kernel/metrics/thermal/tr_by_group/tmu/stats u:object_r:sysfs_vendor_metrics:s0 +genfscon sysfs /kernel/metrics/thermal/tr_by_group/spmic/stats u:object_r:sysfs_vendor_metrics:s0 From 82860bfe6362c08c61d11fd5b2e1b4390bdfdcd0 Mon Sep 17 00:00:00 2001 From: Xiang Wang Date: Thu, 2 Feb 2023 14:57:10 -0800 Subject: [PATCH 2/3] Allow battery_mitigation to use Binder IPC This is to resolve the following local error when testing with Thermal AIDL service enabled: auditd : type=1400 audit(0.0:4): avc: denied { call } for comm="servicemanager" scontext=u:r:servicemanager:s0 tcontext=u:r:battery_mitigation:s0 tclass=binder permissive=0 Bug: b/264595820 Test: pts-tradefed run pts -m PtsSELinuxTest Change-Id: I825ed2b644360e695081fe06489fabf3feb913bd --- battery_mitigation/sepolicy/battery_mitigation.te | 3 +++ 1 file changed, 3 insertions(+) diff --git a/battery_mitigation/sepolicy/battery_mitigation.te b/battery_mitigation/sepolicy/battery_mitigation.te index ff34c43..354fe89 100644 --- a/battery_mitigation/sepolicy/battery_mitigation.te +++ b/battery_mitigation/sepolicy/battery_mitigation.te @@ -20,3 +20,6 @@ allow battery_mitigation sysfs_bcl:lnk_file r_file_perms; allow battery_mitigation sysfs_thermal:lnk_file r_file_perms; allow battery_mitigation mitigation_vendor_data_file:dir rw_dir_perms; allow battery_mitigation mitigation_vendor_data_file:file create_file_perms; + +# Allow battery_mitigation to use Binder IPC so that service manager can notify it for callbacks +binder_use(battery_mitigation) \ No newline at end of file From d094ba620f0fb5e2842c03ae2df1eee6664845f3 Mon Sep 17 00:00:00 2001 From: Darren Hsu Date: Tue, 7 Feb 2023 10:45:26 +0800 Subject: [PATCH 3/3] powerstats: fix buffer underflow issue in CPUPM data provider Bug: 267827563 Test: dumpsys android.hardware.power.stats.IPowerStats/default Change-Id: I569a20f250c7ca3586f71084918022f04d6693d4 Signed-off-by: Darren Hsu --- .../CpupmStateResidencyDataProvider.cpp | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/powerstats/CpupmStateResidencyDataProvider.cpp b/powerstats/CpupmStateResidencyDataProvider.cpp index bb0e61f..c963f78 100644 --- a/powerstats/CpupmStateResidencyDataProvider.cpp +++ b/powerstats/CpupmStateResidencyDataProvider.cpp @@ -100,19 +100,21 @@ bool CpupmStateResidencyDataProvider::getStateResidencies( stateId = temp; } - if (stateId >= 0) { - entityIndex = matchEntity(line); - it = residencies->find(mConfig.entities[entityIndex].first); + if (stateId < 0) continue; - if (it != residencies->end()) { - if (parseState(line, &duration, &count)) { - it->second[stateId].totalTimeInStateMs = duration / US_TO_MS; - it->second[stateId].totalStateEntryCount = count; - } else { - LOG(ERROR) << "Failed to parse duration and count from [" << std::string(line) - << "]"; - return false; - } + entityIndex = matchEntity(line); + + if (entityIndex < 0) continue; + + it = residencies->find(mConfig.entities[entityIndex].first); + if (it != residencies->end()) { + if (parseState(line, &duration, &count)) { + it->second[stateId].totalTimeInStateMs = duration / US_TO_MS; + it->second[stateId].totalStateEntryCount = count; + } else { + LOG(ERROR) << "Failed to parse duration and count from [" << std::string(line) + << "]"; + return false; } } }