diff options
author | Jeff Brown <jeffbrown@google.com> | 2013-10-29 18:32:29 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-10-29 18:32:29 -0700 |
commit | aa2f9f01fa820ba93eaff8916b74cbc4a2bf0254 (patch) | |
tree | 4c4f4cf313ce2484d597dd52454f4a51acc20734 | |
parent | 319b7b044c513f0e8c41cae4c2cee00cf415c5a7 (diff) | |
parent | 81b7caf0d12fb56ab40592467d6b1cbcaef8f0b4 (diff) | |
download | frameworks_base-aa2f9f01fa820ba93eaff8916b74cbc4a2bf0254.zip frameworks_base-aa2f9f01fa820ba93eaff8916b74cbc4a2bf0254.tar.gz frameworks_base-aa2f9f01fa820ba93eaff8916b74cbc4a2bf0254.tar.bz2 |
am 81b7caf0: resolved conflicts for merge of 5214dae4 to klp-dev-plus-aosp
* commit '81b7caf0d12fb56ab40592467d6b1cbcaef8f0b4':
handle negative temperature
-rw-r--r-- | core/java/android/os/BatteryStats.java | 16 | ||||
-rw-r--r-- | core/java/com/android/internal/os/BatteryStatsImpl.java | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java index dbaa325..bc98a0b 100644 --- a/core/java/android/os/BatteryStats.java +++ b/core/java/android/os/BatteryStats.java @@ -450,7 +450,7 @@ public abstract class BatteryStats implements Parcelable { public byte batteryHealth; public byte batteryPlugType; - public char batteryTemperature; + public short batteryTemperature; public char batteryVoltage; // Constants from SCREEN_BRIGHTNESS_* @@ -527,7 +527,7 @@ public abstract class BatteryStats implements Parcelable { batteryHealth = (byte)((bat>>20)&0xf); batteryPlugType = (byte)((bat>>24)&0xf); bat = src.readInt(); - batteryTemperature = (char)(bat&0xffff); + batteryTemperature = (short)(bat&0xffff); batteryVoltage = (char)((bat>>16)&0xffff); states = src.readInt(); } @@ -596,7 +596,7 @@ public abstract class BatteryStats implements Parcelable { if (DEBUG) Slog.i(TAG, "WRITE DELTA: batteryToken=0x" + Integer.toHexString(batteryLevelInt) + " batteryLevel=" + batteryLevel - + " batteryTemp=" + (int)batteryTemperature + + " batteryTemp=" + batteryTemperature + " batteryVolt=" + (int)batteryVoltage); } if (stateIntChanged) { @@ -611,8 +611,8 @@ public abstract class BatteryStats implements Parcelable { } private int buildBatteryLevelInt() { - return ((((int)batteryLevel)<<24)&0xff000000) - | ((((int)batteryTemperature)<<14)&0x00ffc000) + return ((((int)batteryLevel)<<25)&0xfe000000) + | ((((int)batteryTemperature)<<14)&0x01ffc000) | (((int)batteryVoltage)&0x00003fff); } @@ -648,13 +648,13 @@ public abstract class BatteryStats implements Parcelable { if ((firstToken&DELTA_BATTERY_LEVEL_FLAG) != 0) { int batteryLevelInt = src.readInt(); - batteryLevel = (byte)((batteryLevelInt>>24)&0xff); - batteryTemperature = (char)((batteryLevelInt>>14)&0x3ff); + batteryLevel = (byte)((batteryLevelInt>>25)&0x7f); + batteryTemperature = (short)((batteryLevelInt<<7)>>21); batteryVoltage = (char)(batteryLevelInt&0x3fff); if (DEBUG) Slog.i(TAG, "READ DELTA: batteryToken=0x" + Integer.toHexString(batteryLevelInt) + " batteryLevel=" + batteryLevel - + " batteryTemp=" + (int)batteryTemperature + + " batteryTemp=" + batteryTemperature + " batteryVolt=" + (int)batteryVoltage); } diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index e0a154c..a3aee05 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -84,7 +84,7 @@ public final class BatteryStatsImpl extends BatteryStats { private static final int MAGIC = 0xBA757475; // 'BATSTATS' // Current on-disk Parcel version - private static final int VERSION = 66 + (USE_OLD_HISTORY ? 1000 : 0); + private static final int VERSION = 67 + (USE_OLD_HISTORY ? 1000 : 0); // Maximum number of items we will record in the history. private static final int MAX_HISTORY_ITEMS = 2000; @@ -4721,7 +4721,7 @@ public final class BatteryStatsImpl extends BatteryStats { mHistoryCur.batteryStatus = (byte)status; mHistoryCur.batteryHealth = (byte)health; mHistoryCur.batteryPlugType = (byte)plugType; - mHistoryCur.batteryTemperature = (char)temp; + mHistoryCur.batteryTemperature = (short)temp; mHistoryCur.batteryVoltage = (char)volt; setOnBatteryLocked(onBattery, oldStatus, level); } else { @@ -4744,7 +4744,7 @@ public final class BatteryStatsImpl extends BatteryStats { } if (temp >= (mHistoryCur.batteryTemperature+10) || temp <= (mHistoryCur.batteryTemperature-10)) { - mHistoryCur.batteryTemperature = (char)temp; + mHistoryCur.batteryTemperature = (short)temp; changed = true; } if (volt > (mHistoryCur.batteryVoltage+20) |