Android 8.1 설정 에서 선 호 하 는 네트워크 유형 은 LTE 가 없습니다.

60616 단어 android
플랫폼
RK3399 + Android 8.1
질문:
설정 > 더 많은 > 모 바 일 네트워크 > 첫 번 째 네트워크 형식 옵션 은 3G 와 2G 만 표시 되 고 LTE 가 부족 하 며 자체 모듈 과 SIM 카드 는 LTE 를 지원 합 니 다.
관련 코드:
|-- packages/services/Telephony/res/xml/network_setting_fragment.xml


<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
        android:title="@string/mobile_networks">

    <PreferenceScreen
        android:key="cdma_lte_data_service_key"
        android:title="@string/cdma_lte_data_service">
    PreferenceScreen>

    <com.android.phone.MobileDataPreference
        android:key="mobile_data_enable"
        android:title="@string/mobile_data_settings_title"
        android:summary="@string/mobile_data_settings_summary"/>

    <com.android.phone.RestrictedSwitchPreference
        android:key="button_roaming_key"
        android:title="@string/roaming"
        android:persistent="false"
        android:summaryOn="@string/roaming_enable"
        android:summaryOff="@string/roaming_disable"/>

    <com.android.phone.DataUsagePreference
        android:key="data_usage_summary"
        android:title="@string/data_usage_title" />

    <com.android.phone.AdvancedOptionsPreference
        android:key="advanced_options"/>

    <SwitchPreference
        android:key="enhanced_4g_lte"
        android:title="@string/enhanced_4g_lte_mode_title"
        android:persistent="false"
        android:summary="@string/enhanced_4g_lte_mode_summary"/>

    <ListPreference
        android:key="preferred_network_mode_key"
        android:title="@string/preferred_network_mode_title"
        android:summary="@string/preferred_network_mode_summary"
        android:entries="@array/preferred_network_mode_choices"
        android:entryValues="@array/preferred_network_mode_values"
        android:dialogTitle="@string/preferred_network_mode_dialogtitle" />

    <ListPreference
        android:key="enabled_networks_key"
        android:title="@string/preferred_network_mode_title"
        android:summary="@string/preferred_network_mode_summary"
        android:entries="@array/enabled_networks_choices"
        android:entryValues="@array/enabled_networks_values"
        android:dialogTitle="@string/preferred_network_mode_dialogtitle" />

    <Preference
        android:key="carrier_settings_euicc_key"
        android:title="@string/carrier_settings_euicc" />

    <PreferenceCategory
        android:key="calling"
        android:title="@string/call_category">

        <PreferenceScreen
            android:key="wifi_calling_key"
            android:title="@string/wifi_calling_settings_title">

            <intent android:action="android.intent.action.MAIN"
                    android:targetPackage="com.android.settings"
                    android:targetClass="com.android.settings.Settings$WifiCallingSettingsActivity">
                        <extra android:name="show_drawer_menu" android:value="true" />
            intent>

        PreferenceScreen>

        <SwitchPreference
            android:key="video_calling_key"
            android:title="@string/video_calling_settings_title"
            android:persistent="true"/>

    PreferenceCategory>

PreferenceScreen>


|-- packages/services/Telephony/src/com/android/phone/MobileNetworkSettings.java
public class MobileNetworkSettings extends Activity  {

    public static class MobileNetworkFragment extends PreferenceFragment implements
            Preference.OnPreferenceChangeListener, RoamingDialogFragment.RoamingDialogListener {
        private static final String BUTTON_PREFERED_NETWORK_MODE = "preferred_network_mode_key";
        @Override
        public void onCreate(Bundle icicle) {
            Log.i(LOG_TAG, "onCreate:+");
            super.onCreate(icicle);
			...
//     
            addPreferencesFromResource(R.xml.network_setting_fragment);
            mButtonPreferredNetworkMode = (ListPreference) prefSet.findPreference(
                    BUTTON_PREFERED_NETWORK_MODE);
		}

	    private void updateBodyAdvancedFields(Activity activity, PreferenceScreen prefSet,
                int phoneSubId, boolean hasActiveSubscriptions) {
            boolean isLteOnCdma = mPhone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE;

            if (DBG) {
                log("updateBody: isLteOnCdma=" + isLteOnCdma + " phoneSubId=" + phoneSubId);
            }

            prefSet.addPreference(mButtonPreferredNetworkMode);
            prefSet.addPreference(mButtonEnabledNetworks);
            prefSet.addPreference(mButton4glte);

            if (showEuiccSettings(getActivity())) {
                prefSet.addPreference(mEuiccSettingsPref);
                String spn = mTelephonyManager.getSimOperatorName();
                if (TextUtils.isEmpty(spn)) {
                    mEuiccSettingsPref.setSummary(null);
                } else {
                    mEuiccSettingsPref.setSummary(spn);
                }
            }

            int settingsNetworkMode = android.provider.Settings.Global.getInt(
                    mPhone.getContext().getContentResolver(),
                    android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
                    preferredNetworkMode);

            PersistableBundle carrierConfig =
                    PhoneGlobals.getInstance().getCarrierConfigForSubId(mPhone.getSubId());
            mIsGlobalCdma = isLteOnCdma
                    && carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_CDMA_CHOICES_BOOL);
            if (carrierConfig.getBoolean(
                    CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL)) {
                prefSet.removePreference(mButtonPreferredNetworkMode);
                prefSet.removePreference(mButtonEnabledNetworks);
                prefSet.removePreference(mLteDataServicePref);
            } else if (carrierConfig.getBoolean(CarrierConfigManager
                    .KEY_HIDE_PREFERRED_NETWORK_TYPE_BOOL)
                    && !mPhone.getServiceState().getRoaming()
                    && mPhone.getServiceState().getDataRegState()
                    == ServiceState.STATE_IN_SERVICE) {
                prefSet.removePreference(mButtonPreferredNetworkMode);
                prefSet.removePreference(mButtonEnabledNetworks);

                final int phoneType = mPhone.getPhoneType();
                if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
                    updateCdmaOptions(this, prefSet, mPhone);
                } else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
                    updateGsmUmtsOptions(this, prefSet, phoneSubId, mNetworkQueryService);
                } else {
                    throw new IllegalStateException("Unexpected phone type: " + phoneType);
                }
                // Since pref is being hidden from user, set network mode to default
                // in case it is currently something else. That is possible if user
                // changed the setting while roaming and is now back to home network.
                settingsNetworkMode = preferredNetworkMode;
            } else if (carrierConfig.getBoolean(
                    CarrierConfigManager.KEY_WORLD_PHONE_BOOL) == true) {
                prefSet.removePreference(mButtonEnabledNetworks);
                // set the listener for the mButtonPreferredNetworkMode list preference so we can issue
                // change Preferred Network Mode.
                mButtonPreferredNetworkMode.setOnPreferenceChangeListener(this);

                updateCdmaOptions(this, prefSet, mPhone);
                updateGsmUmtsOptions(this, prefSet, phoneSubId, mNetworkQueryService);
            } else {
                prefSet.removePreference(mButtonPreferredNetworkMode);
                final int phoneType = mPhone.getPhoneType();
                if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
                    int lteForced = android.provider.Settings.Global.getInt(
                            mPhone.getContext().getContentResolver(),
                            android.provider.Settings.Global.LTE_SERVICE_FORCED + mPhone.getSubId(),
                            0);

                    if (isLteOnCdma) {
                        if (lteForced == 0) {
                            mButtonEnabledNetworks.setEntries(
                                    R.array.enabled_networks_cdma_choices);
                            mButtonEnabledNetworks.setEntryValues(
                                    R.array.enabled_networks_cdma_values);
                        } else {
                            switch (settingsNetworkMode) {
                                case Phone.NT_MODE_CDMA:
                                case Phone.NT_MODE_CDMA_NO_EVDO:
                                case Phone.NT_MODE_EVDO_NO_CDMA:
                                    mButtonEnabledNetworks.setEntries(
                                            R.array.enabled_networks_cdma_no_lte_choices);
                                    mButtonEnabledNetworks.setEntryValues(
                                            R.array.enabled_networks_cdma_no_lte_values);
                                    break;
                                case Phone.NT_MODE_GLOBAL:
                                case Phone.NT_MODE_LTE_CDMA_AND_EVDO:
                                case Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA:
                                case Phone.NT_MODE_LTE_ONLY:
                                    mButtonEnabledNetworks.setEntries(
                                            R.array.enabled_networks_cdma_only_lte_choices);
                                    mButtonEnabledNetworks.setEntryValues(
                                            R.array.enabled_networks_cdma_only_lte_values);
                                    break;
                                default:
                                    mButtonEnabledNetworks.setEntries(
                                            R.array.enabled_networks_cdma_choices);
                                    mButtonEnabledNetworks.setEntryValues(
                                            R.array.enabled_networks_cdma_values);
                                    break;
                            }
                        }
                    }
                    updateCdmaOptions(this, prefSet, mPhone);

                } else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
                    if (isSupportTdscdma()) {
                        mButtonEnabledNetworks.setEntries(
                                R.array.enabled_networks_tdscdma_choices);
                        mButtonEnabledNetworks.setEntryValues(
                                R.array.enabled_networks_tdscdma_values);
                    } else if (!carrierConfig.getBoolean(CarrierConfigManager.KEY_PREFER_2G_BOOL)
                            && !getResources().getBoolean(R.bool.config_enabled_lte)) {
                        mButtonEnabledNetworks.setEntries(
                                R.array.enabled_networks_except_gsm_lte_choices);
                        mButtonEnabledNetworks.setEntryValues(
                                R.array.enabled_networks_except_gsm_lte_values);
                    } else if (!carrierConfig.getBoolean(CarrierConfigManager.KEY_PREFER_2G_BOOL)) {
                        int select = (mShow4GForLTE == true) ?
                                R.array.enabled_networks_except_gsm_4g_choices
                                : R.array.enabled_networks_except_gsm_choices;
                        mButtonEnabledNetworks.setEntries(select);
                        mButtonEnabledNetworks.setEntryValues(
                                R.array.enabled_networks_except_gsm_values);
                    } else if (!getResources().getBoolean(R.bool.config_enabled_lte)) {
//     
                        mButtonEnabledNetworks.setEntries(
                                R.array.enabled_networks_except_lte_choices);
                        mButtonEnabledNetworks.setEntryValues(
                                R.array.enabled_networks_except_lte_values);
                    } else if (mIsGlobalCdma) {
                        mButtonEnabledNetworks.setEntries(
                                R.array.enabled_networks_cdma_choices);
                        mButtonEnabledNetworks.setEntryValues(
                                R.array.enabled_networks_cdma_values);
                    } else {
                        int select = (mShow4GForLTE == true) ? R.array.enabled_networks_4g_choices
                                : R.array.enabled_networks_choices;
                        mButtonEnabledNetworks.setEntries(select);
                        mButtonEnabledNetworks.setEntryValues(
                                R.array.enabled_networks_values);
                    }
                    updateGsmUmtsOptions(this, prefSet, phoneSubId, mNetworkQueryService);
                } else {
                    throw new IllegalStateException("Unexpected phone type: " + phoneType);
                }
                if (isWorldMode()) {
                    mButtonEnabledNetworks.setEntries(
                            R.array.preferred_network_mode_choices_world_mode);
                    mButtonEnabledNetworks.setEntryValues(
                            R.array.preferred_network_mode_values_world_mode);
                }
                mButtonEnabledNetworks.setOnPreferenceChangeListener(this);
                if (DBG) log("settingsNetworkMode: " + settingsNetworkMode);
            }

|-- packages/services/Telephony/res/values/strings.xml
    <string-array name="enabled_networks_except_lte_choices" translatable="false">
        <item>@string/network_3Gitem>
        <item>@string/network_2Gitem>
    string-array>

config_enabled_lt 의 값 은: | -- packages / services / Telephony / res / values / config. xml 입 니 다.
<bool name="config_enabled_lte" translatable="false">falsebool>

기 존 코드 (이하 RK 3288 Android 7.1) 에서 이 값 은 true: | -- device / rockchip / common / overlay / packages / services / Telephony / res / values / config. xml 입 니 다.
<bool name="config_enabled_lte" translatable="false">truebool>

따라서 configenabled_lt 의 값 을 true 로 바 꾸 면 LTE 를 표시 할 수 있 습 니 다.

좋은 웹페이지 즐겨찾기