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

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

Merge "Reduce the set_allowed_network_type to one time" into sc-dev am: f215edcb

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/15174854

Change-Id: I678f0bcd15f28486ac869d27146553e6e73cd524
parents cf72c3c6 f215edcb
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -2907,8 +2907,6 @@ public class GsmCdmaPhone extends Phone {
                break;

            case EVENT_CARRIER_CONFIG_CHANGED:
                // Obtain new radio capabilities from the modem, since some are SIM-dependent
                mCi.getRadioCapability(obtainMessage(EVENT_GET_RADIO_CAPABILITY));
                // Only check for the voice radio tech if it not going to be updated by the voice
                // registration changes.
                if (!mContext.getResources().getBoolean(
@@ -2927,7 +2925,8 @@ public class GsmCdmaPhone extends Phone {

                updateNrSettingsAfterCarrierConfigChanged(b);
                loadAllowedNetworksFromSubscriptionDatabase();
                updateAllowedNetworkTypes(null);
                // Obtain new radio capabilities from the modem, since some are SIM-dependent
                mCi.getRadioCapability(obtainMessage(EVENT_GET_RADIO_CAPABILITY));
                break;

            case EVENT_SET_ROAMING_PREFERENCE_DONE:
+10 −4
Original line number Diff line number Diff line
@@ -458,7 +458,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    private static final String ALLOWED_NETWORK_TYPES_TEXT_ENABLE_2G = "enable_2g";
    private static final int INVALID_ALLOWED_NETWORK_TYPES = -1;
    protected boolean mIsCarrierNrSupported = false;

    protected boolean mIsAllowedNetworkTypesLoadedFromDb = false;
    private boolean mUnitTestMode;
    private CarrierPrivilegesTracker mCarrierPrivilegesTracker = null;

@@ -2314,6 +2314,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     * Loads the allowed network type from subscription database.
     */
    public void loadAllowedNetworksFromSubscriptionDatabase() {
        mIsAllowedNetworkTypesLoadedFromDb = false;
        // Try to load ALLOWED_NETWORK_TYPES from SIMINFO.
        if (SubscriptionController.getInstance() == null) {
            return;
@@ -2353,6 +2354,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
                    }
                }
            }
            mIsAllowedNetworkTypesLoadedFromDb = true;
        } catch (NumberFormatException e) {
            Rlog.e(LOG_TAG, "allowedNetworkTypes NumberFormat exception" + e);
        }
@@ -2425,8 +2427,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
            loge("setAllowedNetworkTypes: Invalid allowed network type reason: " + reason);
            return;
        }
        if (!SubscriptionManager.isUsableSubscriptionId(subId)) {
            loge("setAllowedNetworkTypes: Invalid subscriptionId: " + subId);
        if (!SubscriptionManager.isUsableSubscriptionId(subId)
                || !mIsAllowedNetworkTypesLoadedFromDb) {
            loge("setAllowedNetworkTypes: no sim or network type is not loaded. SubscriptionId: "
                    + subId + ", isNetworkTypeLoaded" + mIsAllowedNetworkTypesLoadedFromDb);
            return;
        }
        String mapAsString = "";
@@ -4376,7 +4380,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {

    public void sendSubscriptionSettings(boolean restoreNetworkSelection) {
        // Send settings down
        if (mIsAllowedNetworkTypesLoadedFromDb) {
            updateAllowedNetworkTypes(null);
        }

        if (restoreNetworkSelection) {
            restoreSavedNetworkSelection(null);