首选网络类型的默认3G/2G修改

frameworks\opt\telephony\src\java\com\sprd\internal\telephony\uicc\RadioTaskManager.java

    public void setInternalPreferredNetworkTypeForPhone(int phoneId, int networkType) {
        Log.d(LOG_TAG, "setExtendedPreferredNetworkTypeForPhone[" + phoneId + "]: " + networkType);
        if (!SimManager.isValidPhoneId(phoneId)
                || phoneId != mTelephonyManager.getPrimaryCard()
                && !mTelephonyManager.isDualLteModem()
                && !mTelephonyManager.isLteWcdmaModem()) {
            return;
        }

        savePreferredNetworkType(networkType, phoneId);
        updateRadioFeatures(phoneId);

        //SPRD: Bug 557453,continuously set preferred network type and task was removed
        Task task = new Task(Event.MANUAL_NETWORK_MODE, phoneId, networkType);
        addTask(task);
    }

在updateRadioFeatures()函数中跟踪调试代码走的

radioCap == RadioCapbility.FDD_CSFB

所以我们修改

mRadioFeatures[i] = RadioFeatures.WCDMA_AND_GSM //TD_LTE_AND_LTE_FDD_AND_W_AND_GSM_CSFB;

            } else {
                if (i == mTelephonyManager.getPrimaryCard()) {
                    if(networkType >0 && TelephonyManager.isDeviceSupportLte()) {
                        mRadioFeatures[i] = getRadioFeatureByNetworkType(networkType);
                    } else {
                        if (radioCap == RadioCapbility.CSFB) {
                            mRadioFeatures[i] = RadioFeatures.TD_LTE_AND_LTE_FDD_AND_GSM;
                        } else if (radioCap == RadioCapbility.TDD_CSFB) {
                            mRadioFeatures[i] = RadioFeatures.TD_LTE_AND_LTE_FDD_AND_TD_AND_GSM_CSFB;
                        } else if (radioCap == RadioCapbility.FDD_CSFB) {
                            mRadioFeatures[i] = RadioFeatures.TD_LTE_AND_LTE_FDD_AND_W_AND_GSM_CSFB;
                        }

                        if (mModemTLLF) {
                            mRadioFeatures[i] = RadioFeatures.TD_LTE_AND_LTE_FDD;
                        }
                        networkType = resetNetworkType(primaryCard);
                        savePreferredNetworkType(networkType, i);
                    }
                } else {

 

你可能感兴趣的:(首选网络类型的默认3G/2G修改)