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

Commit 06602c9c authored by Xiangyu/Malcolm Chen's avatar Xiangyu/Malcolm Chen Committed by android-build-merger
Browse files

Merge "Check SIM valid before forcing network auto select" into oc-dr1-dev

am: 1cc0f110

Change-Id: Iceb3581d4ef16790e63982f570797a1e047ca2ca
parents 99b9f9cc 1cc0f110
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
@@ -2721,26 +2721,35 @@ public class GsmCdmaPhone extends Phone {
        return (r != null) ? r.isCspPlmnEnabled() : false;
    }

    public boolean isManualNetSelAllowed() {
    /**
     * Whether manual select is now allowed and we should set
     * to auto network select mode.
     */
    public boolean shouldForceAutoNetworkSelect() {

        int nwMode = Phone.PREFERRED_NT_MODE;
        int subId = getSubId();

        // If it's invalid subId, we shouldn't force to auto network select mode.
        if (!SubscriptionManager.isValidSubscriptionId(subId)) {
            return false;
        }

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

        logd("isManualNetSelAllowed in mode = " + nwMode);
        logd("shouldForceAutoNetworkSelect in mode = " + nwMode);
        /*
         *  For multimode targets in global mode manual network
         *  selection is disallowed
         *  selection is disallowed. So we should force auto select mode.
         */
        if (isManualSelProhibitedInGlobalMode()
                && ((nwMode == Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA)
                        || (nwMode == Phone.NT_MODE_GLOBAL)) ){
            logd("Manual selection not supported in mode = " + nwMode);
            return false;
            logd("Should force auto network select mode = " + nwMode);
            return true;
        } else {
            logd("Manual selection is supported in mode = " + nwMode);
            logd("Should not force auto network select mode = " + nwMode);
        }

        /*
@@ -2750,7 +2759,7 @@ public class GsmCdmaPhone extends Phone {
         *  Note: the actual enabling/disabling manual selection for these
         *  cases will be controlled by csp
         */
        return true;
        return false;
    }

    private boolean isManualSelProhibitedInGlobalMode() {
+1 −1
Original line number Diff line number Diff line
@@ -2003,7 +2003,7 @@ public class ServiceStateTracker extends Handler {
            case EVENT_POLL_STATE_NETWORK_SELECTION_MODE: {
                ints = (int[])ar.result;
                mNewSS.setIsManualSelection(ints[0] == 1);
                if ((ints[0] == 1) && (!mPhone.isManualNetSelAllowed())) {
                if ((ints[0] == 1) && (mPhone.shouldForceAutoNetworkSelect())) {
                        /*
                         * modem is currently in manual selection but manual
                         * selection is not allowed in the current mode so