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

Commit def1ab5a authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Telephony: Disable manual network selection in Global modes"

parents ab21d428 a90b55a5
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1824,6 +1824,12 @@ public interface Phone {
     */
    boolean isCspPlmnEnabled();

    /* Checks if manual network selection is allowed
     * @return true if manual network selection is allowed
     * @return false if manual network selection is not allowed
     */
    public boolean isManualNetSelAllowed();

    /**
     * Return an interface to retrieve the ISIM records for IMS, if available.
     * @return the interface to retrieve the ISIM records, or null if not supported
+9 −0
Original line number Diff line number Diff line
@@ -183,6 +183,9 @@ public abstract class PhoneBase extends Handler implements Phone {
    // Key used to read/write "disable DNS server check" pref (used for testing)
    public static final String DNS_SERVER_CHECK_DISABLED_KEY = "dns_server_check_disabled_key";

   //Telephony System Property used to indicate a multimode target
    public static final String PROPERTY_MULTIMODE_CDMA = "ro.config.multimode_cdma";

    /**
     * Small container class used to hold information relevant to
     * the carrier selection process. operatorNumeric can be ""
@@ -1767,6 +1770,12 @@ public abstract class PhoneBase extends Handler implements Phone {
        }
    }

    public boolean isManualNetSelAllowed() {
        // This function should be overridden in GsmPhone.
        // Not implemented by default.
        return false;
    }

    @Override
    public boolean isCspPlmnEnabled() {
        // This function should be overridden by the class GSMPhone.
+4 −0
Original line number Diff line number Diff line
@@ -1244,6 +1244,10 @@ public class PhoneProxy extends Handler implements Phone {
        mActivePhone.unsetOnEcbModeExitResponse(h);
    }

    public boolean isManualNetSelAllowed() {
        return mActivePhone.isManualNetSelAllowed();
    }

    @Override
    public boolean isCspPlmnEnabled() {
        return mActivePhone.isCspPlmnEnabled();
+34 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import com.android.internal.telephony.Connection;
import com.android.internal.telephony.IccPhoneBookInterfaceManager;
import com.android.internal.telephony.MccTable;
import com.android.internal.telephony.MmiCode;
import com.android.internal.telephony.OperatorInfo;
import com.android.internal.telephony.PhoneBase;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneNotifier;
@@ -508,6 +509,20 @@ public class CDMAPhone extends PhoneBase {
                .isAlive());
    }

    @Override
    public void
    setNetworkSelectionModeAutomatic(Message response) {
        Rlog.e(LOG_TAG, "method setNetworkSelectionModeAutomatic is NOT supported in CDMA!");
        if (response != null) {
            Rlog.e(LOG_TAG,
                    "setNetworkSelectionModeAutomatic: not possible in CDMA- Posting exception");
            CommandException ce = new CommandException(
                    CommandException.Error.REQUEST_NOT_SUPPORTED);
            AsyncResult.forMessage(response).exception = ce;
            response.sendToTarget();
        }
    }

    @Override
    public void unregisterForSuppServiceNotification(Handler h) {
        Rlog.e(LOG_TAG, "method unregisterForSuppServiceNotification is NOT supported in CDMA!");
@@ -664,6 +679,19 @@ public class CDMAPhone extends PhoneBase {
        return mCT.mForegroundCall;
    }

    @Override
    public void
    selectNetworkManually(OperatorInfo network,
            Message response) {
        Rlog.e(LOG_TAG, "selectNetworkManually: not possible in CDMA");
        if (response != null) {
            CommandException ce = new CommandException(
                    CommandException.Error.REQUEST_NOT_SUPPORTED);
            AsyncResult.forMessage(response).exception = ce;
            response.sendToTarget();
        }
    }

    @Override
    public void setOnPostDialCharacter(Handler h, int what, Object obj) {
        mPostDialHandler = new Registrant(h, what, obj);
@@ -879,6 +907,12 @@ public class CDMAPhone extends PhoneBase {
    @Override
    public void getAvailableNetworks(Message response) {
        Rlog.e(LOG_TAG, "getAvailableNetworks: not possible in CDMA");
        if (response != null) {
            CommandException ce = new CommandException(
                    CommandException.Error.REQUEST_NOT_SUPPORTED);
            AsyncResult.forMessage(response).exception = ce;
            response.sendToTarget();
        }
    }

    @Override
+29 −1
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ import com.android.internal.telephony.MmiCode;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneBase;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.PhoneNotifier;
import com.android.internal.telephony.PhoneProxy;
import com.android.internal.telephony.PhoneSubInfo;
@@ -127,7 +128,6 @@ public class GSMPhone extends PhoneBase {
    protected SimPhoneBookInterfaceManager mSimPhoneBookIntManager;
    PhoneSubInfo mSubInfo;


    Registrant mPostDialHandler;

    /** List of Registrants to receive Supplementary Service Notifications. */
@@ -1941,6 +1941,34 @@ public class GSMPhone extends PhoneBase {
        return (r != null) ? r.isCspPlmnEnabled() : false;
    }

    public boolean isManualNetSelAllowed() {

        int nwMode = Phone.PREFERRED_NT_MODE;

        nwMode = PhoneFactory.calculatePreferredNetworkType(mContext, mPhoneId);

        Rlog.d(LOG_TAG, "isManualNetSelAllowed in mode = " + nwMode);
        /*
         *  For multimode targets in global mode manual network
         *  selection is disallowed
         */
        if (SystemProperties.getBoolean(PhoneBase.PROPERTY_MULTIMODE_CDMA, false)
                && ((nwMode == Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA)
                        || (nwMode == Phone.NT_MODE_GLOBAL)) ){
            Rlog.d(LOG_TAG, "Manual selection not supported in mode = " + nwMode);
            return false;
        }

        /*
         *  Single mode phone with - GSM network modes/global mode
         *  LTE only for 3GPP
         *  LTE centric + 3GPP Legacy
         *  Note: the actual enabling/disabling manual selection for these
         *  cases will be controlled by csp
         */
        return true;
    }

    private void registerForSimRecordEvents() {
        IccRecords r = mIccRecords.get();
        if (r == null) {
Loading