Register IonHeapSize puller only if supported

IonHeapSize atom can be created only if kernel exposes a sysfs node with
the information, otherwise 0 is returned.

Register the puller conditionally only if the sysfs node is present.
This avoids the overhead of creating the atom and simplifies the
server-side configuration.

Bug: 15044292
Test: atest UidAtomTests#testIonHeapSize_enabled
Test: atest UidAtomTests#testIonHeapSize_disabled
Change-Id: Idcbd2564d5fa087dd0a936ab55f02271741c1462
This commit is contained in:
Rafal Slawik
2020-02-28 13:20:13 +00:00
parent 2523db7c3f
commit ded8305cb7

View File

@@ -1468,6 +1468,9 @@ public class StatsPullAtomService extends SystemService {
}
private void registerIonHeapSize() {
if (!new File("/sys/kernel/ion/total_heaps_kb").exists()) {
return;
}
int tagId = FrameworkStatsLog.ION_HEAP_SIZE;
mStatsManager.registerPullAtomCallback(
tagId,