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

Commit d427c0d2 authored by SongFerng Wang's avatar SongFerng Wang Committed by Automerger Merge Worker
Browse files

Merge "[Settings] Customizable resource for hiding 3G preferred network type"...

Merge "[Settings] Customizable resource for hiding 3G preferred network type" into tm-qpr-dev am: 2b3cbfff

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/21551540



Change-Id: I30a31add9ce0d6c8493edf162b57d80b03e4ef5d
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f3012c64 2b3cbfff
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1654,4 +1654,9 @@
         [CHAR LIMIT=NONE] -->
    <string-array name="allowlist_hide_summary_in_battery_usage" translatable="false">
    </string-array>

    <!-- hide 3G option from preferred network type UI -->
    <integer-array name="network_mode_3g_deprecated_carrier_id" translatable="false">
    </integer-array>

</resources>
+19 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
import android.content.Context;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyCallback;
import android.telephony.TelephonyManager;
@@ -239,6 +240,24 @@ public class EnabledNetworkModePreferenceController extends
                // TODO: Using the carrier config.
                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);
                    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;
                            }
                        }
                    }
                }

                mLteEnabled = carrierConfig.getBoolean(CarrierConfigManager.KEY_LTE_ENABLED_BOOL);
            }
            Log.d(LOG_TAG, "PreferenceEntriesBuilder: subId" + mSubId