diff options
author | Lifu Tang <lifu@google.com> | 2013-08-30 18:03:43 -0700 |
---|---|---|
committer | Lifu Tang <lifu@google.com> | 2013-09-03 08:08:02 -0700 |
commit | ad7bfbd3469b0dfd42c6bc9d25b22c29d52fbdad (patch) | |
tree | 7ebcd7b67b963d4dfc754a437d20716abeae6532 /src/com/android | |
parent | 6dde146df030dfada1a9e112621e97424a2b6e3c (diff) | |
download | packages_apps_Settings-ad7bfbd3469b0dfd42c6bc9d25b22c29d52fbdad.tar.gz packages_apps_Settings-ad7bfbd3469b0dfd42c6bc9d25b22c29d52fbdad.tar.bz2 packages_apps_Settings-ad7bfbd3469b0dfd42c6bc9d25b22c29d52fbdad.zip |
Creates Sipper even the consumption is very little
Change-Id: I9682f262a481f3586760b8464b96eeb22814a840
Diffstat (limited to 'src/com/android')
3 files changed, 11 insertions, 6 deletions
diff --git a/src/com/android/settings/fuelgauge/BatteryStatsHelper.java b/src/com/android/settings/fuelgauge/BatteryStatsHelper.java index 3b1ea935c..953ff3df4 100644 --- a/src/com/android/settings/fuelgauge/BatteryStatsHelper.java +++ b/src/com/android/settings/fuelgauge/BatteryStatsHelper.java @@ -320,7 +320,12 @@ public class BatteryStatsHelper { R.string.details_title, null, null, 0); } - public void refreshStats() { + /** + * Refreshes the power usage list. + * @param includeZeroConsumption whether includes those applications which have consumed very + * little power up till now. + */ + public void refreshStats(boolean includeZeroConsumption) { // Initialize mStats if necessary. getStats(); @@ -336,7 +341,7 @@ public class BatteryStatsHelper { mUserSippers.clear(); mUserPower.clear(); - processAppUsage(); + processAppUsage(includeZeroConsumption); processMiscUsage(); Collections.sort(mUsageList); @@ -356,7 +361,7 @@ public class BatteryStatsHelper { } } - private void processAppUsage() { + private void processAppUsage(boolean includeZeroConsumption) { SensorManager sensorManager = (SensorManager) mActivity.getSystemService( Context.SENSOR_SERVICE); final int which = mStatsType; @@ -522,7 +527,7 @@ public class BatteryStatsHelper { // Add the app to the list if it is consuming power boolean isOtherUser = false; final int userId = UserHandle.getUserId(u.getUid()); - if (power != 0 || u.getUid() == 0) { + if (power != 0 || includeZeroConsumption || u.getUid() == 0) { BatterySipper app = new BatterySipper(mActivity, mRequestQueue, mHandler, packageWithHighestDrain, DrainType.APP, 0, u, new double[] {power}); diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java index 480bb4eeb..740fdb5d5 100644 --- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java +++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java @@ -210,7 +210,7 @@ public class PowerUsageSummary extends PreferenceFragment { addNotAvailableMessage(); return; } - mStatsHelper.refreshStats(); + mStatsHelper.refreshStats(false); List<BatterySipper> usageList = mStatsHelper.getUsageList(); for (BatterySipper sipper : usageList) { if (sipper.getSortValue() < MIN_POWER_THRESHOLD) continue; diff --git a/src/com/android/settings/location/RecentLocationApps.java b/src/com/android/settings/location/RecentLocationApps.java index 23e6dcffd..6e16151e8 100644 --- a/src/com/android/settings/location/RecentLocationApps.java +++ b/src/com/android/settings/location/RecentLocationApps.java @@ -140,7 +140,7 @@ public class RecentLocationApps { public List<Preference> getAppList() { // Retrieve Uid-based battery blaming info and generate a package to BatterySipper HashMap // for later faster looking up. - mStatsHelper.refreshStats(); + mStatsHelper.refreshStats(true); List<BatterySipper> usageList = mStatsHelper.getUsageList(); // Key: package Uid. Value: BatterySipperWrapper. HashMap<Integer, BatterySipperWrapper> sipperMap = |