Merge "Using carrier config for hiding 3G item at preferred network mode" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
19dbb00acb
@@ -39,6 +39,7 @@ import androidx.preference.Preference;
|
|||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.internal.telephony.flags.Flags;
|
||||||
import com.android.settings.network.AllowedNetworkTypesListener;
|
import com.android.settings.network.AllowedNetworkTypesListener;
|
||||||
import com.android.settings.network.CarrierConfigCache;
|
import com.android.settings.network.CarrierConfigCache;
|
||||||
import com.android.settings.network.SubscriptionsChangeListener;
|
import com.android.settings.network.SubscriptionsChangeListener;
|
||||||
@@ -241,6 +242,7 @@ public class EnabledNetworkModePreferenceController extends
|
|||||||
public void updateConfig() {
|
public void updateConfig() {
|
||||||
mTelephonyManager = mTelephonyManager.createForSubscriptionId(mSubId);
|
mTelephonyManager = mTelephonyManager.createForSubscriptionId(mSubId);
|
||||||
final PersistableBundle carrierConfig = mCarrierConfigCache.getConfigForSubId(mSubId);
|
final PersistableBundle carrierConfig = mCarrierConfigCache.getConfigForSubId(mSubId);
|
||||||
|
final boolean flagHidePrefer3gItem = Flags.hidePrefer3gItem();
|
||||||
mAllowed5gNetworkType = checkSupportedRadioBitmask(
|
mAllowed5gNetworkType = checkSupportedRadioBitmask(
|
||||||
mTelephonyManager.getAllowedNetworkTypesForReason(
|
mTelephonyManager.getAllowedNetworkTypesForReason(
|
||||||
TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_CARRIER),
|
TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_CARRIER),
|
||||||
@@ -256,22 +258,28 @@ public class EnabledNetworkModePreferenceController extends
|
|||||||
CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL);
|
CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL);
|
||||||
mDisplay2gOptions = carrierConfig.getBoolean(
|
mDisplay2gOptions = carrierConfig.getBoolean(
|
||||||
CarrierConfigManager.KEY_PREFER_2G_BOOL);
|
CarrierConfigManager.KEY_PREFER_2G_BOOL);
|
||||||
// TODO: Using the carrier config.
|
|
||||||
mDisplay3gOptions = getResourcesForSubId().getBoolean(
|
|
||||||
R.bool.config_display_network_mode_3g_option);
|
|
||||||
|
|
||||||
int[] carriersWithout3gMenu = getResourcesForSubId().getIntArray(
|
if (flagHidePrefer3gItem) {
|
||||||
R.array.network_mode_3g_deprecated_carrier_id);
|
mDisplay3gOptions = carrierConfig.getBoolean(
|
||||||
if ((carriersWithout3gMenu != null) && (carriersWithout3gMenu.length > 0)) {
|
CarrierConfigManager.KEY_PREFER_3G_VISIBILITY_BOOL);
|
||||||
SubscriptionManager sm = mContext.getSystemService(SubscriptionManager.class);
|
} else {
|
||||||
SubscriptionInfo subInfo = sm.getActiveSubscriptionInfo(mSubId);
|
mDisplay3gOptions = getResourcesForSubId().getBoolean(
|
||||||
if (subInfo != null) {
|
R.bool.config_display_network_mode_3g_option);
|
||||||
int carrierId = subInfo.getCarrierId();
|
|
||||||
|
|
||||||
for (int idx = 0; idx < carriersWithout3gMenu.length; idx++) {
|
int[] carriersWithout3gMenu = getResourcesForSubId().getIntArray(
|
||||||
if (carrierId == carriersWithout3gMenu[idx]) {
|
R.array.network_mode_3g_deprecated_carrier_id);
|
||||||
mDisplay3gOptions = false;
|
if ((carriersWithout3gMenu != null) && (carriersWithout3gMenu.length > 0)) {
|
||||||
break;
|
SubscriptionManager sm = mContext.getSystemService(
|
||||||
|
SubscriptionManager.class);
|
||||||
|
SubscriptionInfo subInfo = sm.getActiveSubscriptionInfo(mSubId);
|
||||||
|
if (subInfo != null) {
|
||||||
|
int carrierId = subInfo.getCarrierId();
|
||||||
|
|
||||||
|
for (int idx = 0; idx < carriersWithout3gMenu.length; idx++) {
|
||||||
|
if (carrierId == carriersWithout3gMenu[idx]) {
|
||||||
|
mDisplay3gOptions = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user