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

Commit 540d78e7 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Steve Kondik
Browse files

Framework: Fix GSM signal strength

Certain OEM gsm ril libs send back a bogus value for LTE signal
that causes SignalStrength.java to default to LTE and report
incorrect signal values.
Use prop value ro.telephony.ril.config=signalstrength to get proper
GSM signal reading on certain devices.

Commit includes "telephony: hide needsOldRilFeature" from Chirayu Desai.

Change-Id: I9a0b68f6c3789218a4a20337496e6264996deab7
parent dd0ea8cc
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.telephony;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemProperties;
import android.telephony.Rlog;
import android.content.res.Resources;

@@ -495,6 +496,16 @@ public class SignalStrength implements Parcelable {
        return mLteCqi;
    }

    /** @hide */
    public boolean needsOldRilFeature(String feature) {
        String[] features = SystemProperties.get("ro.telephony.ril.config", "").split(",");
        for (String found: features) {
            if (found.equals(feature))
                return true;
        }
        return false;
    }

    /**
     * Get signal level as an int from 0..4
     *
@@ -504,8 +515,9 @@ public class SignalStrength implements Parcelable {
        int level = 0;

        if (isGsm) {
            boolean oldRil = needsOldRilFeature("signalstrength");
            level = getLteLevel();
            if (level == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
            if (level == SIGNAL_STRENGTH_NONE_OR_UNKNOWN || oldRil) {
                level = getTdScdmaLevel();
                if (level == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
                    level = getGsmLevel();
@@ -537,7 +549,8 @@ public class SignalStrength implements Parcelable {
    public int getAsuLevel() {
        int asuLevel = 0;
        if (isGsm) {
            if (getLteLevel() == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
            boolean oldRil = needsOldRilFeature("signalstrength");
            if (getLteLevel() == SIGNAL_STRENGTH_NONE_OR_UNKNOWN || oldRil) {
                if (getTdScdmaLevel() == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
                    asuLevel = getGsmAsuLevel();
                } else {
@@ -573,8 +586,9 @@ public class SignalStrength implements Parcelable {
        int dBm = INVALID;

        if(isGsm()) {
            boolean oldRil = needsOldRilFeature("signalstrength");
            dBm = getLteDbm();
            if (dBm == INVALID) {
            if (dBm == INVALID || oldRil) {
                if (getTdScdmaLevel() == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
                    dBm = getGsmDbm();
                } else {