diff options
author | Amith Yamasani <yamasani@google.com> | 2011-03-02 12:53:31 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-03-02 12:53:31 -0800 |
commit | 0c62c6449bf2c0954653b996a3bfb269a64c6562 (patch) | |
tree | 2e4d31f60828bd986ed3605ff320cc46ff53d300 /src/com/android/settings/fuelgauge | |
parent | 302b0572075e90ffe2004ca5999f3c3a3753189e (diff) | |
parent | 38d3353e37be450b1b95d2525acbd53e9b67130e (diff) | |
download | packages_apps_Settings-0c62c6449bf2c0954653b996a3bfb269a64c6562.tar.gz packages_apps_Settings-0c62c6449bf2c0954653b996a3bfb269a64c6562.tar.bz2 packages_apps_Settings-0c62c6449bf2c0954653b996a3bfb269a64c6562.zip |
am 38d3353e: am 03e90322: Merge "Remove more entries not relevant to wifi-only devices." into honeycomb
* commit '38d3353e37be450b1b95d2525acbd53e9b67130e':
Remove more entries not relevant to wifi-only devices.
Diffstat (limited to 'src/com/android/settings/fuelgauge')
-rw-r--r-- | src/com/android/settings/fuelgauge/BatteryHistoryChart.java | 33 | ||||
-rw-r--r-- | src/com/android/settings/fuelgauge/PowerUsageSummary.java | 5 |
2 files changed, 27 insertions, 11 deletions
diff --git a/src/com/android/settings/fuelgauge/BatteryHistoryChart.java b/src/com/android/settings/fuelgauge/BatteryHistoryChart.java index 23107da8f..97ebf43cc 100644 --- a/src/com/android/settings/fuelgauge/BatteryHistoryChart.java +++ b/src/com/android/settings/fuelgauge/BatteryHistoryChart.java @@ -173,6 +173,7 @@ public class BatteryHistoryChart extends View { int mBatHigh; boolean mHaveWifi; boolean mHaveGps; + boolean mHavePhoneSignal; public BatteryHistoryChart(Context context, AttributeSet attrs) { super(context, attrs); @@ -377,7 +378,9 @@ public class BatteryHistoryChart extends View { mNumHist = lastInteresting; mHaveGps = (aggrStates&HistoryItem.STATE_GPS_ON_FLAG) != 0; mHaveWifi = (aggrStates&HistoryItem.STATE_WIFI_RUNNING_FLAG) != 0; - + if (!com.android.settings.Utils.isWifiOnly()) { + mHavePhoneSignal = true; + } if (mHistEnd <= mHistStart) mHistEnd = mHistStart+1; mTotalDurationString = Utils.formatElapsedTime(getContext(), mHistEnd - mHistStart); } @@ -421,7 +424,9 @@ public class BatteryHistoryChart extends View { if (lastWakeLock) { mWakeLockPath.lineTo(w, h-mWakeLockOffset); } - mPhoneSignalChart.finish(w); + if (mHavePhoneSignal) { + mPhoneSignalChart.finish(w); + } } @Override @@ -467,15 +472,19 @@ public class BatteryHistoryChart extends View { mWifiRunningOffset = mWakeLockOffset + barOffset; mGpsOnOffset = mWifiRunningOffset + (mHaveWifi ? barOffset : 0); mPhoneSignalOffset = mGpsOnOffset + (mHaveGps ? barOffset : 0); - mLevelOffset = mPhoneSignalOffset + barOffset + mLineWidth; - mPhoneSignalChart.init(w); + mLevelOffset = mPhoneSignalOffset + (mHavePhoneSignal ? barOffset : 0) + mLineWidth; + if (mHavePhoneSignal) { + mPhoneSignalChart.init(w); + } } else { mScreenOnOffset = mGpsOnOffset = mWifiRunningOffset = mWakeLockOffset = mLineWidth; mChargingOffset = mLineWidth*2; mPhoneSignalOffset = 0; mLevelOffset = mLineWidth*3; - mPhoneSignalChart.init(0); + if (mHavePhoneSignal) { + mPhoneSignalChart.init(0); + } } mBatLevelPath.reset(); @@ -597,7 +606,7 @@ public class BatteryHistoryChart extends View { lastWakeLock = wakeLock; } - if (mLargeMode) { + if (mLargeMode && mHavePhoneSignal) { int bin; if (((rec.states&HistoryItem.STATE_PHONE_STATE_MASK) >> HistoryItem.STATE_PHONE_STATE_SHIFT) @@ -661,8 +670,10 @@ public class BatteryHistoryChart extends View { if (!mBatCriticalPath.isEmpty()) { canvas.drawPath(mBatCriticalPath, mBatteryCriticalPaint); } - int top = height-mPhoneSignalOffset - (mLineWidth/2); - mPhoneSignalChart.draw(canvas, top, mLineWidth); + int top = height - (mHavePhoneSignal ? mPhoneSignalOffset - (mLineWidth/2) : 0); + if (mHavePhoneSignal) { + mPhoneSignalChart.draw(canvas, top, mLineWidth); + } if (!mScreenOnPath.isEmpty()) { canvas.drawPath(mScreenOnPath, mScreenOnPaint); } @@ -684,8 +695,10 @@ public class BatteryHistoryChart extends View { } if (mLargeMode) { - canvas.drawText(mPhoneSignalLabel, 0, - height - mPhoneSignalOffset - mTextDescent, mTextPaint); + if (mHavePhoneSignal) { + canvas.drawText(mPhoneSignalLabel, 0, + height - mPhoneSignalOffset - mTextDescent, mTextPaint); + } if (mHaveGps) { canvas.drawText(mGpsOnLabel, 0, height - mGpsOnOffset - mTextDescent, mTextPaint); diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java index c5cba039c..fc903eb33 100644 --- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java +++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java @@ -684,7 +684,10 @@ public class PowerUsageSummary extends PreferenceFragment implements Runnable { addWiFiUsage(uSecNow); addBluetoothUsage(uSecNow); addIdleUsage(uSecNow); // Not including cellular idle power - addRadioUsage(uSecNow); + // Don't compute radio usage if it's a wifi-only device + if (!com.android.settings.Utils.isWifiOnly()) { + addRadioUsage(uSecNow); + } } private BatterySipper addEntry(String label, DrainType drainType, long time, int iconId, |