Fix Order of Operations for Converting RSSI to ASU

Due to the wrong order of operations, the conversion
from RSSI to ASU was returning bad results. Fix the
equation so that the ASU is correctly calculated.

Bug: 126199198
Test: (force device to GSM) - atest CellInfoTest
      verified on aosp_taimen

Change-Id: Iaeb9a2a6d8efb5b39fc1f81e8d2969694cc06422
This commit is contained in:
Nathan Harold
2019-02-25 10:31:08 -08:00
parent 7db49c554a
commit 11cbc3b9f2

View File

@@ -119,7 +119,7 @@ public abstract class CellSignalStrength {
/** @hide */
protected static final int getAsuFromRssiDbm(int dbm) {
if (dbm == CellInfo.UNAVAILABLE) return 99;
return (dbm / 2) + 113;
return (dbm + 113) / 2;
}
// Range for RSCP in ASU (0-96, 255) as defined in TS 27.007 8.69