Loading core/java/android/os/BatteryStats.java +17 −0 Original line number Diff line number Diff line Loading @@ -743,6 +743,12 @@ public abstract class BatteryStats implements Parcelable { @UnsupportedAppUsage public abstract ArrayMap<String, ? extends Pkg> getPackageStats(); /** * Returns the proportion of power consumed by the System Service * calls made by this UID. */ public abstract double getProportionalSystemServiceUsage(); public abstract ControllerActivityCounter getWifiControllerActivity(); public abstract ControllerActivityCounter getBluetoothControllerActivity(); public abstract ControllerActivityCounter getModemControllerActivity(); Loading Loading @@ -2881,6 +2887,17 @@ public abstract class BatteryStats implements Parcelable { */ public abstract int getDischargeAmountScreenDozeSinceCharge(); /** * Returns the approximate CPU time (in microseconds) spent by the system server handling * incoming service calls from apps. * * @param cluster the index of the CPU cluster. * @param step the index of the CPU speed. This is not the actual speed of the CPU. * @see com.android.internal.os.PowerProfile#getNumCpuClusters() * @see com.android.internal.os.PowerProfile#getNumSpeedStepsInCpuCluster(int) */ public abstract long getSystemServiceTimeAtCpuSpeed(int cluster, int step); /** * Returns the total, last, or current battery uptime in microseconds. * Loading core/java/com/android/internal/os/BatterySipper.java +4 −1 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ public class BatterySipper implements Comparable<BatterySipper> { public double videoPowerMah; public double wakeLockPowerMah; public double wifiPowerMah; public double systemServiceCpuPowerMah; // **************** // This list must be kept current with atoms.proto (frameworks/base/cmds/statsd/src/atoms.proto) Loading Loading @@ -242,6 +243,7 @@ public class BatterySipper implements Comparable<BatterySipper> { videoPowerMah += other.videoPowerMah; proportionalSmearMah += other.proportionalSmearMah; totalSmearedPowerMah += other.totalSmearedPowerMah; systemServiceCpuPowerMah += other.systemServiceCpuPowerMah; } /** Loading @@ -253,7 +255,8 @@ public class BatterySipper implements Comparable<BatterySipper> { public double sumPower() { totalPowerMah = usagePowerMah + wifiPowerMah + gpsPowerMah + cpuPowerMah + sensorPowerMah + mobileRadioPowerMah + wakeLockPowerMah + cameraPowerMah + flashlightPowerMah + bluetoothPowerMah + audioPowerMah + videoPowerMah; flashlightPowerMah + bluetoothPowerMah + audioPowerMah + videoPowerMah + systemServiceCpuPowerMah; totalSmearedPowerMah = totalPowerMah + screenPowerMah + proportionalSmearMah; return totalPowerMah; Loading core/java/com/android/internal/os/BatteryStatsHelper.java +8 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ public class BatteryStatsHelper { private double mMaxDrainedPower; PowerCalculator mCpuPowerCalculator; SystemServicePowerCalculator mSystemServicePowerCalculator; PowerCalculator mWakelockPowerCalculator; MobileRadioPowerCalculator mMobileRadioPowerCalculator; PowerCalculator mWifiPowerCalculator; Loading Loading @@ -396,6 +397,11 @@ public class BatteryStatsHelper { } mCpuPowerCalculator.reset(); if (mSystemServicePowerCalculator == null) { mSystemServicePowerCalculator = new SystemServicePowerCalculator(mPowerProfile, mStats); } mSystemServicePowerCalculator.reset(); if (mMemoryPowerCalculator == null) { mMemoryPowerCalculator = new MemoryPowerCalculator(mPowerProfile); } Loading Loading @@ -588,6 +594,8 @@ public class BatteryStatsHelper { mFlashlightPowerCalculator.calculateApp(app, u, mRawRealtimeUs, mRawUptimeUs, mStatsType); mMediaPowerCalculator.calculateApp(app, u, mRawRealtimeUs, mRawUptimeUs, mStatsType); mSystemServicePowerCalculator.calculateApp(app, u, mRawRealtimeUs, mRawUptimeUs, mStatsType); final double totalPower = app.sumPower(); if (DEBUG && totalPower != 0) { Loading core/java/com/android/internal/os/BatteryStatsImpl.java +363 −97 File changed.Preview size limit exceeded, changes collapsed. Show changes core/java/com/android/internal/os/BinderCallsStats.java +2 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,8 @@ public class BinderCallsStats implements BinderInternal.Observer { if (uidEntry != null) { ArrayMap<CallStatKey, CallStat> callStats = uidEntry.mCallStats; mCallStatsObserver.noteCallStats(uidEntry.workSourceUid, uidEntry.incrementalCallCount, callStats.values()); uidEntry.incrementalCallCount, callStats.values(), mNativeTids.toArray()); uidEntry.incrementalCallCount = 0; for (int j = callStats.size() - 1; j >= 0; j--) { callStats.valueAt(j).incrementalCallCount = 0; Loading Loading
core/java/android/os/BatteryStats.java +17 −0 Original line number Diff line number Diff line Loading @@ -743,6 +743,12 @@ public abstract class BatteryStats implements Parcelable { @UnsupportedAppUsage public abstract ArrayMap<String, ? extends Pkg> getPackageStats(); /** * Returns the proportion of power consumed by the System Service * calls made by this UID. */ public abstract double getProportionalSystemServiceUsage(); public abstract ControllerActivityCounter getWifiControllerActivity(); public abstract ControllerActivityCounter getBluetoothControllerActivity(); public abstract ControllerActivityCounter getModemControllerActivity(); Loading Loading @@ -2881,6 +2887,17 @@ public abstract class BatteryStats implements Parcelable { */ public abstract int getDischargeAmountScreenDozeSinceCharge(); /** * Returns the approximate CPU time (in microseconds) spent by the system server handling * incoming service calls from apps. * * @param cluster the index of the CPU cluster. * @param step the index of the CPU speed. This is not the actual speed of the CPU. * @see com.android.internal.os.PowerProfile#getNumCpuClusters() * @see com.android.internal.os.PowerProfile#getNumSpeedStepsInCpuCluster(int) */ public abstract long getSystemServiceTimeAtCpuSpeed(int cluster, int step); /** * Returns the total, last, or current battery uptime in microseconds. * Loading
core/java/com/android/internal/os/BatterySipper.java +4 −1 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ public class BatterySipper implements Comparable<BatterySipper> { public double videoPowerMah; public double wakeLockPowerMah; public double wifiPowerMah; public double systemServiceCpuPowerMah; // **************** // This list must be kept current with atoms.proto (frameworks/base/cmds/statsd/src/atoms.proto) Loading Loading @@ -242,6 +243,7 @@ public class BatterySipper implements Comparable<BatterySipper> { videoPowerMah += other.videoPowerMah; proportionalSmearMah += other.proportionalSmearMah; totalSmearedPowerMah += other.totalSmearedPowerMah; systemServiceCpuPowerMah += other.systemServiceCpuPowerMah; } /** Loading @@ -253,7 +255,8 @@ public class BatterySipper implements Comparable<BatterySipper> { public double sumPower() { totalPowerMah = usagePowerMah + wifiPowerMah + gpsPowerMah + cpuPowerMah + sensorPowerMah + mobileRadioPowerMah + wakeLockPowerMah + cameraPowerMah + flashlightPowerMah + bluetoothPowerMah + audioPowerMah + videoPowerMah; flashlightPowerMah + bluetoothPowerMah + audioPowerMah + videoPowerMah + systemServiceCpuPowerMah; totalSmearedPowerMah = totalPowerMah + screenPowerMah + proportionalSmearMah; return totalPowerMah; Loading
core/java/com/android/internal/os/BatteryStatsHelper.java +8 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ public class BatteryStatsHelper { private double mMaxDrainedPower; PowerCalculator mCpuPowerCalculator; SystemServicePowerCalculator mSystemServicePowerCalculator; PowerCalculator mWakelockPowerCalculator; MobileRadioPowerCalculator mMobileRadioPowerCalculator; PowerCalculator mWifiPowerCalculator; Loading Loading @@ -396,6 +397,11 @@ public class BatteryStatsHelper { } mCpuPowerCalculator.reset(); if (mSystemServicePowerCalculator == null) { mSystemServicePowerCalculator = new SystemServicePowerCalculator(mPowerProfile, mStats); } mSystemServicePowerCalculator.reset(); if (mMemoryPowerCalculator == null) { mMemoryPowerCalculator = new MemoryPowerCalculator(mPowerProfile); } Loading Loading @@ -588,6 +594,8 @@ public class BatteryStatsHelper { mFlashlightPowerCalculator.calculateApp(app, u, mRawRealtimeUs, mRawUptimeUs, mStatsType); mMediaPowerCalculator.calculateApp(app, u, mRawRealtimeUs, mRawUptimeUs, mStatsType); mSystemServicePowerCalculator.calculateApp(app, u, mRawRealtimeUs, mRawUptimeUs, mStatsType); final double totalPower = app.sumPower(); if (DEBUG && totalPower != 0) { Loading
core/java/com/android/internal/os/BatteryStatsImpl.java +363 −97 File changed.Preview size limit exceeded, changes collapsed. Show changes
core/java/com/android/internal/os/BinderCallsStats.java +2 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,8 @@ public class BinderCallsStats implements BinderInternal.Observer { if (uidEntry != null) { ArrayMap<CallStatKey, CallStat> callStats = uidEntry.mCallStats; mCallStatsObserver.noteCallStats(uidEntry.workSourceUid, uidEntry.incrementalCallCount, callStats.values()); uidEntry.incrementalCallCount, callStats.values(), mNativeTids.toArray()); uidEntry.incrementalCallCount = 0; for (int j = callStats.size() - 1; j >= 0; j--) { callStats.valueAt(j).incrementalCallCount = 0; Loading