Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19dbb00a authored by SongFerng Wang's avatar SongFerng Wang Committed by Android (Google) Code Review
Browse files

Merge "Using carrier config for hiding 3G item at preferred network mode" into main

parents 87f76d1c ce45ac01
Loading
Loading
Loading
Loading
+24 −16
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;

import com.android.settings.R;
import com.android.internal.telephony.flags.Flags;
import com.android.settings.network.AllowedNetworkTypesListener;
import com.android.settings.network.CarrierConfigCache;
import com.android.settings.network.SubscriptionsChangeListener;
@@ -241,6 +242,7 @@ public class EnabledNetworkModePreferenceController extends
        public void updateConfig() {
            mTelephonyManager = mTelephonyManager.createForSubscriptionId(mSubId);
            final PersistableBundle carrierConfig = mCarrierConfigCache.getConfigForSubId(mSubId);
            final boolean flagHidePrefer3gItem = Flags.hidePrefer3gItem();
            mAllowed5gNetworkType = checkSupportedRadioBitmask(
                    mTelephonyManager.getAllowedNetworkTypesForReason(
                            TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_CARRIER),
@@ -256,14 +258,19 @@ public class EnabledNetworkModePreferenceController extends
                        CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL);
                mDisplay2gOptions = carrierConfig.getBoolean(
                        CarrierConfigManager.KEY_PREFER_2G_BOOL);
                // TODO: Using the carrier config.

                if (flagHidePrefer3gItem) {
                    mDisplay3gOptions = carrierConfig.getBoolean(
                        CarrierConfigManager.KEY_PREFER_3G_VISIBILITY_BOOL);
                } else {
                    mDisplay3gOptions = getResourcesForSubId().getBoolean(
                            R.bool.config_display_network_mode_3g_option);

                    int[] carriersWithout3gMenu = getResourcesForSubId().getIntArray(
                            R.array.network_mode_3g_deprecated_carrier_id);
                    if ((carriersWithout3gMenu != null) && (carriersWithout3gMenu.length > 0)) {
                    SubscriptionManager sm = mContext.getSystemService(SubscriptionManager.class);
                        SubscriptionManager sm = mContext.getSystemService(
                                SubscriptionManager.class);
                        SubscriptionInfo subInfo = sm.getActiveSubscriptionInfo(mSubId);
                        if (subInfo != null) {
                            int carrierId = subInfo.getCarrierId();
@@ -276,6 +283,7 @@ public class EnabledNetworkModePreferenceController extends
                            }
                        }
                    }
                }

                mLteEnabled = carrierConfig.getBoolean(CarrierConfigManager.KEY_LTE_ENABLED_BOOL);
            }