Remove smearing of hidden BatterySipper power

Bug: 182598424
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.applications.appinfo.AppBatteryPreferenceControllerTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.fuelgauge.BatteryUtilsTest

Change-Id: I78b8d7c4faafa83de198005617e99a7f54bcd174
This commit is contained in:
Dmitri Plotnikov
2021-03-12 15:01:13 -08:00
parent 60cc9e507b
commit f941a684e1
6 changed files with 14 additions and 144 deletions

View File

@@ -189,8 +189,9 @@ public class BatteryAppListPreferenceController extends AbstractPreferenceContro
if (averagePower >= MIN_AVERAGE_POWER_THRESHOLD_MILLI_AMP || USE_FAKE_DATA) {
final List<BatterySipper> usageList = getCoalescedUsageList(
USE_FAKE_DATA ? getFakeStats() : statsHelper.getUsageList());
double hiddenPowerMah = showAllApps ? 0 :
mBatteryUtils.removeHiddenBatterySippers(usageList);
if (!showAllApps) {
mBatteryUtils.removeHiddenBatterySippers(usageList);
}
mBatteryUtils.sortUsageList(usageList);
final int numSippers = usageList.size();
@@ -199,7 +200,7 @@ public class BatteryAppListPreferenceController extends AbstractPreferenceContro
double totalPower = USE_FAKE_DATA ? 4000 : statsHelper.getTotalPower();
final double percentOfTotal = mBatteryUtils.calculateBatteryPercent(
sipper.totalPowerMah, totalPower, hiddenPowerMah, dischargeAmount);
sipper.totalPowerMah, totalPower, dischargeAmount);
if (((int) (percentOfTotal + .5)) < 1) {
continue;