Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5214dae4 authored by Jeff Brown's avatar Jeff Brown Committed by Android Git Automerger
Browse files

am 6dbbba4e: Merge "handle negative temperature"

* commit '6dbbba4e':
  handle negative temperature
parents 8f592378 6dbbba4e
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -444,7 +444,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_*
@@ -521,7 +521,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();
        }
@@ -590,7 +590,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) {
@@ -605,8 +605,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);
        }
        
@@ -642,13 +642,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);
            }
            
+3 −3
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ public final class BatteryStatsImpl extends BatteryStats {
    private static final int MAGIC = 0xBA757475; // 'BATSTATS'

    // Current on-disk Parcel version
    private static final int VERSION = 64 + (USE_OLD_HISTORY ? 1000 : 0);
    private static final int VERSION = 65 + (USE_OLD_HISTORY ? 1000 : 0);

    // Maximum number of items we will record in the history.
    private static final int MAX_HISTORY_ITEMS = 2000;
@@ -4611,7 +4611,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 {
@@ -4634,7 +4634,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)