Permalink
Browse files

Telephony: 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
  • Loading branch information...
rmcc authored and xlxfoxxlx committed Nov 4, 2013
1 parent 0eb59a5 commit e3b6c01e3fd0ca3d9ae2d0f28201d58ba780d28e
Showing with 17 additions and 3 deletions.
  1. +17 −3 telephony/java/android/telephony/SignalStrength.java
@@ -19,6 +19,7 @@
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;
@@ -499,6 +500,16 @@ public int getLteCqi() {
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;
}
/**
* Retrieve an abstract level value for the overall signal strength.
*
@@ -511,8 +522,9 @@ public int getLevel() {
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();
@@ -544,7 +556,8 @@ public int getLevel() {
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 {
@@ -580,8 +593,9 @@ public int getDbm() {
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 {

0 comments on commit e3b6c01

Please sign in to comment.