summaryrefslogtreecommitdiffstats
path: root/core/java/android/os/BatteryStats.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-03-04 13:28:36 -0800
committerDianne Hackborn <hackbod@google.com>2015-03-04 13:28:36 -0800
commit8cfb58bd58746127d1a8aa39e34a94f7948738d8 (patch)
treefc2108fafaf2c9da8be918a54e7c04c10e73975a /core/java/android/os/BatteryStats.java
parent56b8e8da2bee11a690e09e35f21ac070c6f9b6de (diff)
downloadframeworks_base-8cfb58bd58746127d1a8aa39e34a94f7948738d8.zip
frameworks_base-8cfb58bd58746127d1a8aa39e34a94f7948738d8.tar.gz
frameworks_base-8cfb58bd58746127d1a8aa39e34a94f7948738d8.tar.bz2
Fix reading of daily data.
Change-Id: I1f581197c938109cfe5cc21109eea57b4e0434dc
Diffstat (limited to 'core/java/android/os/BatteryStats.java')
-rw-r--r--core/java/android/os/BatteryStats.java33
1 files changed, 22 insertions, 11 deletions
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 43d3a71..0fee4b3 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -635,24 +635,34 @@ public abstract class BatteryStats implements Parcelable {
while (i < N && (c=value.charAt(i)) != '-') {
i++;
switch (c) {
- case 'f': out |= ((Display.STATE_OFF-1)<<STEP_LEVEL_INITIAL_MODE_SHIFT); break;
- case 'o': out |= ((Display.STATE_ON-1)<<STEP_LEVEL_INITIAL_MODE_SHIFT); break;
- case 'd': out |= ((Display.STATE_DOZE-1)<<STEP_LEVEL_INITIAL_MODE_SHIFT); break;
- case 'z': out |= ((Display.STATE_DOZE_SUSPEND-1)<<STEP_LEVEL_INITIAL_MODE_SHIFT);
+ case 'f': out |= (((long)Display.STATE_OFF-1)<<STEP_LEVEL_INITIAL_MODE_SHIFT);
break;
- case 'p': out |= (STEP_LEVEL_MODE_POWER_SAVE<<STEP_LEVEL_INITIAL_MODE_SHIFT);
+ case 'o': out |= (((long)Display.STATE_ON-1)<<STEP_LEVEL_INITIAL_MODE_SHIFT);
break;
- case 'F': out |= ((Display.STATE_OFF-1)<<STEP_LEVEL_MODIFIED_MODE_SHIFT); break;
- case 'O': out |= ((Display.STATE_ON-1)<<STEP_LEVEL_MODIFIED_MODE_SHIFT); break;
- case 'D': out |= ((Display.STATE_DOZE-1)<<STEP_LEVEL_MODIFIED_MODE_SHIFT); break;
- case 'Z': out |= ((Display.STATE_DOZE_SUSPEND-1)<<STEP_LEVEL_MODIFIED_MODE_SHIFT);
+ case 'd': out |= (((long)Display.STATE_DOZE-1)<<STEP_LEVEL_INITIAL_MODE_SHIFT);
break;
- case 'P': out |= (STEP_LEVEL_MODE_POWER_SAVE<<STEP_LEVEL_MODIFIED_MODE_SHIFT);
+ case 'z': out |= (((long)Display.STATE_DOZE_SUSPEND-1)
+ << STEP_LEVEL_INITIAL_MODE_SHIFT);
+ break;
+ case 'p': out |= (((long)STEP_LEVEL_MODE_POWER_SAVE)
+ << STEP_LEVEL_INITIAL_MODE_SHIFT);
+ break;
+ case 'F': out |= (((long)Display.STATE_OFF-1)<<STEP_LEVEL_MODIFIED_MODE_SHIFT);
+ break;
+ case 'O': out |= (((long)Display.STATE_ON-1)<<STEP_LEVEL_MODIFIED_MODE_SHIFT);
+ break;
+ case 'D': out |= (((long)Display.STATE_DOZE-1)<<STEP_LEVEL_MODIFIED_MODE_SHIFT);
+ break;
+ case 'Z': out |= (((long)Display.STATE_DOZE_SUSPEND-1)
+ << STEP_LEVEL_MODIFIED_MODE_SHIFT);
+ break;
+ case 'P': out |= (((long)STEP_LEVEL_MODE_POWER_SAVE)
+ << STEP_LEVEL_MODIFIED_MODE_SHIFT);
break;
}
}
i++;
- int level = 0;
+ long level = 0;
while (i < N && (c=value.charAt(i)) != '-') {
i++;
level <<= 4;
@@ -664,6 +674,7 @@ public abstract class BatteryStats implements Parcelable {
level += c - 'A' + 10;
}
}
+ i++;
out |= (level << STEP_LEVEL_LEVEL_SHIFT) & STEP_LEVEL_LEVEL_MASK;
long duration = 0;
while (i < N && (c=value.charAt(i)) != '-') {