Hide roaming option when carriers force all networks as HOME networks

This change will hide roaming option in carrier's network setting
if the carrier overrrides the carrier config force_home_network_bool
to true.

Some carriers, like google Fi, has no concept of roaming. The carrier
config force_home_network_bool is overridden to true to treat all
cellular networks as home networks. There is no actually impact when
user turn on/off the roaming option in network setting. Leaving an
unused option just confuse many end users.

Bug: 79424760
Test: make && make RunSettingsRoboTests
Test: activate Fi service and make sure no roaming option
Test: activate VZW service and make sure roaming option is present
Test: override the cc config with adb command to make sure the roaming
option is always correctly shown/hidden on the cc key values

Change-Id: If6d0f7e3a5edea368b3a725afd9a2b4d1ad686ed
This commit is contained in:
Rambo Wang
2022-09-09 17:13:07 +00:00
committed by rambowang
parent e68cf6df7d
commit 145c954a33
2 changed files with 39 additions and 1 deletions

View File

@@ -65,6 +65,16 @@ public class RoamingPreferenceController extends TelephonyTogglePreferenceContro
mCarrierConfigManager = context.getSystemService(CarrierConfigManager.class);
}
@Override
public int getAvailabilityStatus() {
final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);
if (carrierConfig != null && carrierConfig.getBoolean(
CarrierConfigManager.KEY_FORCE_HOME_NETWORK_BOOL)) {
return CONDITIONALLY_UNAVAILABLE;
}
return AVAILABLE;
}
@Override
public void onStart() {
if (mListener == null) {