Merge "Extends carrier config KEY_5G_ICON_CONFIGURATION_STRING to support more scenarios." into qt-qpr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
052a08bcda
@@ -537,8 +537,14 @@ public class MobileSignalController extends SignalController<
|
|||||||
return mConfig.nr5GIconMap.get(Config.NR_CONNECTED);
|
return mConfig.nr5GIconMap.get(Config.NR_CONNECTED);
|
||||||
}
|
}
|
||||||
} else if (nrState == NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED) {
|
} else if (nrState == NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED) {
|
||||||
if (mConfig.nr5GIconMap.containsKey(Config.NR_NOT_RESTRICTED)) {
|
if (mCurrentState.activityDormant) {
|
||||||
return mConfig.nr5GIconMap.get(Config.NR_NOT_RESTRICTED);
|
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) {
|
} else if (nrState == NetworkRegistrationInfo.NR_STATE_RESTRICTED) {
|
||||||
if (mConfig.nr5GIconMap.containsKey(Config.NR_RESTRICTED)) {
|
if (mConfig.nr5GIconMap.containsKey(Config.NR_RESTRICTED)) {
|
||||||
@@ -559,6 +565,8 @@ public class MobileSignalController extends SignalController<
|
|||||||
|| activity == TelephonyManager.DATA_ACTIVITY_IN;
|
|| activity == TelephonyManager.DATA_ACTIVITY_IN;
|
||||||
mCurrentState.activityOut = activity == TelephonyManager.DATA_ACTIVITY_INOUT
|
mCurrentState.activityOut = activity == TelephonyManager.DATA_ACTIVITY_INOUT
|
||||||
|| activity == TelephonyManager.DATA_ACTIVITY_OUT;
|
|| activity == TelephonyManager.DATA_ACTIVITY_OUT;
|
||||||
|
mCurrentState.activityDormant = activity == TelephonyManager.DATA_ACTIVITY_DORMANT;
|
||||||
|
|
||||||
notifyListenersIfNecessary();
|
notifyListenersIfNecessary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1108,8 +1108,9 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
|||||||
static class Config {
|
static class Config {
|
||||||
static final int NR_CONNECTED_MMWAVE = 1;
|
static final int NR_CONNECTED_MMWAVE = 1;
|
||||||
static final int NR_CONNECTED = 2;
|
static final int NR_CONNECTED = 2;
|
||||||
static final int NR_NOT_RESTRICTED = 3;
|
static final int NR_NOT_RESTRICTED_RRC_IDLE = 3;
|
||||||
static final int NR_RESTRICTED = 4;
|
static final int NR_NOT_RESTRICTED_RRC_CON = 4;
|
||||||
|
static final int NR_RESTRICTED = 5;
|
||||||
|
|
||||||
Map<Integer, MobileIconGroup> nr5GIconMap = new HashMap<>();
|
Map<Integer, MobileIconGroup> nr5GIconMap = new HashMap<>();
|
||||||
|
|
||||||
@@ -1129,10 +1130,11 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
|||||||
*/
|
*/
|
||||||
private static final Map<String, Integer> NR_STATUS_STRING_TO_INDEX;
|
private static final Map<String, Integer> NR_STATUS_STRING_TO_INDEX;
|
||||||
static {
|
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_mmwave", NR_CONNECTED_MMWAVE);
|
||||||
NR_STATUS_STRING_TO_INDEX.put("connected", NR_CONNECTED);
|
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);
|
NR_STATUS_STRING_TO_INDEX.put("restricted", NR_RESTRICTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ public abstract class SignalController<T extends SignalController.State,
|
|||||||
boolean enabled;
|
boolean enabled;
|
||||||
boolean activityIn;
|
boolean activityIn;
|
||||||
boolean activityOut;
|
boolean activityOut;
|
||||||
|
public boolean activityDormant;
|
||||||
int level;
|
int level;
|
||||||
IconGroup iconGroup;
|
IconGroup iconGroup;
|
||||||
int inetCondition;
|
int inetCondition;
|
||||||
@@ -274,6 +275,7 @@ public abstract class SignalController<T extends SignalController.State,
|
|||||||
inetCondition = state.inetCondition;
|
inetCondition = state.inetCondition;
|
||||||
activityIn = state.activityIn;
|
activityIn = state.activityIn;
|
||||||
activityOut = state.activityOut;
|
activityOut = state.activityOut;
|
||||||
|
activityDormant = state.activityDormant;
|
||||||
rssi = state.rssi;
|
rssi = state.rssi;
|
||||||
time = state.time;
|
time = state.time;
|
||||||
}
|
}
|
||||||
@@ -297,6 +299,7 @@ public abstract class SignalController<T extends SignalController.State,
|
|||||||
.append("iconGroup=").append(iconGroup).append(',')
|
.append("iconGroup=").append(iconGroup).append(',')
|
||||||
.append("activityIn=").append(activityIn).append(',')
|
.append("activityIn=").append(activityIn).append(',')
|
||||||
.append("activityOut=").append(activityOut).append(',')
|
.append("activityOut=").append(activityOut).append(',')
|
||||||
|
.append("activityDormant=").append(activityDormant).append(',')
|
||||||
.append("rssi=").append(rssi).append(',')
|
.append("rssi=").append(rssi).append(',')
|
||||||
.append("lastModified=").append(DateFormat.format("MM-dd HH:mm:ss", time));
|
.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.iconGroup == iconGroup
|
||||||
&& other.activityIn == activityIn
|
&& other.activityIn == activityIn
|
||||||
&& other.activityOut == activityOut
|
&& other.activityOut == activityOut
|
||||||
|
&& other.activityDormant == activityDormant
|
||||||
&& other.rssi == rssi;
|
&& other.rssi == rssi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,6 +228,18 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
|||||||
NetworkControllerImpl.Config.add5GIconMapping("connected:5g", mConfig);
|
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(
|
public void setConnectivityViaBroadcast(
|
||||||
int networkType, boolean validated, boolean isConnected) {
|
int networkType, boolean validated, boolean isConnected) {
|
||||||
setConnectivityCommon(networkType, validated, isConnected);
|
setConnectivityCommon(networkType, validated, isConnected);
|
||||||
|
|||||||
@@ -174,6 +174,35 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
|
|||||||
false, true, NOT_DEFAULT_DATA_STRING);
|
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
|
@Test
|
||||||
public void testNr5GIcon_NrConnectedWithoutMMWave_show5GIcon() {
|
public void testNr5GIcon_NrConnectedWithoutMMWave_show5GIcon() {
|
||||||
setupDefaultNr5GIconConfiguration();
|
setupDefaultNr5GIconConfiguration();
|
||||||
|
|||||||
@@ -2616,25 +2616,32 @@ public class CarrierConfigManager {
|
|||||||
"call_waiting_service_class_int";
|
"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
|
* 1. connected_mmwave: device currently connected to 5G cell as the secondary cell and using
|
||||||
* millimeter wave.
|
* millimeter wave.
|
||||||
* 2. connected: device currently connected to 5G cell as the secondary cell but not using
|
* 2. connected: device currently connected to 5G cell as the secondary cell but not using
|
||||||
* millimeter wave.
|
* millimeter wave.
|
||||||
* 3. not_restricted: device camped on a network that has 5G capability(not necessary to connect
|
* 3. not_restricted_rrc_idle: device camped on a network that has 5G capability(not necessary
|
||||||
* a 5G cell as a secondary cell) and the use of 5G is not restricted.
|
* to connect a 5G cell as a secondary cell) and the use of 5G is not restricted and RRC
|
||||||
* 4. restricted: device camped on a network that has 5G capability(not necessary to connect a
|
* 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.
|
* 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 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 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
|
* 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:
|
* Here is an example:
|
||||||
* "connected_mmwave:5GPlus,connected:5G,not_restricted:None,restricted:None"
|
* 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
|
* @hide
|
||||||
*/
|
*/
|
||||||
@@ -3453,7 +3460,7 @@ public class CarrierConfigManager {
|
|||||||
sDefaults.putBoolean(KEY_USE_CALLER_ID_USSD_BOOL, false);
|
sDefaults.putBoolean(KEY_USE_CALLER_ID_USSD_BOOL, false);
|
||||||
sDefaults.putInt(KEY_CALL_WAITING_SERVICE_CLASS_INT, 1 /* SERVICE_CLASS_VOICE */);
|
sDefaults.putInt(KEY_CALL_WAITING_SERVICE_CLASS_INT, 1 /* SERVICE_CLASS_VOICE */);
|
||||||
sDefaults.putString(KEY_5G_ICON_CONFIGURATION_STRING,
|
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.putInt(KEY_5G_ICON_DISPLAY_GRACE_PERIOD_SEC_INT, 0);
|
||||||
sDefaults.putBoolean(KEY_ASCII_7_BIT_SUPPORT_FOR_LONG_MESSAGE_BOOL, false);
|
sDefaults.putBoolean(KEY_ASCII_7_BIT_SUPPORT_FOR_LONG_MESSAGE_BOOL, false);
|
||||||
/* Default value is minimum RSRP level needed for SIGNAL_STRENGTH_GOOD */
|
/* Default value is minimum RSRP level needed for SIGNAL_STRENGTH_GOOD */
|
||||||
|
|||||||
Reference in New Issue
Block a user