Merge "Extends carrier config KEY_5G_ICON_CONFIGURATION_STRING to support more scenarios." into qt-qpr1-dev am: 052a08bcda
am: bfc0a8de45
Change-Id: I03b5c3f447fb6adfd7988ee68998969c28888243
This commit is contained in:
@@ -537,8 +537,14 @@ public class MobileSignalController extends SignalController<
|
||||
return mConfig.nr5GIconMap.get(Config.NR_CONNECTED);
|
||||
}
|
||||
} else if (nrState == NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED) {
|
||||
if (mConfig.nr5GIconMap.containsKey(Config.NR_NOT_RESTRICTED)) {
|
||||
return mConfig.nr5GIconMap.get(Config.NR_NOT_RESTRICTED);
|
||||
if (mCurrentState.activityDormant) {
|
||||
if (mConfig.nr5GIconMap.containsKey(Config.NR_NOT_RESTRICTED_RRC_IDLE)) {
|
||||
return mConfig.nr5GIconMap.get(Config.NR_NOT_RESTRICTED_RRC_IDLE);
|
||||
}
|
||||
} else {
|
||||
if (mConfig.nr5GIconMap.containsKey(Config.NR_NOT_RESTRICTED_RRC_CON)) {
|
||||
return mConfig.nr5GIconMap.get(Config.NR_NOT_RESTRICTED_RRC_CON);
|
||||
}
|
||||
}
|
||||
} else if (nrState == NetworkRegistrationInfo.NR_STATE_RESTRICTED) {
|
||||
if (mConfig.nr5GIconMap.containsKey(Config.NR_RESTRICTED)) {
|
||||
@@ -559,6 +565,8 @@ public class MobileSignalController extends SignalController<
|
||||
|| activity == TelephonyManager.DATA_ACTIVITY_IN;
|
||||
mCurrentState.activityOut = activity == TelephonyManager.DATA_ACTIVITY_INOUT
|
||||
|| activity == TelephonyManager.DATA_ACTIVITY_OUT;
|
||||
mCurrentState.activityDormant = activity == TelephonyManager.DATA_ACTIVITY_DORMANT;
|
||||
|
||||
notifyListenersIfNecessary();
|
||||
}
|
||||
|
||||
|
||||
@@ -1112,8 +1112,9 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
||||
static class Config {
|
||||
static final int NR_CONNECTED_MMWAVE = 1;
|
||||
static final int NR_CONNECTED = 2;
|
||||
static final int NR_NOT_RESTRICTED = 3;
|
||||
static final int NR_RESTRICTED = 4;
|
||||
static final int NR_NOT_RESTRICTED_RRC_IDLE = 3;
|
||||
static final int NR_NOT_RESTRICTED_RRC_CON = 4;
|
||||
static final int NR_RESTRICTED = 5;
|
||||
|
||||
Map<Integer, MobileIconGroup> nr5GIconMap = new HashMap<>();
|
||||
|
||||
@@ -1133,10 +1134,11 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
||||
*/
|
||||
private static final Map<String, Integer> NR_STATUS_STRING_TO_INDEX;
|
||||
static {
|
||||
NR_STATUS_STRING_TO_INDEX = new HashMap<>(4);
|
||||
NR_STATUS_STRING_TO_INDEX = new HashMap<>(5);
|
||||
NR_STATUS_STRING_TO_INDEX.put("connected_mmwave", NR_CONNECTED_MMWAVE);
|
||||
NR_STATUS_STRING_TO_INDEX.put("connected", NR_CONNECTED);
|
||||
NR_STATUS_STRING_TO_INDEX.put("not_restricted", NR_NOT_RESTRICTED);
|
||||
NR_STATUS_STRING_TO_INDEX.put("not_restricted_rrc_idle", NR_NOT_RESTRICTED_RRC_IDLE);
|
||||
NR_STATUS_STRING_TO_INDEX.put("not_restricted_rrc_con", NR_NOT_RESTRICTED_RRC_CON);
|
||||
NR_STATUS_STRING_TO_INDEX.put("restricted", NR_RESTRICTED);
|
||||
}
|
||||
|
||||
|
||||
@@ -258,6 +258,7 @@ public abstract class SignalController<T extends SignalController.State,
|
||||
boolean enabled;
|
||||
boolean activityIn;
|
||||
boolean activityOut;
|
||||
public boolean activityDormant;
|
||||
int level;
|
||||
IconGroup iconGroup;
|
||||
int inetCondition;
|
||||
@@ -274,6 +275,7 @@ public abstract class SignalController<T extends SignalController.State,
|
||||
inetCondition = state.inetCondition;
|
||||
activityIn = state.activityIn;
|
||||
activityOut = state.activityOut;
|
||||
activityDormant = state.activityDormant;
|
||||
rssi = state.rssi;
|
||||
time = state.time;
|
||||
}
|
||||
@@ -297,6 +299,7 @@ public abstract class SignalController<T extends SignalController.State,
|
||||
.append("iconGroup=").append(iconGroup).append(',')
|
||||
.append("activityIn=").append(activityIn).append(',')
|
||||
.append("activityOut=").append(activityOut).append(',')
|
||||
.append("activityDormant=").append(activityDormant).append(',')
|
||||
.append("rssi=").append(rssi).append(',')
|
||||
.append("lastModified=").append(DateFormat.format("MM-dd HH:mm:ss", time));
|
||||
}
|
||||
@@ -314,6 +317,7 @@ public abstract class SignalController<T extends SignalController.State,
|
||||
&& other.iconGroup == iconGroup
|
||||
&& other.activityIn == activityIn
|
||||
&& other.activityOut == activityOut
|
||||
&& other.activityDormant == activityDormant
|
||||
&& other.rssi == rssi;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,6 +228,18 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
||||
NetworkControllerImpl.Config.add5GIconMapping("connected:5g", mConfig);
|
||||
}
|
||||
|
||||
public void setupNr5GIconConfigurationForNotRestrictedRrcCon() {
|
||||
NetworkControllerImpl.Config.add5GIconMapping("connected_mmwave:5g_plus", mConfig);
|
||||
NetworkControllerImpl.Config.add5GIconMapping("connected:5g_plus", mConfig);
|
||||
NetworkControllerImpl.Config.add5GIconMapping("not_restricted_rrc_con:5g", mConfig);
|
||||
}
|
||||
|
||||
public void setupNr5GIconConfigurationForNotRestrictedRrcIdle() {
|
||||
NetworkControllerImpl.Config.add5GIconMapping("connected_mmwave:5g_plus", mConfig);
|
||||
NetworkControllerImpl.Config.add5GIconMapping("connected:5g_plus", mConfig);
|
||||
NetworkControllerImpl.Config.add5GIconMapping("not_restricted_rrc_idle:5g", mConfig);
|
||||
}
|
||||
|
||||
public void setConnectivityViaBroadcast(
|
||||
int networkType, boolean validated, boolean isConnected) {
|
||||
setConnectivityCommon(networkType, validated, isConnected);
|
||||
|
||||
@@ -174,6 +174,35 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
|
||||
false, true, NOT_DEFAULT_DATA_STRING);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNr5GIcon_NrNotRestrictedRrcCon_show5GIcon() {
|
||||
setupNr5GIconConfigurationForNotRestrictedRrcCon();
|
||||
setupDefaultSignal();
|
||||
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
|
||||
TelephonyManager.NETWORK_TYPE_LTE);
|
||||
updateDataActivity(TelephonyManager.DATA_ACTIVITY_INOUT);
|
||||
ServiceState ss = Mockito.mock(ServiceState.class);
|
||||
doReturn(NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED).when(ss).getNrState();
|
||||
mPhoneStateListener.onServiceStateChanged(ss);
|
||||
|
||||
verifyLastMobileDataIndicators(true, DEFAULT_SIGNAL_STRENGTH, TelephonyIcons.ICON_5G,
|
||||
true, DEFAULT_QS_SIGNAL_STRENGTH, TelephonyIcons.ICON_5G, true, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNr5GIcon_NrNotRestrictedRrcIdle_show5GIcon() {
|
||||
setupNr5GIconConfigurationForNotRestrictedRrcIdle();
|
||||
setupDefaultSignal();
|
||||
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
|
||||
TelephonyManager.NETWORK_TYPE_LTE);
|
||||
updateDataActivity(TelephonyManager.DATA_ACTIVITY_DORMANT);
|
||||
ServiceState ss = Mockito.mock(ServiceState.class);
|
||||
doReturn(NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED).when(ss).getNrState();
|
||||
mPhoneStateListener.onServiceStateChanged(ss);
|
||||
|
||||
verifyDataIndicators(TelephonyIcons.ICON_5G);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNr5GIcon_NrConnectedWithoutMMWave_show5GIcon() {
|
||||
setupDefaultNr5GIconConfiguration();
|
||||
|
||||
@@ -2656,25 +2656,32 @@ public class CarrierConfigManager {
|
||||
"call_waiting_service_class_int";
|
||||
|
||||
/**
|
||||
* This configuration allow the system UI to display different 5G icon for different 5G status.
|
||||
* This configuration allow the system UI to display different 5G icon for different 5G
|
||||
* scenario.
|
||||
*
|
||||
* There are four 5G status:
|
||||
* There are five 5G scenarios:
|
||||
* 1. connected_mmwave: device currently connected to 5G cell as the secondary cell and using
|
||||
* millimeter wave.
|
||||
* 2. connected: device currently connected to 5G cell as the secondary cell but not using
|
||||
* millimeter wave.
|
||||
* 3. not_restricted: device camped on a network that has 5G capability(not necessary to connect
|
||||
* a 5G cell as a secondary cell) and the use of 5G is not restricted.
|
||||
* 4. restricted: device camped on a network that has 5G capability(not necessary to connect a
|
||||
* 3. not_restricted_rrc_idle: device camped on a network that has 5G capability(not necessary
|
||||
* to connect a 5G cell as a secondary cell) and the use of 5G is not restricted and RRC
|
||||
* currently in IDLE state.
|
||||
* 4. not_restricted_rrc_con: device camped on a network that has 5G capability(not necessary
|
||||
* to connect a 5G cell as a secondary cell) and the use of 5G is not restricted and RRC
|
||||
* currently in CONNECTED state.
|
||||
* 5. restricted: device camped on a network that has 5G capability(not necessary to connect a
|
||||
* 5G cell as a secondary cell) but the use of 5G is restricted.
|
||||
*
|
||||
* The configured string contains multiple key-value pairs separated by comma. For each pair,
|
||||
* the key and value is separated by a colon. The key is corresponded to a 5G status above and
|
||||
* the value is the icon name. Use "None" as the icon name if no icon should be shown in a
|
||||
* specific 5G status.
|
||||
* specific 5G scenario. If the scenario is "None", config can skip this key and value.
|
||||
*
|
||||
* Here is an example of the configuration:
|
||||
* "connected_mmwave:5GPlus,connected:5G,not_restricted:None,restricted:None"
|
||||
* Here is an example:
|
||||
* UE want to display 5GPlus icon for scenario#1, and 5G icon for scenario#2; otherwise no
|
||||
* define.
|
||||
* The configuration is: "connected_mmwave:5GPlus,connected:5G"
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@@ -3516,7 +3523,7 @@ public class CarrierConfigManager {
|
||||
sDefaults.putBoolean(KEY_USE_CALLER_ID_USSD_BOOL, false);
|
||||
sDefaults.putInt(KEY_CALL_WAITING_SERVICE_CLASS_INT, 1 /* SERVICE_CLASS_VOICE */);
|
||||
sDefaults.putString(KEY_5G_ICON_CONFIGURATION_STRING,
|
||||
"connected_mmwave:None,connected:5G,not_restricted:None,restricted:None");
|
||||
"connected_mmwave:5G,connected:5G");
|
||||
sDefaults.putInt(KEY_5G_ICON_DISPLAY_GRACE_PERIOD_SEC_INT, 0);
|
||||
sDefaults.putBoolean(KEY_ASCII_7_BIT_SUPPORT_FOR_LONG_MESSAGE_BOOL, false);
|
||||
/* Default value is minimum RSRP level needed for SIGNAL_STRENGTH_GOOD */
|
||||
|
||||
Reference in New Issue
Block a user