diff options
| author | 2018-11-09 14:47:08 -0800 | |
|---|---|---|
| committer | 2018-11-09 14:47:08 -0800 | |
| commit | 61db02b01a18462bd2e4496ba09ef2467e93eecb (patch) | |
| tree | 51e2564bf7ab9839e237d8bdf31fa23f69c332b5 | |
| parent | 358ff5d2bf39a3f58572f32ee9789f0b853a2dbb (diff) | |
| parent | e819bd7a1e79ab727ef2eb457d28254c4c8d6321 (diff) | |
Merge "Introduce getRssi() in CellSignalStrengthLte" am: 5bdf255e0d
am: e819bd7a1e
Change-Id: I77c5ba0bf87afde281473134a306595c052820cc
| -rwxr-xr-x | api/current.txt | 1 | ||||
| -rw-r--r-- | telephony/java/android/telephony/CellSignalStrengthLte.java | 45 |
2 files changed, 46 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt index eb32f0600a24..c5fbe605d5ab 100755 --- a/api/current.txt +++ b/api/current.txt @@ -42293,6 +42293,7 @@ package android.telephony { method public int getLevel(); method public int getRsrp(); method public int getRsrq(); + method public int getRssi(); method public int getRssnr(); method public int getTimingAdvance(); method public void writeToParcel(android.os.Parcel, int); diff --git a/telephony/java/android/telephony/CellSignalStrengthLte.java b/telephony/java/android/telephony/CellSignalStrengthLte.java index d6856b397a00..280a8d2a0020 100644 --- a/telephony/java/android/telephony/CellSignalStrengthLte.java +++ b/telephony/java/android/telephony/CellSignalStrengthLte.java @@ -31,6 +31,25 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P private static final String LOG_TAG = "CellSignalStrengthLte"; private static final boolean DBG = false; + /** + * Indicates the unknown or undetectable RSSI value in ASU. + * + * Reference: TS 27.007 8.5 - Signal quality +CSQ + */ + private static final int SIGNAL_STRENGTH_LTE_RSSI_ASU_UNKNOWN = 99; + /** + * Indicates the maximum valid RSSI value in ASU. + * + * Reference: TS 27.007 8.5 - Signal quality +CSQ + */ + private static final int SIGNAL_STRENGTH_LTE_RSSI_VALID_ASU_MAX_VALUE = 31; + /** + * Indicates the minimum valid RSSI value in ASU. + * + * Reference: TS 27.007 8.5 - Signal quality +CSQ + */ + private static final int SIGNAL_STRENGTH_LTE_RSSI_VALID_ASU_MIN_VALUE = 0; + @UnsupportedAppUsage private int mSignalStrength; @UnsupportedAppUsage @@ -142,6 +161,19 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P } /** + * Get Received Signal Strength Indication (RSSI) in dBm + * + * The value range is [-113, -51] inclusively or {@link CellInfo#UNAVAILABLE} if unavailable. + * + * Reference: TS 27.007 8.5 Signal quality +CSQ + * + * @return the RSSI if available or {@link CellInfo#UNAVAILABLE} if unavailable. + */ + public int getRssi() { + return convertRssiAsuToDBm(mSignalStrength); + } + + /** * Get reference signal signal-to-noise ratio * * @return the RSSNR if available or @@ -309,4 +341,17 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P private static void log(String s) { Rlog.w(LOG_TAG, s); } + + private static int convertRssiAsuToDBm(int rssiAsu) { + if (rssiAsu != SIGNAL_STRENGTH_LTE_RSSI_ASU_UNKNOWN + && (rssiAsu < SIGNAL_STRENGTH_LTE_RSSI_VALID_ASU_MIN_VALUE + || rssiAsu > SIGNAL_STRENGTH_LTE_RSSI_VALID_ASU_MAX_VALUE)) { + Rlog.e(LOG_TAG, "convertRssiAsuToDBm: invalid RSSI in ASU=" + rssiAsu); + return CellInfo.UNAVAILABLE; + } + if (rssiAsu == SIGNAL_STRENGTH_LTE_RSSI_ASU_UNKNOWN) { + return CellInfo.UNAVAILABLE; + } + return -113 + (2 * rssiAsu); + } } |