diff options
author | Amith Yamasani <yamasani@google.com> | 2010-11-12 14:13:03 -0800 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2010-11-12 14:13:03 -0800 |
commit | 137588d60b0d8bb9612fa42f6d650751f540177b (patch) | |
tree | 1011a419f9491bf6597c1e2ccdaebb616397b31a /src/com/android/settings/fuelgauge/PowerUsageSummary.java | |
parent | c05dedf9bee2445b6a35e7ca2f2d67f9b570bfaa (diff) | |
download | packages_apps_settings-137588d60b0d8bb9612fa42f6d650751f540177b.zip packages_apps_settings-137588d60b0d8bb9612fa42f6d650751f540177b.tar.gz packages_apps_settings-137588d60b0d8bb9612fa42f6d650751f540177b.tar.bz2 |
Don't show battery usage information if data is bogus.
Diffstat (limited to 'src/com/android/settings/fuelgauge/PowerUsageSummary.java')
-rw-r--r-- | src/com/android/settings/fuelgauge/PowerUsageSummary.java | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java index 9fdc7f2..aae60eb 100644 --- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java +++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java @@ -16,6 +16,13 @@ package com.android.settings.fuelgauge; +import com.android.internal.app.IBatteryStats; +import com.android.internal.os.BatteryStatsImpl; +import com.android.internal.os.PowerProfile; +import com.android.settings.R; +import com.android.settings.applications.InstalledAppDetails; +import com.android.settings.fuelgauge.PowerUsageDetail.DrainType; + import android.content.Context; import android.content.Intent; import android.hardware.SensorManager; @@ -40,13 +47,6 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; -import com.android.internal.app.IBatteryStats; -import com.android.internal.os.BatteryStatsImpl; -import com.android.internal.os.PowerProfile; -import com.android.settings.R; -import com.android.settings.applications.InstalledAppDetails; -import com.android.settings.fuelgauge.PowerUsageDetail.DrainType; - import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; @@ -309,6 +309,12 @@ public class PowerUsageSummary extends PreferenceFragment implements Runnable { } } + private void addNotAvailableMessage() { + Preference notAvailable = new Preference(getActivity()); + notAvailable.setTitle(R.string.power_usage_not_available); + mAppListGroup.addPreference(notAvailable); + } + private void refreshStats() { if (mStats == null) { load(); @@ -323,15 +329,19 @@ public class PowerUsageSummary extends PreferenceFragment implements Runnable { mUsageList.clear(); mWifiSippers.clear(); mBluetoothSippers.clear(); - processAppUsage(); - processMiscUsage(); - mAppListGroup.setOrderingAsAdded(false); BatteryHistoryPreference hist = new BatteryHistoryPreference(getActivity(), mStats); hist.setOrder(-1); mAppListGroup.addPreference(hist); + if (mPowerProfile.getAveragePower(PowerProfile.POWER_SCREEN_FULL) < 10) { + addNotAvailableMessage(); + return; + } + processAppUsage(); + processMiscUsage(); + Collections.sort(mUsageList); for (BatterySipper sipper : mUsageList) { if (sipper.getSortValue() < MIN_POWER_THRESHOLD) continue; |