diff options
author | Lifu Tang <lifu@google.com> | 2013-09-03 10:09:16 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-09-03 10:09:16 -0700 |
commit | 026702dff008408c90678584332b1a798ed5fb90 (patch) | |
tree | 3a4c7e4c6e59390bc2e7fb48c400919eb0ed56d3 /src/com/android/settings | |
parent | 79063a456932f91d521a80f9c643ca1397654698 (diff) | |
parent | 06659c5a55c8ad5b7b640d23ed03fa2a8cbbab49 (diff) | |
download | packages_apps_Settings-026702dff008408c90678584332b1a798ed5fb90.tar.gz packages_apps_Settings-026702dff008408c90678584332b1a798ed5fb90.tar.bz2 packages_apps_Settings-026702dff008408c90678584332b1a798ed5fb90.zip |
am 06659c5a: Merge "Creates Sipper even the consumption is very little" into klp-dev
* commit '06659c5a55c8ad5b7b640d23ed03fa2a8cbbab49':
Creates Sipper even the consumption is very little
Diffstat (limited to 'src/com/android/settings')
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 = |