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

Commit 547fad8d authored by Zhanghao's avatar Zhanghao Committed by Zhanghao Wen
Browse files

Add an additional bit for the GPS signal level

The extra state indicating GPS is turned off.
 -00: poor signal level
 -01: good signal level
 -10: none (no signal)
This change is designed to work with cl/529249005 to fix the misleading
information in Battery Historian GPS signal quality UI bar

Test: Battery Historian UI
Bug: 259729405
Change-Id: I9db7035156c82c8cf0570b6349336aec1b253bce
parent f991b371
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1966,7 +1966,7 @@ public abstract class BatteryStats {
        // Values for NUM_GPS_SIGNAL_QUALITY_LEVELS
        public static final int STATE2_GPS_SIGNAL_QUALITY_SHIFT = 7;
        public static final int STATE2_GPS_SIGNAL_QUALITY_MASK =
            0x1 << STATE2_GPS_SIGNAL_QUALITY_SHIFT;
                0x3 << STATE2_GPS_SIGNAL_QUALITY_SHIFT;

        public static final int STATE2_POWER_SAVE_FLAG = 1<<31;
        public static final int STATE2_VIDEO_ON_FLAG = 1<<30;
@@ -3028,7 +3028,7 @@ public abstract class BatteryStats {
                "cellular_high_tx_power", "Chtp"),
        new BitDescription(HistoryItem.STATE2_GPS_SIGNAL_QUALITY_MASK,
            HistoryItem.STATE2_GPS_SIGNAL_QUALITY_SHIFT, "gps_signal_quality", "Gss",
            new String[] { "poor", "good"}, new String[] { "poor", "good"})
            new String[] { "poor", "good", "none"}, new String[] { "poor", "good", "none"})
    };

    public static final String[] HISTORY_EVENT_NAMES = new String[] {
+2 −1
Original line number Diff line number Diff line
@@ -1542,7 +1542,7 @@ public class BatteryStatsHistory {

        State2 change int: if C in the first token is set,
        31              23              15               7             0
        █M|L|K|J|I|H|H|G█F|E|D|C| | | | █ | | | | | | ||B|B|B|A|A|A|A█
        █M|L|K|J|I|H|H|G█F|E|D|C| | | | █ | | | | | | |N█N|B|B|B|A|A|A|A█

        A: 4 bits indicating the wifi supplicant state: {@link BatteryStats#WIFI_SUPPL_STATE_NAMES}.
        B: 3 bits indicating the wifi signal strength: 0, 1, 2, 3, 4.
@@ -1557,6 +1557,7 @@ public class BatteryStatsHistory {
        K: wifi was running.
        L: video was playing.
        M: power save mode was on.
        N: 2 bits indicating the gps signal strength: poor, good, none.

        Wakelock/wakereason struct: if D in the first token is set,
        Event struct: if E in the first token is set,
+3 −0
Original line number Diff line number Diff line
@@ -1032,6 +1032,7 @@ public class BatteryStatsImpl extends BatteryStats {
    private static final int USB_DATA_CONNECTED = 2;
    int mUsbDataState = USB_DATA_UNKNOWN;
    private static final int GPS_SIGNAL_QUALITY_NONE = 2;
    int mGpsSignalQualityBin = -1;
    final StopwatchTimer[] mGpsSignalQualityTimer =
        new StopwatchTimer[GnssSignalQuality.NUM_GNSS_SIGNAL_QUALITY_LEVELS];
@@ -5204,6 +5205,8 @@ public class BatteryStatsImpl extends BatteryStats {
        if (mGpsNesting == 0) {
            mHistory.recordStateStopEvent(elapsedRealtimeMs, uptimeMs,
                    HistoryItem.STATE_GPS_ON_FLAG);
            mHistory.recordGpsSignalQualityEvent(elapsedRealtimeMs, uptimeMs,
                    GPS_SIGNAL_QUALITY_NONE);
            stopAllGpsSignalQualityTimersLocked(-1, elapsedRealtimeMs);
            mGpsSignalQualityBin = -1;
        }