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
This commit is contained in:
@@ -557,77 +557,77 @@ public class BatteryHistoryChart extends View {
|
|||||||
lastX = x;
|
lastX = x;
|
||||||
lastY = y;
|
lastY = y;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final boolean charging =
|
final boolean charging =
|
||||||
(rec.states&HistoryItem.STATE_BATTERY_PLUGGED_FLAG) != 0;
|
(rec.states&HistoryItem.STATE_BATTERY_PLUGGED_FLAG) != 0;
|
||||||
if (charging != lastCharging) {
|
if (charging != lastCharging) {
|
||||||
if (charging) {
|
if (charging) {
|
||||||
mChargingPath.moveTo(x, h-mChargingOffset);
|
mChargingPath.moveTo(x, h-mChargingOffset);
|
||||||
} else {
|
} else {
|
||||||
mChargingPath.lineTo(x, h-mChargingOffset);
|
mChargingPath.lineTo(x, h-mChargingOffset);
|
||||||
}
|
|
||||||
lastCharging = charging;
|
|
||||||
}
|
}
|
||||||
|
lastCharging = charging;
|
||||||
|
}
|
||||||
|
|
||||||
final boolean screenOn =
|
final boolean screenOn =
|
||||||
(rec.states&HistoryItem.STATE_SCREEN_ON_FLAG) != 0;
|
(rec.states&HistoryItem.STATE_SCREEN_ON_FLAG) != 0;
|
||||||
if (screenOn != lastScreenOn) {
|
if (screenOn != lastScreenOn) {
|
||||||
if (screenOn) {
|
if (screenOn) {
|
||||||
mScreenOnPath.moveTo(x, h-mScreenOnOffset);
|
mScreenOnPath.moveTo(x, h-mScreenOnOffset);
|
||||||
} else {
|
} else {
|
||||||
mScreenOnPath.lineTo(x, h-mScreenOnOffset);
|
mScreenOnPath.lineTo(x, h-mScreenOnOffset);
|
||||||
}
|
|
||||||
lastScreenOn = screenOn;
|
|
||||||
}
|
}
|
||||||
|
lastScreenOn = screenOn;
|
||||||
|
}
|
||||||
|
|
||||||
final boolean gpsOn =
|
final boolean gpsOn =
|
||||||
(rec.states&HistoryItem.STATE_GPS_ON_FLAG) != 0;
|
(rec.states&HistoryItem.STATE_GPS_ON_FLAG) != 0;
|
||||||
if (gpsOn != lastGpsOn) {
|
if (gpsOn != lastGpsOn) {
|
||||||
if (gpsOn) {
|
if (gpsOn) {
|
||||||
mGpsOnPath.moveTo(x, h-mGpsOnOffset);
|
mGpsOnPath.moveTo(x, h-mGpsOnOffset);
|
||||||
} else {
|
} else {
|
||||||
mGpsOnPath.lineTo(x, h-mGpsOnOffset);
|
mGpsOnPath.lineTo(x, h-mGpsOnOffset);
|
||||||
}
|
|
||||||
lastGpsOn = gpsOn;
|
|
||||||
}
|
}
|
||||||
|
lastGpsOn = gpsOn;
|
||||||
|
}
|
||||||
|
|
||||||
final boolean wifiRunning =
|
final boolean wifiRunning =
|
||||||
(rec.states&HistoryItem.STATE_WIFI_RUNNING_FLAG) != 0;
|
(rec.states&HistoryItem.STATE_WIFI_RUNNING_FLAG) != 0;
|
||||||
if (wifiRunning != lastWifiRunning) {
|
if (wifiRunning != lastWifiRunning) {
|
||||||
if (wifiRunning) {
|
if (wifiRunning) {
|
||||||
mWifiRunningPath.moveTo(x, h-mWifiRunningOffset);
|
mWifiRunningPath.moveTo(x, h-mWifiRunningOffset);
|
||||||
} else {
|
} else {
|
||||||
mWifiRunningPath.lineTo(x, h-mWifiRunningOffset);
|
mWifiRunningPath.lineTo(x, h-mWifiRunningOffset);
|
||||||
}
|
|
||||||
lastWifiRunning = wifiRunning;
|
|
||||||
}
|
}
|
||||||
|
lastWifiRunning = wifiRunning;
|
||||||
|
}
|
||||||
|
|
||||||
final boolean wakeLock =
|
final boolean wakeLock =
|
||||||
(rec.states&HistoryItem.STATE_WAKE_LOCK_FLAG) != 0;
|
(rec.states&HistoryItem.STATE_WAKE_LOCK_FLAG) != 0;
|
||||||
if (wakeLock != lastWakeLock) {
|
if (wakeLock != lastWakeLock) {
|
||||||
if (wakeLock) {
|
if (wakeLock) {
|
||||||
mWakeLockPath.moveTo(x, h-mWakeLockOffset);
|
mWakeLockPath.moveTo(x, h-mWakeLockOffset);
|
||||||
} else {
|
} else {
|
||||||
mWakeLockPath.lineTo(x, h-mWakeLockOffset);
|
mWakeLockPath.lineTo(x, h-mWakeLockOffset);
|
||||||
}
|
|
||||||
lastWakeLock = wakeLock;
|
|
||||||
}
|
}
|
||||||
|
lastWakeLock = wakeLock;
|
||||||
|
}
|
||||||
|
|
||||||
if (mLargeMode && mHavePhoneSignal) {
|
if (mLargeMode && mHavePhoneSignal) {
|
||||||
int bin;
|
int bin;
|
||||||
if (((rec.states&HistoryItem.STATE_PHONE_STATE_MASK)
|
if (((rec.states&HistoryItem.STATE_PHONE_STATE_MASK)
|
||||||
>> HistoryItem.STATE_PHONE_STATE_SHIFT)
|
>> HistoryItem.STATE_PHONE_STATE_SHIFT)
|
||||||
== ServiceState.STATE_POWER_OFF) {
|
== ServiceState.STATE_POWER_OFF) {
|
||||||
bin = 0;
|
bin = 0;
|
||||||
} else if ((rec.states&HistoryItem.STATE_PHONE_SCANNING_FLAG) != 0) {
|
} else if ((rec.states&HistoryItem.STATE_PHONE_SCANNING_FLAG) != 0) {
|
||||||
bin = 1;
|
bin = 1;
|
||||||
} else {
|
} else {
|
||||||
bin = (rec.states&HistoryItem.STATE_SIGNAL_STRENGTH_MASK)
|
bin = (rec.states&HistoryItem.STATE_SIGNAL_STRENGTH_MASK)
|
||||||
>> HistoryItem.STATE_SIGNAL_STRENGTH_SHIFT;
|
>> HistoryItem.STATE_SIGNAL_STRENGTH_SHIFT;
|
||||||
bin += 2;
|
bin += 2;
|
||||||
}
|
|
||||||
mPhoneSignalChart.addTick(x, bin);
|
|
||||||
}
|
}
|
||||||
|
mPhoneSignalChart.addTick(x, bin);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (rec.cmd != BatteryStats.HistoryItem.CMD_OVERFLOW) {
|
} else if (rec.cmd != BatteryStats.HistoryItem.CMD_OVERFLOW) {
|
||||||
|
Reference in New Issue
Block a user