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

Commit 2552c8c4 authored by dhacker29's avatar dhacker29 Committed by Gerrit Code Review
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.v3=signalstrength to get proper
GSM signal reading on certain devices.

Change-Id: Ibb23d7b3a2d21001ccbbc6ebfbdc3c5248f18cfc
Signed-off-by: default avatardhacker29 <davidhackerdvm@gmail.com>
parent 95a2ec80
Loading
Loading
Loading
Loading
+16 −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.util.Log;

/**
@@ -435,6 +436,15 @@ public class SignalStrength implements Parcelable {
        return mLteCqi;
    }

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

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

        if (isGsm) {
            boolean oldRil = needsOldRilFeature("signalstrength");
            level = getLteLevel();
            if (level == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
            if (level == SIGNAL_STRENGTH_NONE_OR_UNKNOWN || oldRil) {
                level = getGsmLevel();
            }
        } else {
@@ -474,7 +485,8 @@ public class SignalStrength implements Parcelable {
    public int getAsuLevel() {
        int asuLevel;
        if (isGsm) {
            if (getLteLevel() == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
            boolean oldRil = needsOldRilFeature("signalstrength");
            if (getLteLevel() == SIGNAL_STRENGTH_NONE_OR_UNKNOWN || oldRil) {
                asuLevel = getGsmAsuLevel();
            } else {
                asuLevel = getLteAsuLevel();
@@ -506,7 +518,8 @@ public class SignalStrength implements Parcelable {
        int dBm;

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