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

Commit d7650712 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "Framework: Fix GSM signal strength" into cm-10.1

parents 84f678ef 2552c8c4
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();