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

Commit 87162ecf authored by Nathan Harold's avatar Nathan Harold
Browse files

Update HAL1.0 Tdscmda SignalStrength Conversion

Reset the TD-SCDMA signal strength range from 25..120
to use the HAL1.2 values of 0..96.

Bug: 74202653
Test: runtest frameworks-telephony
Merged-In: I0c8ef8b83bb27b9f95331177ea9e3301a01bb99c
Change-Id: I0c8ef8b83bb27b9f95331177ea9e3301a01bb99c
(cherry picked from commit d4594e4f)
parent 85fae19c
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -5277,6 +5277,15 @@ public class RIL extends BaseCommands implements CommandsInterface {

    static SignalStrength convertHalSignalStrength(
            android.hardware.radio.V1_0.SignalStrength signalStrength) {
        int tdscdmaRscp_1_2 = 255; // 255 is the value for unknown/unreported ASU.
        // The HAL 1.0 range is 25..120; the ASU/ HAL 1.2 range is 0..96;
        // yes, this means the range in 1.0 cannot express -24dBm = 96
        if (signalStrength.tdScdma.rscp >= 25 && signalStrength.tdScdma.rscp <= 120) {
            // First we flip the sign to convert from the HALs -rscp to the actual RSCP value.
            int rscpDbm = -signalStrength.tdScdma.rscp;
            // Then to convert from RSCP to ASU, we apply the offset which aligns 0 ASU to -120dBm.
            tdscdmaRscp_1_2 = rscpDbm + 120;
        }
        return new SignalStrength(
                signalStrength.gw.signalStrength,
                signalStrength.gw.bitErrorRate,
@@ -5290,7 +5299,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                signalStrength.lte.rsrq,
                signalStrength.lte.rssnr,
                signalStrength.lte.cqi,
                signalStrength.tdScdma.rscp);
                tdscdmaRscp_1_2);
    }

    static SignalStrength convertHalSignalStrength_1_2(