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

Commit 330d8084 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge changes from topic "tdscdma-rscp" am: 891f195a am: 6384b940 am: 2c383dce"

parents 60a8eb44 45eb0c64
Loading
Loading
Loading
Loading
+29 −12
Original line number Diff line number Diff line
@@ -34,14 +34,14 @@ public final class CellSignalStrengthTdscdma extends CellSignalStrength implemen
    private static final String LOG_TAG = "CellSignalStrengthTdscdma";
    private static final boolean DBG = false;

    private static final int TDSCDMA_RSSI_MAX = -51;
    private static final int TDSCDMA_RSSI_GREAT = -77;
    private static final int TDSCDMA_RSSI_GOOD = -87;
    private static final int TDSCDMA_RSSI_MODERATE = -97;
    private static final int TDSCDMA_RSSI_POOR = -107;

    private static final int TDSCDMA_RSCP_MIN = -120;
    // These levels are arbitrary but carried over from SignalStrength.java for consistency.
    private static final int TDSCDMA_RSCP_MAX = -24;
    private static final int TDSCDMA_RSCP_GREAT = -49;
    private static final int TDSCDMA_RSCP_GOOD = -73;
    private static final int TDSCDMA_RSCP_MODERATE = -97;
    private static final int TDSCDMA_RSCP_POOR = -110;
    private static final int TDSCDMA_RSCP_MIN = -120;


    private int mRssi; // in dBm [-113, -51], CellInfo.UNAVAILABLE

@@ -135,11 +135,11 @@ public final class CellSignalStrengthTdscdma extends CellSignalStrength implemen
    /** @hide */
    @Override
    public void updateLevel(PersistableBundle cc, ServiceState ss) {
        if (mRssi > TDSCDMA_RSSI_MAX) mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
        else if (mRssi >= TDSCDMA_RSSI_GREAT) mLevel = SIGNAL_STRENGTH_GREAT;
        else if (mRssi >= TDSCDMA_RSSI_GOOD)  mLevel = SIGNAL_STRENGTH_GOOD;
        else if (mRssi >= TDSCDMA_RSSI_MODERATE)  mLevel = SIGNAL_STRENGTH_MODERATE;
        else if (mRssi >= TDSCDMA_RSSI_POOR) mLevel = SIGNAL_STRENGTH_POOR;
        if (mRscp > TDSCDMA_RSCP_MAX) mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
        else if (mRscp >= TDSCDMA_RSCP_GREAT) mLevel = SIGNAL_STRENGTH_GREAT;
        else if (mRscp >= TDSCDMA_RSCP_GOOD)  mLevel = SIGNAL_STRENGTH_GOOD;
        else if (mRscp >= TDSCDMA_RSCP_MODERATE)  mLevel = SIGNAL_STRENGTH_MODERATE;
        else if (mRscp >= TDSCDMA_RSCP_POOR) mLevel = SIGNAL_STRENGTH_POOR;
        else mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
    }

@@ -158,6 +158,23 @@ public final class CellSignalStrengthTdscdma extends CellSignalStrength implemen
        return mRscp;
    }

    /**
     * Get the RSSI as dBm value -113..-51dBm or {@link CellInfo#UNAVAILABLE UNAVAILABLE}.
     *
     * @hide
     */
    public int getRssi() {
        return mRssi;
    }

    /**
     * Get the BER as an ASU value 0..7, 99, or {@link CellInfo#UNAVAILABLE UNAVAILABLE}.
     * @hide
     */
    public int getBitErrorRate() {
        return mBitErrorRate;
    }

    /**
     * Get the RSCP in ASU.
     *
+4 −4
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements
    public static final String LEVEL_CALCULATION_METHOD_RSCP = "rscp";

    // Default to RSSI for backwards compatibility with older devices
    private static final String sLevelCalculationMethod = LEVEL_CALCULATION_METHOD_RSSI;
    private static final String DEFAULT_LEVEL_CALCULATION_METHOD = LEVEL_CALCULATION_METHOD_RSSI;

    private int mRssi; // in dBm [-113, 51] or CellInfo.UNAVAILABLE if unknown
    private int mBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5 or
@@ -161,14 +161,14 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements
        int[] rscpThresholds;

        if (cc == null) {
            calcMethod = sLevelCalculationMethod;
            calcMethod = DEFAULT_LEVEL_CALCULATION_METHOD;
            rscpThresholds = sRscpThresholds;
        } else {
            // TODO: abstract this entire thing into a series of functions
            calcMethod = cc.getString(
                    CarrierConfigManager.KEY_WCDMA_DEFAULT_SIGNAL_STRENGTH_MEASUREMENT_STRING,
                    sLevelCalculationMethod);
            if (TextUtils.isEmpty(calcMethod)) calcMethod = sLevelCalculationMethod;
                    DEFAULT_LEVEL_CALCULATION_METHOD);
            if (TextUtils.isEmpty(calcMethod)) calcMethod = DEFAULT_LEVEL_CALCULATION_METHOD;
            rscpThresholds = cc.getIntArray(
                    CarrierConfigManager.KEY_WCDMA_RSCP_THRESHOLDS_INT_ARRAY);
            if (rscpThresholds == null || rscpThresholds.length != NUM_SIGNAL_STRENGTH_THRESHOLDS) {