Merge "Make LTE signal bar thresholds customizable with carrier configuration"

This commit is contained in:
Jordan Liu
2018-01-19 20:39:43 +00:00
committed by Gerrit Code Review
10 changed files with 89 additions and 161 deletions

View File

@@ -25,15 +25,5 @@
-->
<integer name="config_mobile_mtu">1358</integer>
<!--Thresholds for LTE dbm in status bar-->
<integer-array translatable="false" name="config_lteDbmThresholds">
<item>-140</item> <!-- SIGNAL_STRENGTH_NONE_OR_UNKNOWN -->
<item>-115</item> <!-- SIGNAL_STRENGTH_POOR -->
<item>-105</item> <!-- SIGNAL_STRENGTH_MODERATE -->
<item>-95</item> <!-- SIGNAL_STRENGTH_GOOD -->
<item>-85</item> <!-- SIGNAL_STRENGTH_GREAT -->
<item>-44</item>
</integer-array>
<string translatable="false" name="prohibit_manual_network_selection_in_gobal_mode">true;BAE0000000000000</string>
</resources>

View File

@@ -51,16 +51,6 @@
<bool name="config_auto_attach_data_on_creation">false</bool>
<!--Thresholds for LTE dbm in status bar-->
<integer-array translatable="false" name="config_lteDbmThresholds">
<item>-140</item> <!-- SIGNAL_STRENGTH_NONE_OR_UNKNOWN -->
<item>-115</item> <!-- SIGNAL_STRENGTH_POOR -->
<item>-105</item> <!-- SIGNAL_STRENGTH_MODERATE -->
<item>-95</item> <!-- SIGNAL_STRENGTH_GOOD -->
<item>-85</item> <!-- SIGNAL_STRENGTH_GREAT -->
<item>-44</item>
</integer-array>
<string translatable="false" name="prohibit_manual_network_selection_in_gobal_mode">true</string>
<bool name="config_use_sim_language_file">true</bool>

View File

@@ -31,16 +31,6 @@
<item>9</item>
</integer-array>
<!--Thresholds for LTE dbm in status bar-->
<integer-array translatable="false" name="config_lteDbmThresholds">
<item>-140</item> <!-- SIGNAL_STRENGTH_NONE_OR_UNKNOWN -->
<item>-120</item> <!-- SIGNAL_STRENGTH_POOR -->
<item>-115</item> <!-- SIGNAL_STRENGTH_MODERATE -->
<item>-100</item> <!-- SIGNAL_STRENGTH_GOOD -->
<item>-90</item> <!-- SIGNAL_STRENGTH_GREAT -->
<item>-44</item>
</integer-array>
<!-- Configure mobile network MTU. Carrier specific value is set here.
-->
<integer name="config_mobile_mtu">1400</integer>

View File

@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2017, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You my obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<!-- These resources are around just to allow their values to be customized
for different hardware and product builds. -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!--Thresholds for LTE dbm in status bar-->
<integer-array translatable="false" name="config_lteDbmThresholds">
<item>-140</item> <!-- SIGNAL_STRENGTH_NONE_OR_UNKNOWN -->
<item>-120</item> <!-- SIGNAL_STRENGTH_POOR -->
<item>-115</item> <!-- SIGNAL_STRENGTH_MODERATE -->
<item>-100</item> <!-- SIGNAL_STRENGTH_GOOD -->
<item>-90</item> <!-- SIGNAL_STRENGTH_GREAT -->
<item>-44</item>
</integer-array>
</resources>

View File

@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2017, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You my obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<!-- These resources are around just to allow their values to be customized
for different hardware and product builds. -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!--Thresholds for LTE dbm in status bar-->
<integer-array translatable="false" name="config_lteDbmThresholds">
<item>-140</item> <!-- SIGNAL_STRENGTH_NONE_OR_UNKNOWN -->
<item>-120</item> <!-- SIGNAL_STRENGTH_POOR -->
<item>-115</item> <!-- SIGNAL_STRENGTH_MODERATE -->
<item>-100</item> <!-- SIGNAL_STRENGTH_GOOD -->
<item>-90</item> <!-- SIGNAL_STRENGTH_GREAT -->
<item>-44</item>
</integer-array>
</resources>

View File

@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2017, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You my obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<!-- These resources are around just to allow their values to be customized
for different hardware and product builds. -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!--Thresholds for LTE dbm in status bar-->
<integer-array translatable="false" name="config_lteDbmThresholds">
<item>-140</item> <!-- SIGNAL_STRENGTH_NONE_OR_UNKNOWN -->
<item>-120</item> <!-- SIGNAL_STRENGTH_POOR -->
<item>-115</item> <!-- SIGNAL_STRENGTH_MODERATE -->
<item>-100</item> <!-- SIGNAL_STRENGTH_GOOD -->
<item>-90</item> <!-- SIGNAL_STRENGTH_GREAT -->
<item>-44</item>
</integer-array>
</resources>

View File

@@ -2557,6 +2557,7 @@
<bool name="config_sms_force_7bit_encoding">false</bool>
<!-- Number of physical SIM slots on the device. This includes both eSIM and pSIM slots, and
is not necessarily the same as the number of phones/logical modems supported by the device.
For example, a multi-sim device can have 2 phones/logical modems, but 3 physical slots,
@@ -2564,16 +2565,6 @@
and one pSIM) -->
<integer name="config_num_physical_slots">1</integer>
<!--Thresholds for LTE dbm in status bar-->
<integer-array translatable="false" name="config_lteDbmThresholds">
<item>-140</item> <!-- SIGNAL_STRENGTH_NONE_OR_UNKNOWN -->
<item>-128</item> <!-- SIGNAL_STRENGTH_POOR -->
<item>-118</item> <!-- SIGNAL_STRENGTH_MODERATE -->
<item>-108</item> <!-- SIGNAL_STRENGTH_GOOD -->
<item>-98</item> <!-- SIGNAL_STRENGTH_GREAT -->
<item>-44</item>
</integer-array>
<!-- Enabled built-in zen mode condition providers -->
<string-array translatable="false" name="config_system_condition_providers">
<item>countdown</item>

View File

@@ -2384,9 +2384,6 @@
<!-- Cascading submenus -->
<java-symbol type="dimen" name="cascading_menus_min_smallest_width" />
<!-- From SignalStrength -->
<java-symbol type="array" name="config_lteDbmThresholds" />
<java-symbol type="string" name="android_system_label" />
<java-symbol type="string" name="system_error_wipe_data" />
<java-symbol type="string" name="system_error_manufacturer" />

View File

@@ -1738,6 +1738,13 @@ public class CarrierConfigManager {
*/
public static final String KEY_CARRIER_CONFIG_APPLIED_BOOL = "carrier_config_applied_bool";
/**
* List of thresholds of RSRP for determining the display level of LTE signal bar.
* @hide
*/
public static final String KEY_LTE_RSRP_THRESHOLDS_INT_ARRAY =
"lte_rsrp_thresholds_int_array";
/** The default value for every variable. */
private final static PersistableBundle sDefaults;
@@ -2024,6 +2031,15 @@ public class CarrierConfigManager {
sDefaults.putBoolean(KEY_SPN_DISPLAY_RULE_USE_ROAMING_FROM_SERVICE_STATE_BOOL, false);
sDefaults.putBoolean(KEY_ALWAYS_SHOW_DATA_RAT_ICON_BOOL, false);
sDefaults.putBoolean(KEY_CARRIER_CONFIG_APPLIED_BOOL, false);
sDefaults.putIntArray(KEY_LTE_RSRP_THRESHOLDS_INT_ARRAY,
new int[] {
-140, /* SIGNAL_STRENGTH_NONE_OR_UNKNOWN */
-128, /* SIGNAL_STRENGTH_POOR */
-118, /* SIGNAL_STRENGTH_MODERATE */
-108, /* SIGNAL_STRENGTH_GOOD */
-98, /* SIGNAL_STRENGTH_GREAT */
-44
});
}
/**

View File

@@ -19,9 +19,13 @@ package android.telephony;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.CarrierConfigManager;
import android.util.Log;
import android.content.res.Resources;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Contains phone signal strength related information.
*/
@@ -51,6 +55,8 @@ public class SignalStrength implements Parcelable {
//Use int max, as -1 is a valid value in signal strength
public static final int INVALID = 0x7FFFFFFF;
private static final int LTE_RSRP_THRESHOLDS_NUM = 6;
private int mGsmSignalStrength; // Valid values are (0-31, 99) as defined in TS 27.007 8.5
private int mGsmBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5
private int mCdmaDbm; // This value is the RSSI value
@@ -70,6 +76,9 @@ public class SignalStrength implements Parcelable {
private boolean isGsm; // This value is set by the ServiceStateTracker onSignalStrengthResult
private boolean mUseOnlyRsrpForLteLevel; // Use only RSRP for the number of LTE signal bar.
// The threshold of LTE RSRP for determining the display level of LTE signal bar.
private int mLteRsrpThresholds[] = new int[LTE_RSRP_THRESHOLDS_NUM];
/**
* Create a new SignalStrength from a intent notifier Bundle
*
@@ -110,6 +119,7 @@ public class SignalStrength implements Parcelable {
mTdScdmaRscp = INVALID;
isGsm = true;
mUseOnlyRsrpForLteLevel = false;
setLteRsrpThresholds(getDefaultLteRsrpThresholds());
}
/**
@@ -137,6 +147,7 @@ public class SignalStrength implements Parcelable {
mTdScdmaRscp = INVALID;
isGsm = gsmFlag;
mUseOnlyRsrpForLteLevel = false;
setLteRsrpThresholds(getDefaultLteRsrpThresholds());
}
/**
@@ -276,6 +287,8 @@ public class SignalStrength implements Parcelable {
mTdScdmaRscp = INVALID;
isGsm = gsm;
mUseOnlyRsrpForLteLevel = useOnlyRsrpForLteLevel;
setLteRsrpThresholds(getDefaultLteRsrpThresholds());
if (DBG) log("initialize: " + toString());
}
@@ -299,6 +312,7 @@ public class SignalStrength implements Parcelable {
mTdScdmaRscp = s.mTdScdmaRscp;
isGsm = s.isGsm;
mUseOnlyRsrpForLteLevel = s.mUseOnlyRsrpForLteLevel;
setLteRsrpThresholds(s.mLteRsrpThresholds);
}
/**
@@ -325,6 +339,9 @@ public class SignalStrength implements Parcelable {
mTdScdmaRscp = in.readInt();
isGsm = (in.readInt() != 0);
mUseOnlyRsrpForLteLevel = (in.readInt() != 0);
for (int i = 0; i < LTE_RSRP_THRESHOLDS_NUM; i++) {
mLteRsrpThresholds[i] = in.readInt();
}
}
/**
@@ -374,6 +391,9 @@ public class SignalStrength implements Parcelable {
out.writeInt(mTdScdmaRscp);
out.writeInt(isGsm ? 1 : 0);
out.writeInt(mUseOnlyRsrpForLteLevel ? 1 : 0);
for (int i = 0; i < LTE_RSRP_THRESHOLDS_NUM; i++) {
out.writeInt(mLteRsrpThresholds[i]);
}
}
/**
@@ -479,6 +499,22 @@ public class SignalStrength implements Parcelable {
mLteRsrpBoost = lteRsrpBoost;
}
/**
* Sets the threshold array for determining the display level of LTE signal bar.
*
* @param lteRsrpThresholds int array for determining the display level.
*
* @hide
*/
public void setLteRsrpThresholds(int[] lteRsrpThresholds) {
if ((lteRsrpThresholds == null)
|| (lteRsrpThresholds.length != LTE_RSRP_THRESHOLDS_NUM)) {
Log.wtf(LOG_TAG, "setLteRsrpThresholds - lteRsrpThresholds is invalid.");
return;
}
System.arraycopy(lteRsrpThresholds, 0, mLteRsrpThresholds, 0, LTE_RSRP_THRESHOLDS_NUM);
}
/**
* Get the GSM Signal Strength, valid values are (0-31, 99) as defined in TS
* 27.007 8.5
@@ -833,25 +869,18 @@ public class SignalStrength implements Parcelable {
*/
int rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN, rsrpIconLevel = -1, snrIconLevel = -1;
int[] threshRsrp = Resources.getSystem().getIntArray(
com.android.internal.R.array.config_lteDbmThresholds);
if (threshRsrp.length != 6) {
Log.wtf(LOG_TAG, "getLteLevel - config_lteDbmThresholds has invalid num of elements."
+ " Cannot evaluate RSRP signal.");
} else {
if (mLteRsrp > threshRsrp[5]) {
rsrpIconLevel = -1;
} else if (mLteRsrp >= (threshRsrp[4] - mLteRsrpBoost)) {
rsrpIconLevel = SIGNAL_STRENGTH_GREAT;
} else if (mLteRsrp >= (threshRsrp[3] - mLteRsrpBoost)) {
rsrpIconLevel = SIGNAL_STRENGTH_GOOD;
} else if (mLteRsrp >= (threshRsrp[2] - mLteRsrpBoost)) {
rsrpIconLevel = SIGNAL_STRENGTH_MODERATE;
} else if (mLteRsrp >= (threshRsrp[1] - mLteRsrpBoost)) {
rsrpIconLevel = SIGNAL_STRENGTH_POOR;
} else if (mLteRsrp >= threshRsrp[0]) {
rsrpIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
}
if (mLteRsrp > mLteRsrpThresholds[5]) {
rsrpIconLevel = -1;
} else if (mLteRsrp >= (mLteRsrpThresholds[4] - mLteRsrpBoost)) {
rsrpIconLevel = SIGNAL_STRENGTH_GREAT;
} else if (mLteRsrp >= (mLteRsrpThresholds[3] - mLteRsrpBoost)) {
rsrpIconLevel = SIGNAL_STRENGTH_GOOD;
} else if (mLteRsrp >= (mLteRsrpThresholds[2] - mLteRsrpBoost)) {
rsrpIconLevel = SIGNAL_STRENGTH_MODERATE;
} else if (mLteRsrp >= (mLteRsrpThresholds[1] - mLteRsrpBoost)) {
rsrpIconLevel = SIGNAL_STRENGTH_POOR;
} else if (mLteRsrp >= mLteRsrpThresholds[0]) {
rsrpIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
}
if (useOnlyRsrpForLteLevel()) {
@@ -1010,7 +1039,7 @@ public class SignalStrength implements Parcelable {
+ (mLteSignalStrength * primeNum) + (mLteRsrp * primeNum)
+ (mLteRsrq * primeNum) + (mLteRssnr * primeNum) + (mLteCqi * primeNum)
+ (mLteRsrpBoost * primeNum) + (mTdScdmaRscp * primeNum) + (isGsm ? 1 : 0)
+ (mUseOnlyRsrpForLteLevel ? 1 : 0));
+ (mUseOnlyRsrpForLteLevel ? 1 : 0) + (Arrays.hashCode(mLteRsrpThresholds)));
}
/**
@@ -1045,7 +1074,8 @@ public class SignalStrength implements Parcelable {
&& mLteRsrpBoost == s.mLteRsrpBoost
&& mTdScdmaRscp == s.mTdScdmaRscp
&& isGsm == s.isGsm
&& mUseOnlyRsrpForLteLevel == s.mUseOnlyRsrpForLteLevel);
&& mUseOnlyRsrpForLteLevel == s.mUseOnlyRsrpForLteLevel
&& Arrays.equals(mLteRsrpThresholds, s.mLteRsrpThresholds));
}
/**
@@ -1070,7 +1100,8 @@ public class SignalStrength implements Parcelable {
+ " " + mTdScdmaRscp
+ " " + (isGsm ? "gsm|lte" : "cdma")
+ " " + (mUseOnlyRsrpForLteLevel ? "use_only_rsrp_for_lte_level" :
"use_rsrp_and_rssnr_for_lte_level"));
"use_rsrp_and_rssnr_for_lte_level")
+ " " + (Arrays.toString(mLteRsrpThresholds)));
}
/** Returns the signal strength related to GSM. */
@@ -1126,6 +1157,10 @@ public class SignalStrength implements Parcelable {
mTdScdmaRscp = m.getInt("TdScdma");
isGsm = m.getBoolean("isGsm");
mUseOnlyRsrpForLteLevel = m.getBoolean("useOnlyRsrpForLteLevel");
ArrayList<Integer> lteRsrpThresholds = m.getIntegerArrayList("lteRsrpThresholds");
for (int i = 0; i < lteRsrpThresholds.size(); i++) {
mLteRsrpThresholds[i] = lteRsrpThresholds.get(i);
}
}
/**
@@ -1151,6 +1186,21 @@ public class SignalStrength implements Parcelable {
m.putInt("TdScdma", mTdScdmaRscp);
m.putBoolean("isGsm", isGsm);
m.putBoolean("useOnlyRsrpForLteLevel", mUseOnlyRsrpForLteLevel);
ArrayList<Integer> lteRsrpThresholds = new ArrayList<Integer>();
for (int value : mLteRsrpThresholds) {
lteRsrpThresholds.add(value);
}
m.putIntegerArrayList("lteRsrpThresholds", lteRsrpThresholds);
}
/**
* Gets the default threshold array for determining the display level of LTE signal bar.
*
* @return int array for determining the display level.
*/
private int[] getDefaultLteRsrpThresholds() {
return CarrierConfigManager.getDefaultConfig().getIntArray(
CarrierConfigManager.KEY_LTE_RSRP_THRESHOLDS_INT_ARRAY);
}
/**