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

Commit 30e51130 authored by Amit Mahajan's avatar Amit Mahajan Committed by Android (Google) Code Review
Browse files

Merge "Improve a calculation method for LTE antenna reception level" into lmp-mr1-dev

parents af0a6ad8 c962b1dc
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -31,4 +31,11 @@
        <item>"*611:+19085594899,BAE0000000000000"</item>
        <item>"*86:+1MDN,BAE0000000000000"</item>
    </string-array>

    <!-- Flag indicating whether strict threshold is used, or lenient threshold is used,
          when evaluating RSRP for LTE antenna bar display
           0. Strict threshold
           1. Lenient threshold
    -->
    <integer name="config_LTE_RSRP_threshold_type">0</integer>
</resources>
+7 −0
Original line number Diff line number Diff line
@@ -49,4 +49,11 @@
        <item>"*611:+19085594899,"</item>
        <item>"*86:+1MDN,"</item>
    </string-array>

    <!-- Flag indicating whether strict threshold is used, or lenient threshold is used,
          when evaluating RSRP for LTE antenna bar display
           0. Strict threshold
           1. Lenient threshold
    -->
    <integer name="config_LTE_RSRP_threshold_type">0</integer>
</resources>
+7 −0
Original line number Diff line number Diff line
@@ -1885,4 +1885,11 @@
    <bool name="config_switch_phone_on_voice_reg_state_change">true</bool>

    <bool name="config_sms_force_7bit_encoding">false</bool>

    <!-- Flag indicating whether strict threshold is used, or lenient threshold is used,
          when evaluating RSRP for LTE antenna bar display
           0. Strict threshold
           1. Lenient threshold
    -->
    <integer name="config_LTE_RSRP_threshold_type">1</integer>
</resources>
+3 −0
Original line number Diff line number Diff line
@@ -2094,4 +2094,7 @@
  <java-symbol type="layout" name="simple_account_item" />
  <java-symbol type="id" name="scrollIndicatorUp" />
  <java-symbol type="id" name="scrollIndicatorDown" />

  <!-- From SignalStrength -->
  <java-symbol type="integer" name="config_LTE_RSRP_threshold_type" />
</resources>
+22 −6
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.Rlog;
import android.content.res.Resources;

/**
 * Contains phone signal strength related information.
@@ -50,6 +51,11 @@ public class SignalStrength implements Parcelable {
    //Use int max, as -1 is a valid value in signal strength
    public static final int INVALID = 0x7FFFFFFF;

    private static final int RSRP_THRESH_TYPE_STRICT = 0;
    private static final int[] RSRP_THRESH_STRICT = new int[] {-140, -115, -105, -95, -85, -44};
    private static final int[] RSRP_THRESH_LENIENT = new int[] {-140, -128, -118, -108, -98, -44};


    private int mGsmSignalStrength; // Valid values are (0-31, 99) as defined in TS 27.007 8.5
    private int mGsmBitErrorRate;   // bit error rate (0-7, 99) as defined in TS 27.007 8.5
    private int mCdmaDbm;   // This value is the RSSI value
@@ -745,12 +751,21 @@ public class SignalStrength implements Parcelable {
         */
        int rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN, rsrpIconLevel = -1, snrIconLevel = -1;

        if (mLteRsrp > -44) rsrpIconLevel = -1;
        else if (mLteRsrp >= -85) rsrpIconLevel = SIGNAL_STRENGTH_GREAT;
        else if (mLteRsrp >= -95) rsrpIconLevel = SIGNAL_STRENGTH_GOOD;
        else if (mLteRsrp >= -105) rsrpIconLevel = SIGNAL_STRENGTH_MODERATE;
        else if (mLteRsrp >= -115) rsrpIconLevel = SIGNAL_STRENGTH_POOR;
        else if (mLteRsrp >= -140) rsrpIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
        int rsrpThreshType = Resources.getSystem().getInteger(com.android.internal.R.integer.
                config_LTE_RSRP_threshold_type);
        int[] threshRsrp;
        if (rsrpThreshType == RSRP_THRESH_TYPE_STRICT) {
            threshRsrp = RSRP_THRESH_STRICT;
        } else {
            threshRsrp = RSRP_THRESH_LENIENT;
        }

        if (mLteRsrp > threshRsrp[5]) rsrpIconLevel = -1;
        else if (mLteRsrp >= threshRsrp[4]) rsrpIconLevel = SIGNAL_STRENGTH_GREAT;
        else if (mLteRsrp >= threshRsrp[3]) rsrpIconLevel = SIGNAL_STRENGTH_GOOD;
        else if (mLteRsrp >= threshRsrp[2]) rsrpIconLevel = SIGNAL_STRENGTH_MODERATE;
        else if (mLteRsrp >= threshRsrp[1]) rsrpIconLevel = SIGNAL_STRENGTH_POOR;
        else if (mLteRsrp >= threshRsrp[0]) rsrpIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;

        /*
         * Values are -200 dB to +300 (SNR*10dB) RS_SNR >= 13.0 dB =>4 bars 4.5
@@ -789,6 +804,7 @@ public class SignalStrength implements Parcelable {
        else if (mLteSignalStrength >= 8) rssiIconLevel = SIGNAL_STRENGTH_GOOD;
        else if (mLteSignalStrength >= 5) rssiIconLevel = SIGNAL_STRENGTH_MODERATE;
        else if (mLteSignalStrength >= 0) rssiIconLevel = SIGNAL_STRENGTH_POOR;

        if (DBG) log("getLTELevel - rssi:" + mLteSignalStrength + " rssiIconLevel:"
                + rssiIconLevel);
        return rssiIconLevel;