use of android.os.health.HealthStatsWriter in project android_frameworks_base by ResurrectionRemix.
the class BatteryStatsService method getHealthStatsForUidLocked.
/**
* Gets a HealthStatsParceler for the given uid. You should probably call
* updateExternalStatsSync first.
*/
HealthStatsParceler getHealthStatsForUidLocked(int requestUid) {
final HealthStatsBatteryStatsWriter writer = new HealthStatsBatteryStatsWriter();
final HealthStatsWriter uidWriter = new HealthStatsWriter(UidHealthStats.CONSTANTS);
final BatteryStats.Uid uid = mStats.getUidStats().get(requestUid);
if (uid != null) {
writer.writeUid(uidWriter, mStats, uid);
}
return new HealthStatsParceler(uidWriter);
}
use of android.os.health.HealthStatsWriter in project android_frameworks_base by ResurrectionRemix.
the class HealthStatsBatteryStatsWriter method writePkg.
/**
* Writes the contents of a BatteryStats.Uid.Pkg into a HealthStatsWriter.
*/
public void writePkg(HealthStatsWriter pkgWriter, BatteryStats.Uid.Pkg pkg) {
// STATS_SERVICES
for (final Map.Entry<String, ? extends BatteryStats.Uid.Pkg.Serv> entry : pkg.getServiceStats().entrySet()) {
final HealthStatsWriter writer = new HealthStatsWriter(ServiceHealthStats.CONSTANTS);
writeServ(writer, entry.getValue());
pkgWriter.addStats(PackageHealthStats.STATS_SERVICES, entry.getKey(), writer);
}
// MEASUREMENTS_WAKEUP_ALARMS_COUNT
for (final Map.Entry<String, ? extends BatteryStats.Counter> entry : pkg.getWakeupAlarmStats().entrySet()) {
final BatteryStats.Counter counter = entry.getValue();
if (counter != null) {
pkgWriter.addMeasurements(PackageHealthStats.MEASUREMENTS_WAKEUP_ALARMS_COUNT, entry.getKey(), counter.getCountLocked(STATS_SINCE_UNPLUGGED));
}
}
}
use of android.os.health.HealthStatsWriter in project android_frameworks_base by crdroidandroid.
the class HealthStatsBatteryStatsWriter method writePkg.
/**
* Writes the contents of a BatteryStats.Uid.Pkg into a HealthStatsWriter.
*/
public void writePkg(HealthStatsWriter pkgWriter, BatteryStats.Uid.Pkg pkg) {
// STATS_SERVICES
for (final Map.Entry<String, ? extends BatteryStats.Uid.Pkg.Serv> entry : pkg.getServiceStats().entrySet()) {
final HealthStatsWriter writer = new HealthStatsWriter(ServiceHealthStats.CONSTANTS);
writeServ(writer, entry.getValue());
pkgWriter.addStats(PackageHealthStats.STATS_SERVICES, entry.getKey(), writer);
}
// MEASUREMENTS_WAKEUP_ALARMS_COUNT
for (final Map.Entry<String, ? extends BatteryStats.Counter> entry : pkg.getWakeupAlarmStats().entrySet()) {
final BatteryStats.Counter counter = entry.getValue();
if (counter != null) {
pkgWriter.addMeasurements(PackageHealthStats.MEASUREMENTS_WAKEUP_ALARMS_COUNT, entry.getKey(), counter.getCountLocked(STATS_SINCE_UNPLUGGED));
}
}
}
use of android.os.health.HealthStatsWriter in project platform_frameworks_base by android.
the class BatteryStatsService method getHealthStatsForUidLocked.
/**
* Gets a HealthStatsParceler for the given uid. You should probably call
* updateExternalStatsSync first.
*/
HealthStatsParceler getHealthStatsForUidLocked(int requestUid) {
final HealthStatsBatteryStatsWriter writer = new HealthStatsBatteryStatsWriter();
final HealthStatsWriter uidWriter = new HealthStatsWriter(UidHealthStats.CONSTANTS);
final BatteryStats.Uid uid = mStats.getUidStats().get(requestUid);
if (uid != null) {
writer.writeUid(uidWriter, mStats, uid);
}
return new HealthStatsParceler(uidWriter);
}
use of android.os.health.HealthStatsWriter in project platform_frameworks_base by android.
the class HealthStatsBatteryStatsWriter method writePkg.
/**
* Writes the contents of a BatteryStats.Uid.Pkg into a HealthStatsWriter.
*/
public void writePkg(HealthStatsWriter pkgWriter, BatteryStats.Uid.Pkg pkg) {
// STATS_SERVICES
for (final Map.Entry<String, ? extends BatteryStats.Uid.Pkg.Serv> entry : pkg.getServiceStats().entrySet()) {
final HealthStatsWriter writer = new HealthStatsWriter(ServiceHealthStats.CONSTANTS);
writeServ(writer, entry.getValue());
pkgWriter.addStats(PackageHealthStats.STATS_SERVICES, entry.getKey(), writer);
}
// MEASUREMENTS_WAKEUP_ALARMS_COUNT
for (final Map.Entry<String, ? extends BatteryStats.Counter> entry : pkg.getWakeupAlarmStats().entrySet()) {
final BatteryStats.Counter counter = entry.getValue();
if (counter != null) {
pkgWriter.addMeasurements(PackageHealthStats.MEASUREMENTS_WAKEUP_ALARMS_COUNT, entry.getKey(), counter.getCountLocked(STATS_SINCE_UNPLUGGED));
}
}
}
Aggregations