summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2010-11-15 11:31:02 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-11-15 11:31:02 -0800
commit8ef17fcd947de32f5833340b19cc029c6e631550 (patch)
treef3d9722593616aeedff09ffd005873031d269ae4 /src/com
parenta79a7ac47a2991f883d1a8a29eb2e63c38afff7b (diff)
parent137588d60b0d8bb9612fa42f6d650751f540177b (diff)
downloadpackages_apps_settings-8ef17fcd947de32f5833340b19cc029c6e631550.zip
packages_apps_settings-8ef17fcd947de32f5833340b19cc029c6e631550.tar.gz
packages_apps_settings-8ef17fcd947de32f5833340b19cc029c6e631550.tar.bz2
Merge "Don't show battery usage information if data is bogus."
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/settings/fuelgauge/PowerUsageSummary.java30
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;