am be5994d2
: Some improvements to the battery usage UI:
Merge commit 'be5994d20152c7194aac79eb8152240655fd3373' into gingerbread-plus-aosp * commit 'be5994d20152c7194aac79eb8152240655fd3373': Some improvements to the battery usage UI:
This commit is contained in:
@@ -2037,13 +2037,17 @@ found in the list of installed applications.</string>
|
|||||||
<string name="battery_stats_on_battery"><xliff:g id="time">%1$s</xliff:g> on battery</string>
|
<string name="battery_stats_on_battery"><xliff:g id="time">%1$s</xliff:g> on battery</string>
|
||||||
<!-- Battery usage duration -->
|
<!-- Battery usage duration -->
|
||||||
<string name="battery_stats_duration"><xliff:g id="time">%1$s</xliff:g> since unplugged</string>
|
<string name="battery_stats_duration"><xliff:g id="time">%1$s</xliff:g> since unplugged</string>
|
||||||
<!-- Label for battery stats charging state graph -->
|
<!-- [CHAR LIMIT=25] Label for battery stats charging state graph -->
|
||||||
<string name="battery_stats_charging_label">Charging</string>
|
<string name="battery_stats_charging_label">Charging</string>
|
||||||
<!-- Label for battery stats screen on state graph -->
|
<!-- [CHAR LIMIT=25] Label for battery stats screen on state graph -->
|
||||||
<string name="battery_stats_screen_on_label">Screen on</string>
|
<string name="battery_stats_screen_on_label">Screen on</string>
|
||||||
<!-- Label for battery stats gps on state graph -->
|
<!-- [CHAR LIMIT=25] Label for battery stats gps on state graph -->
|
||||||
<string name="battery_stats_gps_on_label">GPS on</string>
|
<string name="battery_stats_gps_on_label">GPS on</string>
|
||||||
<!-- Label for battery stats phone signal strength graph -->
|
<!-- [CHAR LIMIT=25] Label for battery stats wifi running state graph -->
|
||||||
|
<string name="battery_stats_wifi_running_label">WIFI</string>
|
||||||
|
<!-- [CHAR LIMIT=25] Label for battery stats wake lock state graph -->
|
||||||
|
<string name="battery_stats_wake_lock_label">Awake</string>
|
||||||
|
<!-- [CHAR LIMIT=25] Label for battery stats phone signal strength graph -->
|
||||||
<string name="battery_stats_phone_signal_label">Phone signal</string>
|
<string name="battery_stats_phone_signal_label">Phone signal</string>
|
||||||
<!-- Battery usage during last unplugged period -->
|
<!-- Battery usage during last unplugged period -->
|
||||||
<string name="battery_stats_last_duration">@string/menu_stats_last_unplugged</string>
|
<string name="battery_stats_last_duration">@string/menu_stats_last_unplugged</string>
|
||||||
@@ -2083,6 +2087,8 @@ found in the list of installed applications.</string>
|
|||||||
<string name="usage_type_cpu">CPU total</string>
|
<string name="usage_type_cpu">CPU total</string>
|
||||||
<!-- Label for CPU usage in foreground -->
|
<!-- Label for CPU usage in foreground -->
|
||||||
<string name="usage_type_cpu_foreground">CPU foreground</string>
|
<string name="usage_type_cpu_foreground">CPU foreground</string>
|
||||||
|
<!-- [CHAR LIMIT=25] Label for keeping device from sleeping -->
|
||||||
|
<string name="usage_type_wake_lock">Keep awake</string>
|
||||||
<!-- Label for GPU usage time -->
|
<!-- Label for GPU usage time -->
|
||||||
<string name="usage_type_gps">GPS</string>
|
<string name="usage_type_gps">GPS</string>
|
||||||
<!-- Label for Phone usage time -->
|
<!-- Label for Phone usage time -->
|
||||||
|
@@ -115,11 +115,11 @@ public class RunningProcessesView extends FrameLayout
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (uptimeView != null) {
|
if (uptimeView != null) {
|
||||||
if (mItem.mActiveSince >= 0) {
|
if (mFirstRunTime >= 0) {
|
||||||
//Log.i("foo", "Time for " + mItem.mDisplayLabel
|
//Log.i("foo", "Time for " + mItem.mDisplayLabel
|
||||||
// + ": " + (SystemClock.uptimeMillis()-mFirstRunTime));
|
// + ": " + (SystemClock.uptimeMillis()-mFirstRunTime));
|
||||||
uptimeView.setText(DateUtils.formatElapsedTime(builder,
|
uptimeView.setText(DateUtils.formatElapsedTime(builder,
|
||||||
(SystemClock.uptimeMillis()-mFirstRunTime)/1000));
|
(SystemClock.elapsedRealtime()-mFirstRunTime)/1000));
|
||||||
} else {
|
} else {
|
||||||
boolean isService = false;
|
boolean isService = false;
|
||||||
if (mItem instanceof RunningState.MergedItem) {
|
if (mItem instanceof RunningState.MergedItem) {
|
||||||
|
@@ -92,8 +92,8 @@ public class RunningServiceDetails extends Activity
|
|||||||
& ApplicationInfo.FLAG_SYSTEM) != 0;
|
& ApplicationInfo.FLAG_SYSTEM) != 0;
|
||||||
ApplicationErrorReport.RunningServiceInfo info
|
ApplicationErrorReport.RunningServiceInfo info
|
||||||
= new ApplicationErrorReport.RunningServiceInfo();
|
= new ApplicationErrorReport.RunningServiceInfo();
|
||||||
if (mActiveItem.mItem.mActiveSince >= 0) {
|
if (mActiveItem.mFirstRunTime >= 0) {
|
||||||
info.durationMillis = SystemClock.uptimeMillis()-mActiveItem.mFirstRunTime;
|
info.durationMillis = SystemClock.elapsedRealtime()-mActiveItem.mFirstRunTime;
|
||||||
} else {
|
} else {
|
||||||
info.durationMillis = -1;
|
info.durationMillis = -1;
|
||||||
}
|
}
|
||||||
|
@@ -53,6 +53,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
final Paint mChargingPaint = new Paint();
|
final Paint mChargingPaint = new Paint();
|
||||||
final Paint mScreenOnPaint = new Paint();
|
final Paint mScreenOnPaint = new Paint();
|
||||||
final Paint mGpsOnPaint = new Paint();
|
final Paint mGpsOnPaint = new Paint();
|
||||||
|
final Paint mWifiRunningPaint = new Paint();
|
||||||
|
final Paint mWakeLockPaint = new Paint();
|
||||||
final Paint[] mPhoneSignalPaints = new Paint[NUM_PHONE_SIGNALS];
|
final Paint[] mPhoneSignalPaints = new Paint[NUM_PHONE_SIGNALS];
|
||||||
final int[] mPhoneSignalColors = new int[] {
|
final int[] mPhoneSignalColors = new int[] {
|
||||||
0x00000000, 0xffa00000, 0xffa0a000, 0xff808020,
|
0x00000000, 0xffa00000, 0xffa0a000, 0xff808020,
|
||||||
@@ -67,6 +69,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
final Path mChargingPath = new Path();
|
final Path mChargingPath = new Path();
|
||||||
final Path mScreenOnPath = new Path();
|
final Path mScreenOnPath = new Path();
|
||||||
final Path mGpsOnPath = new Path();
|
final Path mGpsOnPath = new Path();
|
||||||
|
final Path mWifiRunningPath = new Path();
|
||||||
|
final Path mWakeLockPath = new Path();
|
||||||
|
|
||||||
int mFontSize;
|
int mFontSize;
|
||||||
|
|
||||||
@@ -77,6 +81,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
String mChargingLabel;
|
String mChargingLabel;
|
||||||
String mScreenOnLabel;
|
String mScreenOnLabel;
|
||||||
String mGpsOnLabel;
|
String mGpsOnLabel;
|
||||||
|
String mWifiRunningLabel;
|
||||||
|
String mWakeLockLabel;
|
||||||
String mPhoneSignalLabel;
|
String mPhoneSignalLabel;
|
||||||
|
|
||||||
int mTextAscent;
|
int mTextAscent;
|
||||||
@@ -91,6 +97,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
int mChargingOffset;
|
int mChargingOffset;
|
||||||
int mScreenOnOffset;
|
int mScreenOnOffset;
|
||||||
int mGpsOnOffset;
|
int mGpsOnOffset;
|
||||||
|
int mWifiRunningOffset;
|
||||||
|
int mWakeLockOffset;
|
||||||
int mPhoneSignalOffset;
|
int mPhoneSignalOffset;
|
||||||
int mLevelOffset;
|
int mLevelOffset;
|
||||||
int mLevelTop;
|
int mLevelTop;
|
||||||
@@ -107,6 +115,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
long mHistEnd;
|
long mHistEnd;
|
||||||
int mBatLow;
|
int mBatLow;
|
||||||
int mBatHigh;
|
int mBatHigh;
|
||||||
|
boolean mHaveWifi;
|
||||||
|
boolean mHaveGps;
|
||||||
|
|
||||||
public BatteryHistoryChart(Context context, AttributeSet attrs) {
|
public BatteryHistoryChart(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
@@ -125,6 +135,10 @@ public class BatteryHistoryChart extends View {
|
|||||||
mScreenOnPaint.setStyle(Paint.Style.STROKE);
|
mScreenOnPaint.setStyle(Paint.Style.STROKE);
|
||||||
mGpsOnPaint.setARGB(255, 0, 0, 255);
|
mGpsOnPaint.setARGB(255, 0, 0, 255);
|
||||||
mGpsOnPaint.setStyle(Paint.Style.STROKE);
|
mGpsOnPaint.setStyle(Paint.Style.STROKE);
|
||||||
|
mWifiRunningPaint.setARGB(255, 0, 0, 255);
|
||||||
|
mWifiRunningPaint.setStyle(Paint.Style.STROKE);
|
||||||
|
mWakeLockPaint.setARGB(255, 0, 0, 255);
|
||||||
|
mWakeLockPaint.setStyle(Paint.Style.STROKE);
|
||||||
for (int i=0; i<NUM_PHONE_SIGNALS; i++) {
|
for (int i=0; i<NUM_PHONE_SIGNALS; i++) {
|
||||||
mPhoneSignalPaints[i] = new Paint();
|
mPhoneSignalPaints[i] = new Paint();
|
||||||
mPhoneSignalPaints[i].setColor(mPhoneSignalColors[i]);
|
mPhoneSignalPaints[i].setColor(mPhoneSignalColors[i]);
|
||||||
@@ -278,6 +292,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
mChargingLabel = getContext().getString(R.string.battery_stats_charging_label);
|
mChargingLabel = getContext().getString(R.string.battery_stats_charging_label);
|
||||||
mScreenOnLabel = getContext().getString(R.string.battery_stats_screen_on_label);
|
mScreenOnLabel = getContext().getString(R.string.battery_stats_screen_on_label);
|
||||||
mGpsOnLabel = getContext().getString(R.string.battery_stats_gps_on_label);
|
mGpsOnLabel = getContext().getString(R.string.battery_stats_gps_on_label);
|
||||||
|
mWifiRunningLabel = getContext().getString(R.string.battery_stats_wifi_running_label);
|
||||||
|
mWakeLockLabel = getContext().getString(R.string.battery_stats_wake_lock_label);
|
||||||
mPhoneSignalLabel = getContext().getString(R.string.battery_stats_phone_signal_label);
|
mPhoneSignalLabel = getContext().getString(R.string.battery_stats_phone_signal_label);
|
||||||
|
|
||||||
BatteryStats.HistoryItem rec = stats.getHistory();
|
BatteryStats.HistoryItem rec = stats.getHistory();
|
||||||
@@ -287,6 +303,7 @@ public class BatteryHistoryChart extends View {
|
|||||||
byte lastLevel = -1;
|
byte lastLevel = -1;
|
||||||
mBatLow = 0;
|
mBatLow = 0;
|
||||||
mBatHigh = 100;
|
mBatHigh = 100;
|
||||||
|
int aggrStates = 0;
|
||||||
while (rec != null) {
|
while (rec != null) {
|
||||||
pos++;
|
pos++;
|
||||||
if (rec.cmd == HistoryItem.CMD_UPDATE) {
|
if (rec.cmd == HistoryItem.CMD_UPDATE) {
|
||||||
@@ -299,10 +316,13 @@ public class BatteryHistoryChart extends View {
|
|||||||
lastInteresting = pos;
|
lastInteresting = pos;
|
||||||
mHistEnd = rec.time;
|
mHistEnd = rec.time;
|
||||||
}
|
}
|
||||||
|
aggrStates |= rec.states;
|
||||||
}
|
}
|
||||||
rec = rec.next;
|
rec = rec.next;
|
||||||
}
|
}
|
||||||
mNumHist = lastInteresting;
|
mNumHist = lastInteresting;
|
||||||
|
mHaveGps = (aggrStates&HistoryItem.STATE_GPS_ON_FLAG) != 0;
|
||||||
|
mHaveWifi = (aggrStates&HistoryItem.STATE_WIFI_RUNNING_FLAG) != 0;
|
||||||
|
|
||||||
if (mHistEnd <= mHistStart) mHistEnd = mHistStart+1;
|
if (mHistEnd <= mHistStart) mHistEnd = mHistStart+1;
|
||||||
mTotalDurationString = Utils.formatElapsedTime(getContext(), mHistEnd - mHistStart);
|
mTotalDurationString = Utils.formatElapsedTime(getContext(), mHistEnd - mHistStart);
|
||||||
@@ -325,7 +345,7 @@ public class BatteryHistoryChart extends View {
|
|||||||
|
|
||||||
void finishPaths(int w, int h, int levelh, int startX, int y, Path curLevelPath,
|
void finishPaths(int w, int h, int levelh, int startX, int y, Path curLevelPath,
|
||||||
int lastX, boolean lastCharging, boolean lastScreenOn, boolean lastGpsOn,
|
int lastX, boolean lastCharging, boolean lastScreenOn, boolean lastGpsOn,
|
||||||
int lastPhoneSignal, Path lastPath) {
|
boolean lastWifiRunning, boolean lastWakeLock, int lastPhoneSignal, Path lastPath) {
|
||||||
if (curLevelPath != null) {
|
if (curLevelPath != null) {
|
||||||
if (lastX >= 0 && lastX < w) {
|
if (lastX >= 0 && lastX < w) {
|
||||||
if (lastPath != null) {
|
if (lastPath != null) {
|
||||||
@@ -347,6 +367,12 @@ public class BatteryHistoryChart extends View {
|
|||||||
if (lastGpsOn) {
|
if (lastGpsOn) {
|
||||||
mGpsOnPath.lineTo(w, h-mGpsOnOffset);
|
mGpsOnPath.lineTo(w, h-mGpsOnOffset);
|
||||||
}
|
}
|
||||||
|
if (lastWifiRunning) {
|
||||||
|
mWifiRunningPath.lineTo(w, h-mWifiRunningOffset);
|
||||||
|
}
|
||||||
|
if (lastWakeLock) {
|
||||||
|
mWakeLockPath.lineTo(w, h-mWakeLockOffset);
|
||||||
|
}
|
||||||
if (lastPhoneSignal != 0) {
|
if (lastPhoneSignal != 0) {
|
||||||
addPhoneSignalTick(w, 0);
|
addPhoneSignalTick(w, 0);
|
||||||
}
|
}
|
||||||
@@ -376,17 +402,22 @@ public class BatteryHistoryChart extends View {
|
|||||||
mChargingPaint.setStrokeWidth(mLineWidth);
|
mChargingPaint.setStrokeWidth(mLineWidth);
|
||||||
mScreenOnPaint.setStrokeWidth(mLineWidth);
|
mScreenOnPaint.setStrokeWidth(mLineWidth);
|
||||||
mGpsOnPaint.setStrokeWidth(mLineWidth);
|
mGpsOnPaint.setStrokeWidth(mLineWidth);
|
||||||
|
mWifiRunningPaint.setStrokeWidth(mLineWidth);
|
||||||
|
mWakeLockPaint.setStrokeWidth(mLineWidth);
|
||||||
|
|
||||||
if (mLargeMode) {
|
if (mLargeMode) {
|
||||||
int barOffset = textHeight + mLineWidth;
|
int barOffset = textHeight + mLineWidth;
|
||||||
mScreenOnOffset = mLineWidth;
|
mChargingOffset = mLineWidth;
|
||||||
mGpsOnOffset = mScreenOnOffset + barOffset;
|
mScreenOnOffset = mChargingOffset + barOffset;
|
||||||
mPhoneSignalOffset = mGpsOnOffset + barOffset;
|
mWakeLockOffset = mScreenOnOffset + barOffset;
|
||||||
mChargingOffset = mPhoneSignalOffset + barOffset;
|
mWifiRunningOffset = mWakeLockOffset + barOffset;
|
||||||
mLevelOffset = mChargingOffset + barOffset + mLineWidth;
|
mGpsOnOffset = mHaveWifi ? (mWifiRunningOffset + barOffset) : mWakeLockOffset;
|
||||||
|
mPhoneSignalOffset = mHaveGps ? (mGpsOnOffset + barOffset) : mWifiRunningOffset;
|
||||||
|
mLevelOffset = mPhoneSignalOffset + barOffset + mLineWidth;
|
||||||
mPhoneSignalTicks = new int[w+2];
|
mPhoneSignalTicks = new int[w+2];
|
||||||
} else {
|
} else {
|
||||||
mScreenOnOffset = mGpsOnOffset = mLineWidth;
|
mScreenOnOffset = mGpsOnOffset = mWifiRunningOffset
|
||||||
|
= mWakeLockOffset = mLineWidth;
|
||||||
mChargingOffset = mLineWidth*2;
|
mChargingOffset = mLineWidth*2;
|
||||||
mPhoneSignalOffset = 0;
|
mPhoneSignalOffset = 0;
|
||||||
mLevelOffset = mLineWidth*3;
|
mLevelOffset = mLineWidth*3;
|
||||||
@@ -399,6 +430,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
mBatCriticalPath.reset();
|
mBatCriticalPath.reset();
|
||||||
mScreenOnPath.reset();
|
mScreenOnPath.reset();
|
||||||
mGpsOnPath.reset();
|
mGpsOnPath.reset();
|
||||||
|
mWifiRunningPath.reset();
|
||||||
|
mWakeLockPath.reset();
|
||||||
mChargingPath.reset();
|
mChargingPath.reset();
|
||||||
|
|
||||||
final long timeStart = mHistStart;
|
final long timeStart = mHistStart;
|
||||||
@@ -416,6 +449,7 @@ public class BatteryHistoryChart extends View {
|
|||||||
Path curLevelPath = null;
|
Path curLevelPath = null;
|
||||||
Path lastLinePath = null;
|
Path lastLinePath = null;
|
||||||
boolean lastCharging = false, lastScreenOn = false, lastGpsOn = false;
|
boolean lastCharging = false, lastScreenOn = false, lastGpsOn = false;
|
||||||
|
boolean lastWifiRunning = false, lastWakeLock = false;
|
||||||
int lastPhoneSignalBin = 0;
|
int lastPhoneSignalBin = 0;
|
||||||
final int N = mNumHist;
|
final int N = mNumHist;
|
||||||
while (rec != null && i < N) {
|
while (rec != null && i < N) {
|
||||||
@@ -487,6 +521,28 @@ public class BatteryHistoryChart extends View {
|
|||||||
lastGpsOn = gpsOn;
|
lastGpsOn = gpsOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final boolean wifiRunning =
|
||||||
|
(rec.states&HistoryItem.STATE_WIFI_RUNNING_FLAG) != 0;
|
||||||
|
if (wifiRunning != lastWifiRunning) {
|
||||||
|
if (wifiRunning) {
|
||||||
|
mWifiRunningPath.moveTo(x, h-mWifiRunningOffset);
|
||||||
|
} else {
|
||||||
|
mWifiRunningPath.lineTo(x, h-mWifiRunningOffset);
|
||||||
|
}
|
||||||
|
lastWifiRunning = wifiRunning;
|
||||||
|
}
|
||||||
|
|
||||||
|
final boolean wakeLock =
|
||||||
|
(rec.states&HistoryItem.STATE_WAKE_LOCK_FLAG) != 0;
|
||||||
|
if (wakeLock != lastWakeLock) {
|
||||||
|
if (wakeLock) {
|
||||||
|
mWakeLockPath.moveTo(x, h-mWakeLockOffset);
|
||||||
|
} else {
|
||||||
|
mWakeLockPath.lineTo(x, h-mWakeLockOffset);
|
||||||
|
}
|
||||||
|
lastWakeLock = wakeLock;
|
||||||
|
}
|
||||||
|
|
||||||
if (mLargeMode) {
|
if (mLargeMode) {
|
||||||
int bin;
|
int bin;
|
||||||
if (((rec.states&HistoryItem.STATE_PHONE_STATE_MASK)
|
if (((rec.states&HistoryItem.STATE_PHONE_STATE_MASK)
|
||||||
@@ -509,12 +565,12 @@ public class BatteryHistoryChart extends View {
|
|||||||
|
|
||||||
} else if (curLevelPath != null) {
|
} else if (curLevelPath != null) {
|
||||||
finishPaths(x+1, h, levelh, startX, lastY, curLevelPath, lastX,
|
finishPaths(x+1, h, levelh, startX, lastY, curLevelPath, lastX,
|
||||||
lastCharging, lastScreenOn, lastGpsOn, lastPhoneSignalBin,
|
lastCharging, lastScreenOn, lastGpsOn, lastWifiRunning,
|
||||||
lastLinePath);
|
lastWakeLock, lastPhoneSignalBin, lastLinePath);
|
||||||
lastX = lastY = -1;
|
lastX = lastY = -1;
|
||||||
curLevelPath = null;
|
curLevelPath = null;
|
||||||
lastLinePath = null;
|
lastLinePath = null;
|
||||||
lastCharging = lastScreenOn = lastGpsOn = false;
|
lastCharging = lastScreenOn = lastGpsOn = lastWakeLock = false;
|
||||||
lastPhoneSignalBin = 0;
|
lastPhoneSignalBin = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,7 +579,8 @@ public class BatteryHistoryChart extends View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
finishPaths(w, h, levelh, startX, lastY, curLevelPath, lastX,
|
finishPaths(w, h, levelh, startX, lastY, curLevelPath, lastX,
|
||||||
lastCharging, lastScreenOn, lastGpsOn, lastPhoneSignalBin, lastLinePath);
|
lastCharging, lastScreenOn, lastGpsOn, lastWifiRunning,
|
||||||
|
lastWakeLock, lastPhoneSignalBin, lastLinePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -571,15 +628,33 @@ public class BatteryHistoryChart extends View {
|
|||||||
if (!mChargingPath.isEmpty()) {
|
if (!mChargingPath.isEmpty()) {
|
||||||
canvas.drawPath(mChargingPath, mChargingPaint);
|
canvas.drawPath(mChargingPath, mChargingPaint);
|
||||||
}
|
}
|
||||||
if (!mGpsOnPath.isEmpty()) {
|
if (mHaveGps) {
|
||||||
canvas.drawPath(mGpsOnPath, mGpsOnPaint);
|
if (!mGpsOnPath.isEmpty()) {
|
||||||
|
canvas.drawPath(mGpsOnPath, mGpsOnPaint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mHaveWifi) {
|
||||||
|
if (!mWifiRunningPath.isEmpty()) {
|
||||||
|
canvas.drawPath(mWifiRunningPath, mWifiRunningPaint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!mWakeLockPath.isEmpty()) {
|
||||||
|
canvas.drawPath(mWakeLockPath, mWakeLockPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mLargeMode) {
|
if (mLargeMode) {
|
||||||
canvas.drawText(mPhoneSignalLabel, 0,
|
canvas.drawText(mPhoneSignalLabel, 0,
|
||||||
height - mPhoneSignalOffset - mTextDescent, mTextPaint);
|
height - mPhoneSignalOffset - mTextDescent, mTextPaint);
|
||||||
canvas.drawText(mGpsOnLabel, 0,
|
if (mHaveGps) {
|
||||||
height - mGpsOnOffset - mTextDescent, mTextPaint);
|
canvas.drawText(mGpsOnLabel, 0,
|
||||||
|
height - mGpsOnOffset - mTextDescent, mTextPaint);
|
||||||
|
}
|
||||||
|
if (mHaveWifi) {
|
||||||
|
canvas.drawText(mWifiRunningLabel, 0,
|
||||||
|
height - mWifiRunningOffset - mTextDescent, mTextPaint);
|
||||||
|
}
|
||||||
|
canvas.drawText(mWakeLockLabel, 0,
|
||||||
|
height - mWakeLockOffset - mTextDescent, mTextPaint);
|
||||||
canvas.drawText(mChargingLabel, 0,
|
canvas.drawText(mChargingLabel, 0,
|
||||||
height - mChargingOffset - mTextDescent, mTextPaint);
|
height - mChargingOffset - mTextDescent, mTextPaint);
|
||||||
canvas.drawText(mScreenOnLabel, 0,
|
canvas.drawText(mScreenOnLabel, 0,
|
||||||
|
@@ -46,6 +46,7 @@ class BatterySipper implements Comparable<BatterySipper> {
|
|||||||
long cpuTime;
|
long cpuTime;
|
||||||
long gpsTime;
|
long gpsTime;
|
||||||
long cpuFgTime;
|
long cpuFgTime;
|
||||||
|
long wakeLockTime;
|
||||||
double percent;
|
double percent;
|
||||||
double noCoveragePercent;
|
double noCoveragePercent;
|
||||||
String defaultPackageName;
|
String defaultPackageName;
|
||||||
|
@@ -160,6 +160,7 @@ public class PowerUsageSummary extends PreferenceActivity implements Runnable {
|
|||||||
types = new int[] {
|
types = new int[] {
|
||||||
R.string.usage_type_cpu,
|
R.string.usage_type_cpu,
|
||||||
R.string.usage_type_cpu_foreground,
|
R.string.usage_type_cpu_foreground,
|
||||||
|
R.string.usage_type_wake_lock,
|
||||||
R.string.usage_type_gps,
|
R.string.usage_type_gps,
|
||||||
R.string.usage_type_data_send,
|
R.string.usage_type_data_send,
|
||||||
R.string.usage_type_data_recv,
|
R.string.usage_type_data_recv,
|
||||||
@@ -169,6 +170,7 @@ public class PowerUsageSummary extends PreferenceActivity implements Runnable {
|
|||||||
values = new double[] {
|
values = new double[] {
|
||||||
sipper.cpuTime,
|
sipper.cpuTime,
|
||||||
sipper.cpuFgTime,
|
sipper.cpuFgTime,
|
||||||
|
sipper.wakeLockTime,
|
||||||
sipper.gpsTime,
|
sipper.gpsTime,
|
||||||
uid != null? uid.getTcpBytesSent(mStatsType) : 0,
|
uid != null? uid.getTcpBytesSent(mStatsType) : 0,
|
||||||
uid != null? uid.getTcpBytesReceived(mStatsType) : 0,
|
uid != null? uid.getTcpBytesReceived(mStatsType) : 0,
|
||||||
@@ -340,6 +342,7 @@ public class PowerUsageSummary extends PreferenceActivity implements Runnable {
|
|||||||
Map<String, ? extends BatteryStats.Uid.Proc> processStats = u.getProcessStats();
|
Map<String, ? extends BatteryStats.Uid.Proc> processStats = u.getProcessStats();
|
||||||
long cpuTime = 0;
|
long cpuTime = 0;
|
||||||
long cpuFgTime = 0;
|
long cpuFgTime = 0;
|
||||||
|
long wakelockTime = 0;
|
||||||
long gpsTime = 0;
|
long gpsTime = 0;
|
||||||
if (processStats.size() > 0) {
|
if (processStats.size() > 0) {
|
||||||
// Process CPU time
|
// Process CPU time
|
||||||
@@ -384,6 +387,24 @@ public class PowerUsageSummary extends PreferenceActivity implements Runnable {
|
|||||||
}
|
}
|
||||||
power /= 1000;
|
power /= 1000;
|
||||||
|
|
||||||
|
// Process wake lock usage
|
||||||
|
Map<String, ? extends BatteryStats.Uid.Wakelock> wakelockStats = u.getWakelockStats();
|
||||||
|
for (Map.Entry<String, ? extends BatteryStats.Uid.Wakelock> wakelockEntry
|
||||||
|
: wakelockStats.entrySet()) {
|
||||||
|
Uid.Wakelock wakelock = wakelockEntry.getValue();
|
||||||
|
BatteryStats.Timer timer = wakelock.getWakeTime(BatteryStats.WAKE_TYPE_FULL);
|
||||||
|
if (timer != null) {
|
||||||
|
wakelockTime += timer.getTotalTimeLocked(uSecTime, which);
|
||||||
|
}
|
||||||
|
timer = wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL);
|
||||||
|
if (timer != null) {
|
||||||
|
wakelockTime += timer.getTotalTimeLocked(uSecTime, which);
|
||||||
|
}
|
||||||
|
// Note: not considering window, since that is just the system
|
||||||
|
// keeping the screen on while the app is running.
|
||||||
|
}
|
||||||
|
wakelockTime /= 1000; // convert to millis
|
||||||
|
|
||||||
// Add cost of data traffic
|
// Add cost of data traffic
|
||||||
power += (u.getTcpBytesReceived(mStatsType) + u.getTcpBytesSent(mStatsType))
|
power += (u.getTcpBytesReceived(mStatsType) + u.getTcpBytesSent(mStatsType))
|
||||||
* averageCostPerByte;
|
* averageCostPerByte;
|
||||||
@@ -424,6 +445,7 @@ public class PowerUsageSummary extends PreferenceActivity implements Runnable {
|
|||||||
app.cpuTime = cpuTime;
|
app.cpuTime = cpuTime;
|
||||||
app.gpsTime = gpsTime;
|
app.gpsTime = gpsTime;
|
||||||
app.cpuFgTime = cpuFgTime;
|
app.cpuFgTime = cpuFgTime;
|
||||||
|
app.wakeLockTime = wakelockTime;
|
||||||
mUsageList.add(app);
|
mUsageList.add(app);
|
||||||
}
|
}
|
||||||
if (power > mMaxPower) mMaxPower = power;
|
if (power > mMaxPower) mMaxPower = power;
|
||||||
|
Reference in New Issue
Block a user