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

Commit 510bd6ca authored by Uma Maheswari Ramalingam's avatar Uma Maheswari Ramalingam Committed by Linux Build Service Account
Browse files

Telephony: Disable manual network selection in Global modes

For multimode targets disable manual network selection
and force automatic mode network selection
in Global and Global+LTE modes.
Global Pre-FIT Test Cases: 5.6.4, 5.6.5, 5.6.8

Display error message for network search in Cdma
CRs-Fixed: 301939, 302354, 290268

Change-Id: I2a9528d1b5eeb9e7f22aeecaafb42bc8b6ed01e1
parent c7b5d1fd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1784,6 +1784,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
@@ -137,6 +137,9 @@ public abstract class PhoneBase extends Handler implements Phone {
    // Key used to read/write the ID for storing the voice mail
    public static final String VM_ID = "vm_id_key";

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

    /* Instance Variables */
    public CommandsInterface mCi;
    private int mVmCount = 0;
@@ -1311,6 +1314,12 @@ public abstract class PhoneBase extends Handler implements Phone {
        }
    }

    public boolean isManualNetSelAllowed() {
        // This function should be overridden in GsmPhone.
        // Not implemented in CdmaPhone and SIPPhone.
        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
@@ -1168,6 +1168,10 @@ public class PhoneProxy extends Handler implements Phone {
        mActivePhone.unsetOnEcbModeExitResponse(h);
    }

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

    @Override
    public boolean isCspPlmnEnabled() {
        return mActivePhone.isCspPlmnEnabled();
+20 −0
Original line number Diff line number Diff line
@@ -408,6 +408,14 @@ public class CDMAPhone extends PhoneBase {
    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
@@ -529,6 +537,12 @@ public class CDMAPhone extends PhoneBase {
    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
@@ -746,6 +760,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
+31 −1
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ import android.os.Registrant;
import android.os.RegistrantList;
import android.os.SystemProperties;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.provider.Settings.Secure;
import android.provider.Telephony;
import android.telephony.CellLocation;
import android.telephony.PhoneNumberUtils;
@@ -109,7 +111,6 @@ public class GSMPhone extends PhoneBase {
    SimPhoneBookInterfaceManager mSimPhoneBookIntManager;
    PhoneSubInfo mSubInfo;


    Registrant mPostDialHandler;

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

    public boolean isManualNetSelAllowed() {

        int nwMode = Phone.PREFERRED_NT_MODE;

        nwMode = android.provider.Settings.Secure.getInt(mContext.getContentResolver(),
                    android.provider.Settings.Global.PREFERRED_NETWORK_MODE, nwMode);

        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_CMDA_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