Merge "CellInfo Parceling for Invalid Values" into nyc-dev
am: 5b45c62a1a
* commit '5b45c62a1a13801ed4c5fd228976928b30f63867':
CellInfo Parceling for Invalid Values
Change-Id: I7ecbb84a507197e33771c3c1afb172bd89fbd557
This commit is contained in:
@@ -145,7 +145,8 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
|||||||
int cdmaAsuLevel;
|
int cdmaAsuLevel;
|
||||||
int ecioAsuLevel;
|
int ecioAsuLevel;
|
||||||
|
|
||||||
if (cdmaDbm >= -75) cdmaAsuLevel = 16;
|
if (cdmaDbm == Integer.MAX_VALUE) cdmaAsuLevel = 99;
|
||||||
|
else if (cdmaDbm >= -75) cdmaAsuLevel = 16;
|
||||||
else if (cdmaDbm >= -82) cdmaAsuLevel = 8;
|
else if (cdmaDbm >= -82) cdmaAsuLevel = 8;
|
||||||
else if (cdmaDbm >= -90) cdmaAsuLevel = 4;
|
else if (cdmaDbm >= -90) cdmaAsuLevel = 4;
|
||||||
else if (cdmaDbm >= -95) cdmaAsuLevel = 2;
|
else if (cdmaDbm >= -95) cdmaAsuLevel = 2;
|
||||||
@@ -153,7 +154,8 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
|||||||
else cdmaAsuLevel = 99;
|
else cdmaAsuLevel = 99;
|
||||||
|
|
||||||
// Ec/Io are in dB*10
|
// Ec/Io are in dB*10
|
||||||
if (cdmaEcio >= -90) ecioAsuLevel = 16;
|
if (cdmaEcio == Integer.MAX_VALUE) ecioAsuLevel = 99;
|
||||||
|
else if (cdmaEcio >= -90) ecioAsuLevel = 16;
|
||||||
else if (cdmaEcio >= -100) ecioAsuLevel = 8;
|
else if (cdmaEcio >= -100) ecioAsuLevel = 8;
|
||||||
else if (cdmaEcio >= -115) ecioAsuLevel = 4;
|
else if (cdmaEcio >= -115) ecioAsuLevel = 4;
|
||||||
else if (cdmaEcio >= -130) ecioAsuLevel = 2;
|
else if (cdmaEcio >= -130) ecioAsuLevel = 2;
|
||||||
@@ -174,14 +176,16 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
|||||||
int levelDbm;
|
int levelDbm;
|
||||||
int levelEcio;
|
int levelEcio;
|
||||||
|
|
||||||
if (cdmaDbm >= -75) levelDbm = SIGNAL_STRENGTH_GREAT;
|
if (cdmaDbm == Integer.MAX_VALUE) levelDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||||
|
else if (cdmaDbm >= -75) levelDbm = SIGNAL_STRENGTH_GREAT;
|
||||||
else if (cdmaDbm >= -85) levelDbm = SIGNAL_STRENGTH_GOOD;
|
else if (cdmaDbm >= -85) levelDbm = SIGNAL_STRENGTH_GOOD;
|
||||||
else if (cdmaDbm >= -95) levelDbm = SIGNAL_STRENGTH_MODERATE;
|
else if (cdmaDbm >= -95) levelDbm = SIGNAL_STRENGTH_MODERATE;
|
||||||
else if (cdmaDbm >= -100) levelDbm = SIGNAL_STRENGTH_POOR;
|
else if (cdmaDbm >= -100) levelDbm = SIGNAL_STRENGTH_POOR;
|
||||||
else levelDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
else levelDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||||
|
|
||||||
// Ec/Io are in dB*10
|
// Ec/Io are in dB*10
|
||||||
if (cdmaEcio >= -90) levelEcio = SIGNAL_STRENGTH_GREAT;
|
if (cdmaEcio == Integer.MAX_VALUE) levelEcio = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||||
|
else if (cdmaEcio >= -90) levelEcio = SIGNAL_STRENGTH_GREAT;
|
||||||
else if (cdmaEcio >= -110) levelEcio = SIGNAL_STRENGTH_GOOD;
|
else if (cdmaEcio >= -110) levelEcio = SIGNAL_STRENGTH_GOOD;
|
||||||
else if (cdmaEcio >= -130) levelEcio = SIGNAL_STRENGTH_MODERATE;
|
else if (cdmaEcio >= -130) levelEcio = SIGNAL_STRENGTH_MODERATE;
|
||||||
else if (cdmaEcio >= -150) levelEcio = SIGNAL_STRENGTH_POOR;
|
else if (cdmaEcio >= -150) levelEcio = SIGNAL_STRENGTH_POOR;
|
||||||
@@ -201,13 +205,15 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
|||||||
int levelEvdoDbm;
|
int levelEvdoDbm;
|
||||||
int levelEvdoSnr;
|
int levelEvdoSnr;
|
||||||
|
|
||||||
if (evdoDbm >= -65) levelEvdoDbm = SIGNAL_STRENGTH_GREAT;
|
if (evdoDbm == Integer.MAX_VALUE) levelEvdoDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||||
|
else if (evdoDbm >= -65) levelEvdoDbm = SIGNAL_STRENGTH_GREAT;
|
||||||
else if (evdoDbm >= -75) levelEvdoDbm = SIGNAL_STRENGTH_GOOD;
|
else if (evdoDbm >= -75) levelEvdoDbm = SIGNAL_STRENGTH_GOOD;
|
||||||
else if (evdoDbm >= -90) levelEvdoDbm = SIGNAL_STRENGTH_MODERATE;
|
else if (evdoDbm >= -90) levelEvdoDbm = SIGNAL_STRENGTH_MODERATE;
|
||||||
else if (evdoDbm >= -105) levelEvdoDbm = SIGNAL_STRENGTH_POOR;
|
else if (evdoDbm >= -105) levelEvdoDbm = SIGNAL_STRENGTH_POOR;
|
||||||
else levelEvdoDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
else levelEvdoDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||||
|
|
||||||
if (evdoSnr >= 7) levelEvdoSnr = SIGNAL_STRENGTH_GREAT;
|
if (evdoSnr == Integer.MAX_VALUE) levelEvdoSnr = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||||
|
else if (evdoSnr >= 7) levelEvdoSnr = SIGNAL_STRENGTH_GREAT;
|
||||||
else if (evdoSnr >= 5) levelEvdoSnr = SIGNAL_STRENGTH_GOOD;
|
else if (evdoSnr >= 5) levelEvdoSnr = SIGNAL_STRENGTH_GOOD;
|
||||||
else if (evdoSnr >= 3) levelEvdoSnr = SIGNAL_STRENGTH_MODERATE;
|
else if (evdoSnr >= 3) levelEvdoSnr = SIGNAL_STRENGTH_MODERATE;
|
||||||
else if (evdoSnr >= 1) levelEvdoSnr = SIGNAL_STRENGTH_POOR;
|
else if (evdoSnr >= 1) levelEvdoSnr = SIGNAL_STRENGTH_POOR;
|
||||||
@@ -332,10 +338,11 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
|||||||
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
||||||
// Need to multiply CdmaDbm, CdmaEcio, EvdoDbm and EvdoEcio by -1
|
// Need to multiply CdmaDbm, CdmaEcio, EvdoDbm and EvdoEcio by -1
|
||||||
// to ensure consistency when reading values written here
|
// to ensure consistency when reading values written here
|
||||||
dest.writeInt(mCdmaDbm * -1);
|
// unless the value is invalid
|
||||||
dest.writeInt(mCdmaEcio * -1);
|
dest.writeInt(mCdmaDbm * (mCdmaDbm != Integer.MAX_VALUE ? -1 : 1));
|
||||||
dest.writeInt(mEvdoDbm * -1);
|
dest.writeInt(mCdmaEcio * (mCdmaEcio != Integer.MAX_VALUE ? -1 : 1));
|
||||||
dest.writeInt(mEvdoEcio * -1);
|
dest.writeInt(mEvdoDbm * (mEvdoDbm != Integer.MAX_VALUE ? -1 : 1));
|
||||||
|
dest.writeInt(mEvdoEcio * (mEvdoEcio != Integer.MAX_VALUE ? -1 : 1));
|
||||||
dest.writeInt(mEvdoSnr);
|
dest.writeInt(mEvdoSnr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,11 +353,15 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
|||||||
private CellSignalStrengthCdma(Parcel in) {
|
private CellSignalStrengthCdma(Parcel in) {
|
||||||
// CdmaDbm, CdmaEcio, EvdoDbm and EvdoEcio are written into
|
// CdmaDbm, CdmaEcio, EvdoDbm and EvdoEcio are written into
|
||||||
// the parcel as positive values.
|
// the parcel as positive values.
|
||||||
// Need to convert into negative values
|
// Need to convert into negative values unless the value is invalid
|
||||||
mCdmaDbm = in.readInt() * -1;
|
mCdmaDbm = in.readInt();
|
||||||
mCdmaEcio = in.readInt() * -1;
|
if (mCdmaDbm != Integer.MAX_VALUE) mCdmaDbm *= -1;
|
||||||
mEvdoDbm = in.readInt() * -1;
|
mCdmaEcio = in.readInt();
|
||||||
mEvdoEcio = in.readInt() * -1;
|
if (mCdmaEcio != Integer.MAX_VALUE) mCdmaEcio *= -1;
|
||||||
|
mEvdoDbm = in.readInt();
|
||||||
|
if (mEvdoDbm != Integer.MAX_VALUE) mEvdoDbm *= -1;
|
||||||
|
mEvdoEcio = in.readInt();
|
||||||
|
if (mEvdoEcio != Integer.MAX_VALUE) mEvdoEcio *= -1;
|
||||||
mEvdoSnr = in.readInt();
|
mEvdoSnr = in.readInt();
|
||||||
if (DBG) log("CellSignalStrengthCdma(Parcel): " + toString());
|
if (DBG) log("CellSignalStrengthCdma(Parcel): " + toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,7 +197,8 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
|
|||||||
public int getAsuLevel() {
|
public int getAsuLevel() {
|
||||||
int lteAsuLevel = 99;
|
int lteAsuLevel = 99;
|
||||||
int lteDbm = getDbm();
|
int lteDbm = getDbm();
|
||||||
if (lteDbm <= -140) lteAsuLevel = 0;
|
if (lteDbm == Integer.MAX_VALUE) lteAsuLevel = 99;
|
||||||
|
else if (lteDbm <= -140) lteAsuLevel = 0;
|
||||||
else if (lteDbm >= -43) lteAsuLevel = 97;
|
else if (lteDbm >= -43) lteAsuLevel = 97;
|
||||||
else lteAsuLevel = lteDbm + 140;
|
else lteAsuLevel = lteDbm + 140;
|
||||||
if (DBG) log("Lte Asu level: "+lteAsuLevel);
|
if (DBG) log("Lte Asu level: "+lteAsuLevel);
|
||||||
@@ -263,8 +264,9 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
|
|||||||
dest.writeInt(mSignalStrength);
|
dest.writeInt(mSignalStrength);
|
||||||
// Need to multiply rsrp and rsrq by -1
|
// Need to multiply rsrp and rsrq by -1
|
||||||
// to ensure consistency when reading values written here
|
// to ensure consistency when reading values written here
|
||||||
dest.writeInt(mRsrp * -1);
|
// unless the values are invalid
|
||||||
dest.writeInt(mRsrq * -1);
|
dest.writeInt(mRsrp * (mRsrp != Integer.MAX_VALUE ? -1 : 1));
|
||||||
|
dest.writeInt(mRsrq * (mRsrq != Integer.MAX_VALUE ? -1 : 1));
|
||||||
dest.writeInt(mRssnr);
|
dest.writeInt(mRssnr);
|
||||||
dest.writeInt(mCqi);
|
dest.writeInt(mCqi);
|
||||||
dest.writeInt(mTimingAdvance);
|
dest.writeInt(mTimingAdvance);
|
||||||
@@ -277,9 +279,11 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
|
|||||||
private CellSignalStrengthLte(Parcel in) {
|
private CellSignalStrengthLte(Parcel in) {
|
||||||
mSignalStrength = in.readInt();
|
mSignalStrength = in.readInt();
|
||||||
// rsrp and rsrq are written into the parcel as positive values.
|
// rsrp and rsrq are written into the parcel as positive values.
|
||||||
// Need to convert into negative values
|
// Need to convert into negative values unless the values are invalid
|
||||||
mRsrp = in.readInt() * -1;
|
mRsrp = in.readInt();
|
||||||
mRsrq = in.readInt() * -1;
|
if (mRsrp != Integer.MAX_VALUE) mRsrp *= -1;
|
||||||
|
mRsrq = in.readInt();
|
||||||
|
if (mRsrq != Integer.MAX_VALUE) mRsrq *= -1;
|
||||||
mRssnr = in.readInt();
|
mRssnr = in.readInt();
|
||||||
mCqi = in.readInt();
|
mCqi = in.readInt();
|
||||||
mTimingAdvance = in.readInt();
|
mTimingAdvance = in.readInt();
|
||||||
|
|||||||
Reference in New Issue
Block a user