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

Commit 2930109e authored by Jordan Liu's avatar Jordan Liu Committed by android-build-merger
Browse files

Merge "SPN/PLMN display rule should consider the carrier configuration"

am: 2200831f

Change-Id: Idd790fb50eee844a43750f9dabeffee43f863133
parents 51f73c21 2200831f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2251,7 +2251,7 @@ public class ServiceStateTracker extends Handler {
            IccRecords iccRecords = mIccRecords;
            String plmn = null;
            boolean showPlmn = false;
            int rule = (iccRecords != null) ? iccRecords.getDisplayRule(mSS.getOperatorNumeric()) : 0;
            int rule = (iccRecords != null) ? iccRecords.getDisplayRule(mSS) : 0;
            if (combinedRegState == ServiceState.STATE_OUT_OF_SERVICE
                    || combinedRegState == ServiceState.STATE_EMERGENCY_ONLY) {
                showPlmn = true;
+10 −3
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.os.Message;
import android.os.Registrant;
import android.os.RegistrantList;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -666,13 +667,19 @@ public abstract class IccRecords extends Handler implements IccConstants {

    /**
     * Returns the SpnDisplayRule based on settings on the SIM and the
     * specified plmn (currently-registered PLMN).  See TS 22.101 Annex A
     * and TS 51.011 10.3.11 for details.
     * current service state. See TS 22.101 Annex A and TS 51.011 10.3.11
     * for details.
     *
     * If the SPN is not found on the SIM, the rule is always PLMN_ONLY.
     * Generally used for GSM/UMTS and the like SIMs.
     *
     * @param serviceState Service state
     * @return the display rule
     *
     * @see #SPN_RULE_SHOW_SPN
     * @see #SPN_RULE_SHOW_PLMN
     */
    public abstract int getDisplayRule(String plmn);
    public abstract int getDisplayRule(ServiceState serviceState);

    /**
     * Return true if "Restriction of menu options for manual PLMN selection"
+2 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.Intent;
import android.os.AsyncResult;
import android.os.Message;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.text.TextUtils;

import com.android.internal.telephony.CommandsInterface;
@@ -457,7 +458,7 @@ public class IsimUiccRecords extends IccRecords implements IsimRecords {
    }

    @Override
    public int getDisplayRule(String plmn) {
    public int getDisplayRule(ServiceState serviceState) {
        // Not applicable to Isim
        return 0;
    }
+2 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.os.AsyncResult;
import android.os.Message;
import android.os.SystemProperties;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
@@ -868,7 +869,7 @@ public class RuimRecords extends IccRecords {
     * No Display rule for RUIMs yet.
     */
    @Override
    public int getDisplayRule(String plmn) {
    public int getDisplayRule(ServiceState serviceState) {
        // TODO together with spn
        return 0;
    }
+28 −4
Original line number Diff line number Diff line
@@ -23,9 +23,11 @@ import android.content.IntentFilter;
import android.content.res.Resources;
import android.os.AsyncResult;
import android.os.Message;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneNumberUtils;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SmsMessage;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
@@ -1844,14 +1846,20 @@ public class SIMRecords extends IccRecords {

    /**
     * Returns the SpnDisplayRule based on settings on the SIM and the
     * specified plmn (currently-registered PLMN).  See TS 22.101 Annex A
     * and TS 51.011 10.3.11 for details.
     * current service state. See TS 22.101 Annex A and TS 51.011 10.3.11
     * for details.
     *
     * If the SPN is not found on the SIM or is empty, the rule is
     * always PLMN_ONLY.
     *
     * @param serviceState Service state
     * @return the display rule
     *
     * @see #SPN_RULE_SHOW_SPN
     * @see #SPN_RULE_SHOW_PLMN
     */
    @Override
    public int getDisplayRule(String plmn) {
    public int getDisplayRule(ServiceState serviceState) {
        int rule;

        if (mParentApp != null && mParentApp.getUiccCard() != null &&
@@ -1861,7 +1869,8 @@ public class SIMRecords extends IccRecords {
        } else if (TextUtils.isEmpty(getServiceProviderName()) || mSpnDisplayCondition == -1) {
            // No EF_SPN content was found on the SIM, or not yet loaded.  Just show ONS.
            rule = SPN_RULE_SHOW_PLMN;
        } else if (isOnMatchingPlmn(plmn)) {
        } else if (useRoamingFromServiceState() ? !serviceState.getRoaming()
                : isOnMatchingPlmn(serviceState.getOperatorNumeric())) {
            rule = SPN_RULE_SHOW_SPN;
            if ((mSpnDisplayCondition & 0x01) == 0x01) {
                // ONS required when registered to HPLMN or PLMN in EF_SPDI
@@ -1877,6 +1886,21 @@ public class SIMRecords extends IccRecords {
        return rule;
    }

    private boolean useRoamingFromServiceState() {
        CarrierConfigManager configManager = (CarrierConfigManager)
                mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
        if (configManager != null) {
            PersistableBundle b = configManager.getConfigForSubId(
                    SubscriptionController.getInstance().getSubIdUsingPhoneId(
                    mParentApp.getPhoneId()));
            if (b != null && b.getBoolean(CarrierConfigManager
                    .KEY_SPN_DISPLAY_RULE_USE_ROAMING_FROM_SERVICE_STATE_BOOL)) {
                return true;
            }
        }
        return false;
    }

    /**
     * Checks if plmn is HPLMN or on the spdiNetworks list.
     */
Loading