From 95500f8a0f0ff501653d507916f98fc36cefdcc8 Mon Sep 17 00:00:00 2001 From: Nathan Harold Date: Mon, 26 Feb 2018 19:08:23 -0800 Subject: [PATCH] Fix CDMA Range Checks for SignalStrength -Allow zero as a valid value for CDMA ECIO. Zero is allowed for EVDO ECIO and is equally valid for CDMA. Making them consistent by allowing zero here. -Set EVDO ECIO to -160 if unreported rather than setting it to -1. The "unreported" value is undocumented, and since -1 is well within the range of valid values, makes no sense. Since CDMA ECIO was setting an unreported value to a very low number, again making them the same. -Allow 0 for EVDO SNR. This value has a range that is documented both in the RIL and in SignalStrength to include zero, but we were previously disallowing 0. Making the range check inclusive in line with the existing documentation, which was self-consistent. Bug: 32364031 Test: runtest frameworks-telephony Change-Id: Ie0ca5abb4998d1b0b5abdbff9d51f364fe6db858 --- telephony/java/android/telephony/SignalStrength.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java index fc2ef2782b788..ccb550ee18973 100644 --- a/telephony/java/android/telephony/SignalStrength.java +++ b/telephony/java/android/telephony/SignalStrength.java @@ -311,11 +311,11 @@ public class SignalStrength implements Parcelable { // BER no change; mCdmaDbm = mCdmaDbm > 0 ? -mCdmaDbm : -120; - mCdmaEcio = (mCdmaEcio > 0) ? -mCdmaEcio : -160; + mCdmaEcio = (mCdmaEcio >= 0) ? -mCdmaEcio : -160; mEvdoDbm = (mEvdoDbm > 0) ? -mEvdoDbm : -120; - mEvdoEcio = (mEvdoEcio >= 0) ? -mEvdoEcio : -1; - mEvdoSnr = ((mEvdoSnr > 0) && (mEvdoSnr <= 8)) ? mEvdoSnr : -1; + mEvdoEcio = (mEvdoEcio >= 0) ? -mEvdoEcio : -160; + mEvdoSnr = ((mEvdoSnr >= 0) && (mEvdoSnr <= 8)) ? mEvdoSnr : -1; // TS 36.214 Physical Layer Section 5.1.3, TS 36.331 RRC mLteSignalStrength = (mLteSignalStrength >= 0) ? mLteSignalStrength : 99;