From 56247a63fc621815ecff82a278ad8553174922a0 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Fri, 15 Mar 2013 18:21:12 -0700 Subject: [PATCH] battery history details: update status bars on any change Don't apply the "X axis (time) still within previous pixel" optimization to the status bars below the battery level graph. Keep the path cursor position and previous state variables up-to-date in this case. Bug: 8132455 Change-Id: I09390256e3e71d34813de655a1d01ec054ee778a --- .../fuelgauge/BatteryHistoryChart.java | 118 +++++++++--------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/com/android/settings/fuelgauge/BatteryHistoryChart.java b/src/com/android/settings/fuelgauge/BatteryHistoryChart.java index a22988882d2..51457891212 100644 --- a/src/com/android/settings/fuelgauge/BatteryHistoryChart.java +++ b/src/com/android/settings/fuelgauge/BatteryHistoryChart.java @@ -557,77 +557,77 @@ public class BatteryHistoryChart extends View { lastX = x; lastY = y; } + } - final boolean charging = - (rec.states&HistoryItem.STATE_BATTERY_PLUGGED_FLAG) != 0; - if (charging != lastCharging) { - if (charging) { - mChargingPath.moveTo(x, h-mChargingOffset); - } else { - mChargingPath.lineTo(x, h-mChargingOffset); - } - lastCharging = charging; + final boolean charging = + (rec.states&HistoryItem.STATE_BATTERY_PLUGGED_FLAG) != 0; + if (charging != lastCharging) { + if (charging) { + mChargingPath.moveTo(x, h-mChargingOffset); + } else { + mChargingPath.lineTo(x, h-mChargingOffset); } + lastCharging = charging; + } - final boolean screenOn = - (rec.states&HistoryItem.STATE_SCREEN_ON_FLAG) != 0; - if (screenOn != lastScreenOn) { - if (screenOn) { - mScreenOnPath.moveTo(x, h-mScreenOnOffset); - } else { - mScreenOnPath.lineTo(x, h-mScreenOnOffset); - } - lastScreenOn = screenOn; + final boolean screenOn = + (rec.states&HistoryItem.STATE_SCREEN_ON_FLAG) != 0; + if (screenOn != lastScreenOn) { + if (screenOn) { + mScreenOnPath.moveTo(x, h-mScreenOnOffset); + } else { + mScreenOnPath.lineTo(x, h-mScreenOnOffset); } + lastScreenOn = screenOn; + } - final boolean gpsOn = - (rec.states&HistoryItem.STATE_GPS_ON_FLAG) != 0; - if (gpsOn != lastGpsOn) { - if (gpsOn) { - mGpsOnPath.moveTo(x, h-mGpsOnOffset); - } else { - mGpsOnPath.lineTo(x, h-mGpsOnOffset); - } - lastGpsOn = gpsOn; + final boolean gpsOn = + (rec.states&HistoryItem.STATE_GPS_ON_FLAG) != 0; + if (gpsOn != lastGpsOn) { + if (gpsOn) { + mGpsOnPath.moveTo(x, h-mGpsOnOffset); + } else { + mGpsOnPath.lineTo(x, h-mGpsOnOffset); } + 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 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; + 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 && mHavePhoneSignal) { - int bin; - if (((rec.states&HistoryItem.STATE_PHONE_STATE_MASK) - >> HistoryItem.STATE_PHONE_STATE_SHIFT) - == ServiceState.STATE_POWER_OFF) { - bin = 0; - } else if ((rec.states&HistoryItem.STATE_PHONE_SCANNING_FLAG) != 0) { - bin = 1; - } else { - bin = (rec.states&HistoryItem.STATE_SIGNAL_STRENGTH_MASK) - >> HistoryItem.STATE_SIGNAL_STRENGTH_SHIFT; - bin += 2; - } - mPhoneSignalChart.addTick(x, bin); + if (mLargeMode && mHavePhoneSignal) { + int bin; + if (((rec.states&HistoryItem.STATE_PHONE_STATE_MASK) + >> HistoryItem.STATE_PHONE_STATE_SHIFT) + == ServiceState.STATE_POWER_OFF) { + bin = 0; + } else if ((rec.states&HistoryItem.STATE_PHONE_SCANNING_FLAG) != 0) { + bin = 1; + } else { + bin = (rec.states&HistoryItem.STATE_SIGNAL_STRENGTH_MASK) + >> HistoryItem.STATE_SIGNAL_STRENGTH_SHIFT; + bin += 2; } + mPhoneSignalChart.addTick(x, bin); } } else if (rec.cmd != BatteryStats.HistoryItem.CMD_OVERFLOW) {