Merge "Allow GSM RSSI levels to be customized by CarrierConfig"
This commit is contained in:
@@ -2598,6 +2598,19 @@ public class CarrierConfigManager {
|
|||||||
public static final String KEY_IS_OPPORTUNISTIC_SUBSCRIPTION_BOOL =
|
public static final String KEY_IS_OPPORTUNISTIC_SUBSCRIPTION_BOOL =
|
||||||
"key_is_opportunistic_subscription_bool";
|
"key_is_opportunistic_subscription_bool";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of 4 GSM RSSI thresholds above which a signal level is considered POOR,
|
||||||
|
* MODERATE, GOOD, or EXCELLENT, to be used in SignalStrength reporting.
|
||||||
|
*
|
||||||
|
* Note that the min and max thresholds are fixed at -113 and -51, as set in 3GPP TS 27.007
|
||||||
|
* section 8.5.
|
||||||
|
* <p>
|
||||||
|
* See CellSignalStrengthGsm#GSM_RSSI_MAX and CellSignalStrengthGsm#GSM_RSSI_MIN. Any signal
|
||||||
|
* level outside these boundaries is considered invalid.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String KEY_GSM_RSSI_THRESHOLDS_INT_ARRAY =
|
||||||
|
"gsm_rssi_thresholds_int_array";
|
||||||
|
|
||||||
/** The default value for every variable. */
|
/** The default value for every variable. */
|
||||||
private final static PersistableBundle sDefaults;
|
private final static PersistableBundle sDefaults;
|
||||||
@@ -2992,6 +3005,13 @@ public class CarrierConfigManager {
|
|||||||
false);
|
false);
|
||||||
sDefaults.putString(KEY_SUBSCRIPTION_GROUP_UUID_STRING, "");
|
sDefaults.putString(KEY_SUBSCRIPTION_GROUP_UUID_STRING, "");
|
||||||
sDefaults.putBoolean(KEY_IS_OPPORTUNISTIC_SUBSCRIPTION_BOOL, false);
|
sDefaults.putBoolean(KEY_IS_OPPORTUNISTIC_SUBSCRIPTION_BOOL, false);
|
||||||
|
sDefaults.putIntArray(KEY_GSM_RSSI_THRESHOLDS_INT_ARRAY,
|
||||||
|
new int[] {
|
||||||
|
-107, /* SIGNAL_STRENGTH_POOR */
|
||||||
|
-103, /* SIGNAL_STRENGTH_MODERATE */
|
||||||
|
-97, /* SIGNAL_STRENGTH_GOOD */
|
||||||
|
-89, /* SIGNAL_STRENGTH_GREAT */
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ public final class CellSignalStrengthGsm extends CellSignalStrength implements P
|
|||||||
private static final int GSM_RSSI_GOOD = -97;
|
private static final int GSM_RSSI_GOOD = -97;
|
||||||
private static final int GSM_RSSI_MODERATE = -103;
|
private static final int GSM_RSSI_MODERATE = -103;
|
||||||
private static final int GSM_RSSI_POOR = -107;
|
private static final int GSM_RSSI_POOR = -107;
|
||||||
|
private static final int GSM_RSSI_MIN = -113;
|
||||||
|
|
||||||
|
private static final int[] sRssiThresholds = new int[] {
|
||||||
|
GSM_RSSI_POOR, GSM_RSSI_MODERATE, GSM_RSSI_GOOD, GSM_RSSI_GREAT};
|
||||||
|
|
||||||
private int mRssi; // in dBm [-113, -51] or UNAVAILABLE
|
private int mRssi; // in dBm [-113, -51] or UNAVAILABLE
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
@@ -54,7 +58,7 @@ public final class CellSignalStrengthGsm extends CellSignalStrength implements P
|
|||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellSignalStrengthGsm(int rssi, int ber, int ta) {
|
public CellSignalStrengthGsm(int rssi, int ber, int ta) {
|
||||||
mRssi = inRangeOrUnavailable(rssi, -113, -51);
|
mRssi = inRangeOrUnavailable(rssi, GSM_RSSI_MIN, GSM_RSSI_MAX);
|
||||||
mBitErrorRate = inRangeOrUnavailable(ber, 0, 7, 99);
|
mBitErrorRate = inRangeOrUnavailable(ber, 0, 7, 99);
|
||||||
mTimingAdvance = inRangeOrUnavailable(ta, 0, 219);
|
mTimingAdvance = inRangeOrUnavailable(ta, 0, 219);
|
||||||
updateLevel(null, null);
|
updateLevel(null, null);
|
||||||
@@ -108,12 +112,22 @@ public final class CellSignalStrengthGsm extends CellSignalStrength implements P
|
|||||||
/** @hide */
|
/** @hide */
|
||||||
@Override
|
@Override
|
||||||
public void updateLevel(PersistableBundle cc, ServiceState ss) {
|
public void updateLevel(PersistableBundle cc, ServiceState ss) {
|
||||||
if (mRssi > GSM_RSSI_MAX) mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
int[] rssiThresholds;
|
||||||
else if (mRssi >= GSM_RSSI_GREAT) mLevel = SIGNAL_STRENGTH_GREAT;
|
if (cc == null) {
|
||||||
else if (mRssi >= GSM_RSSI_GOOD) mLevel = SIGNAL_STRENGTH_GOOD;
|
rssiThresholds = sRssiThresholds;
|
||||||
else if (mRssi >= GSM_RSSI_MODERATE) mLevel = SIGNAL_STRENGTH_MODERATE;
|
} else {
|
||||||
else if (mRssi >= GSM_RSSI_POOR) mLevel = SIGNAL_STRENGTH_POOR;
|
rssiThresholds = cc.getIntArray(CarrierConfigManager.KEY_GSM_RSSI_THRESHOLDS_INT_ARRAY);
|
||||||
else mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
if (rssiThresholds == null || rssiThresholds.length != NUM_SIGNAL_STRENGTH_THRESHOLDS) {
|
||||||
|
rssiThresholds = sRssiThresholds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int level = NUM_SIGNAL_STRENGTH_THRESHOLDS;
|
||||||
|
if (mRssi < GSM_RSSI_MIN || mRssi > GSM_RSSI_MAX) {
|
||||||
|
mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while (level > 0 && mRssi < rssiThresholds[level - 1]) level--;
|
||||||
|
mLevel = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user