Battery chart fixes.

When there is no data to show, don't make a crazy collapsed chart.

Also avoid re-creating the chart when scrolling.

And fix various other things.

Change-Id: Ia1895bc7c46e6d830e66f66e66f17726e1e23e3f
This commit is contained in:
Dianne Hackborn
2014-07-10 10:40:58 -07:00
parent 5427b9a799
commit c19eb361a4
8 changed files with 171 additions and 41 deletions

View File

@@ -272,6 +272,26 @@ public class PowerUsageSummary extends PreferenceFragment {
if (((int) (percentOfTotal + .5)) < 1) {
continue;
}
if (sipper.drainType == BatterySipper.DrainType.OVERCOUNTED) {
// Don't show over-counted unless it is at least 2/3 the size of
// the largest real entry, and its percent of total is more significant
if (sipper.value < ((mStatsHelper.getMaxRealPower()*2)/3)) {
continue;
}
if (percentOfTotal < 10) {
continue;
}
}
if (sipper.drainType == BatterySipper.DrainType.UNACCOUNTED) {
// Don't show over-counted unless it is at least 1/2 the size of
// the largest real entry, and its percent of total is more significant
if (sipper.value < (mStatsHelper.getMaxRealPower()/2)) {
continue;
}
if (percentOfTotal < 5) {
continue;
}
}
final UserHandle userHandle = new UserHandle(UserHandle.getUserId(sipper.getUid()));
final BatteryEntry entry = new BatteryEntry(getActivity(), mHandler, mUm, sipper);
final PowerGaugePreference pref = new PowerGaugePreference(getActivity(),