am 68f35ec2: am dbec91c0: Implement issue #16330060: Inform ActivityManager about WebView...

* commit '68f35ec2d2f9950f57afa9900f16a3b29a8d55b0':
  Implement issue #16330060: Inform ActivityManager about WebView...
This commit is contained in:
Dianne Hackborn
2014-07-17 18:22:17 +00:00
committed by Android Git Automerger
20 changed files with 383 additions and 54 deletions

View File

@@ -80,6 +80,15 @@ public class BatterySipper implements Comparable<BatterySipper> {
@Override
public int compareTo(BatterySipper other) {
// Over-counted always goes to the bottom.
if (drainType != other.drainType) {
if (drainType == DrainType.OVERCOUNTED) {
// This is "larger"
return 1;
} else if (other.drainType == DrainType.OVERCOUNTED) {
return -1;
}
}
// Return the flipped value because we want the items in descending order
return Double.compare(other.value, value);
}

View File

@@ -48,7 +48,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Arrays;
/**
* A helper class for retrieving the power usage information for all applications and services.
@@ -95,6 +94,7 @@ public class BatteryStatsHelper {
private long mStatsPeriod = 0;
private double mMaxPower = 1;
private double mMaxRealPower = 1;
private double mComputedPower;
private double mTotalPower;
private double mWifiPower;
@@ -208,6 +208,7 @@ public class BatteryStatsHelper {
getStats();
mMaxPower = 0;
mMaxRealPower = 0;
mComputedPower = 0;
mTotalPower = 0;
mWifiPower = 0;
@@ -542,6 +543,7 @@ public class BatteryStatsHelper {
} else {
mUsageList.add(app);
if (power > mMaxPower) mMaxPower = power;
if (power > mMaxRealPower) mMaxRealPower = power;
mComputedPower += power;
}
if (u.getUid() == 0) {
@@ -567,6 +569,7 @@ public class BatteryStatsHelper {
osApp.value += power;
osApp.values[0] += power;
if (osApp.value > mMaxPower) mMaxPower = osApp.value;
if (osApp.value > mMaxRealPower) mMaxRealPower = osApp.value;
mComputedPower += power;
}
}
@@ -806,6 +809,7 @@ public class BatteryStatsHelper {
private BatterySipper addEntry(DrainType drainType, long time, double power) {
mComputedPower += power;
if (power > mMaxRealPower) mMaxRealPower = power;
return addEntryNoTotal(drainType, time, power);
}
@@ -831,6 +835,8 @@ public class BatteryStatsHelper {
public double getMaxPower() { return mMaxPower; }
public double getMaxRealPower() { return mMaxRealPower; }
public double getTotalPower() { return mTotalPower; }
public double getComputedPower() { return mComputedPower; }