Loading src/java/com/android/internal/telephony/data/DataConfigManager.java +10 −45 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.internal.telephony.data; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.StringDef; import android.content.BroadcastReceiver; import android.content.Context; Loading @@ -43,7 +42,6 @@ import android.telephony.data.ApnSetting; import android.text.TextUtils; import android.util.IndentingPrintWriter; import com.android.internal.R; import com.android.internal.telephony.Phone; import com.android.internal.telephony.data.DataNetworkController.HandoverRule; import com.android.internal.telephony.data.DataRetryManager.DataHandoverRetryRule; Loading Loading @@ -219,9 +217,6 @@ public class DataConfigManager extends Handler { /** A map of network types to the downlink and uplink bandwidth values for that network type */ private @NonNull final @DataConfigNetworkType Map<String, DataNetwork.NetworkBandwidth> mBandwidthMap = new ConcurrentHashMap<>(); /** A map of network types to the TCP buffer sizes for that network type */ private @NonNull final @DataConfigNetworkType Map<String, String> mTcpBufferSizeMap = new ConcurrentHashMap<>(); /** Rules for handover between IWLAN and cellular network. */ private @NonNull final List<HandoverRule> mHandoverRuleList = new ArrayList<>(); Loading Loading @@ -298,7 +293,6 @@ public class DataConfigManager extends Handler { updateSingleDataNetworkTypeList(); updateUnmeteredNetworkTypes(); updateBandwidths(); updateTcpBuffers(); updateHandoverRules(); log("Data config updated. Config is " + (isConfigCarrierSpecific() ? "" : "not ") Loading Loading @@ -605,46 +599,19 @@ public class DataConfigManager extends Handler { return mCarrierConfig.getInt(CarrierConfigManager.KEY_DEFAULT_MTU_INT); } /** * Update the TCP buffer sizes from the carrier config. */ private void updateTcpBuffers() { synchronized (this) { mTcpBufferSizeMap.clear(); String[] buffers = mCarrierConfig.getStringArray( CarrierConfigManager.KEY_TCP_BUFFERS_STRING_ARRAY); if (buffers != null) { for (String buffer : buffers) { // split[0] = network type as string // split[1] = rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max String[] split = buffer.split(":"); if (split.length != 2) { loge("Invalid TCP buffer sizes: " + buffer); continue; } if (split[1].split(",").length != 6) { loge("Invalid TCP buffer sizes for " + split[0] + ": " + split[1]); continue; } mTcpBufferSizeMap.put(split[0], split[1]); } } } } /** * Get the TCP config string, used by {@link LinkProperties#setTcpBufferSizes(String)}. * The config string will have the following form, with values in bytes: * "read_min,read_default,read_max,write_min,write_default,write_max" * * @param networkType The network type. Note that {@link TelephonyManager#NETWORK_TYPE_LTE_CA} * can be used for LTE CA even though it's not a radio access technology. * @param serviceState The service state, used to determine NR state. * @return The TCP configuration string for the given network type or null if unavailable. * Note that starting from Android 13, the TCP buffer size is fixed after boot up, and should * never be changed based on carriers or the network types. The value should be configured * appropriately based on the device's memory and performance. * * @return The TCP configuration string. */ public @Nullable String getTcpConfigString(@NetworkType int networkType, @NonNull ServiceState serviceState) { return mTcpBufferSizeMap.get(getDataConfigNetworkType(networkType, serviceState)); public @NonNull String getTcpConfigString() { return mResources.getString(com.android.internal.R.string.config_tcp_buffers); } /** Loading @@ -652,7 +619,8 @@ public class DataConfigManager extends Handler { * does not complete within the window, the data network will be torn down after timeout. */ public long getImsDeregistrationDelay() { return mResources.getInteger(R.integer.config_delay_for_ims_dereg_millis); return mResources.getInteger( com.android.internal.R.integer.config_delay_for_ims_dereg_millis); } /** Loading Loading @@ -903,10 +871,7 @@ public class DataConfigManager extends Handler { + shouldResetDataThrottlingWhenTacChanges()); pw.println("Data service package name=" + getDataServicePackageName()); pw.println("Default MTU=" + getDefaultMtu()); pw.println("TCP buffer sizes:"); pw.increaseIndent(); mTcpBufferSizeMap.forEach((key, value) -> pw.println(key + ":" + value)); pw.decreaseIndent(); pw.println("TCP buffer sizes:" + getTcpConfigString()); pw.println("getImsDeregistrationDelay=" + getImsDeregistrationDelay()); pw.println("shouldPersistIwlanDataNetworksWhenDataServiceRestarted=" + shouldPersistIwlanDataNetworksWhenDataServiceRestarted()); Loading src/java/com/android/internal/telephony/data/DataNetwork.java +1 −45 Original line number Diff line number Diff line Loading @@ -404,9 +404,6 @@ public class DataNetwork extends StateMachine { /** The network bandwidth. */ private @NonNull NetworkBandwidth mNetworkBandwidth = new NetworkBandwidth(14, 14); /** The TCP buffer sizes config. */ private @Nullable String mTcpBufferSizes = ""; /** Whether {@link NetworkCapabilities#NET_CAPABILITY_TEMPORARILY_NOT_METERED} is supported. */ private boolean mTempNotMeteredSupported = false; Loading Loading @@ -756,7 +753,6 @@ public class DataNetwork extends StateMachine { // TODO: Should update suspend state when CSS indicator changes. // TODO: Should update suspend state when call started/ended. updateSuspendState(); updateTcpBufferSizes(); updateBandwidthFromDataConfig(); break; } Loading Loading @@ -1489,7 +1485,7 @@ public class DataNetwork extends StateMachine { linkProperties.setHttpProxy(proxy); } linkProperties.setTcpBufferSizes(mTcpBufferSizes); linkProperties.setTcpBufferSizes(mDataConfigManager.getTcpConfigString()); mNetworkSliceInfo = response.getSliceInfo(); Loading @@ -1515,28 +1511,6 @@ public class DataNetwork extends StateMachine { mCid.get(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)); } /** * Get the TCP config string. * * @return The TCP config string used in {@link LinkProperties#setTcpBufferSizes(String)}. */ private @Nullable String getTcpConfig() { ServiceState ss = mPhone.getServiceState(); NetworkRegistrationInfo nrs = ss.getNetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, mTransport); int networkType = TelephonyManager.NETWORK_TYPE_UNKNOWN; if (nrs != null) { networkType = nrs.getAccessNetworkTechnology(); if (networkType == TelephonyManager.NETWORK_TYPE_LTE && nrs.isUsingCarrierAggregation()) { // Although LTE_CA is not a real RAT, but since LTE CA generally has higher speed // we use LTE_CA to get a different TCP config for LTE CA. networkType = TelephonyManager.NETWORK_TYPE_LTE_CA; } } return mDataConfigManager.getTcpConfigString(networkType, ss); } /** * Called when receiving setup data network response from the data service. * Loading Loading @@ -1695,7 +1669,6 @@ public class DataNetwork extends StateMachine { log("onDataConfigUpdated"); updateBandwidthFromDataConfig(); updateTcpBufferSizes(); updateMeteredAndCongested(); } Loading Loading @@ -1761,7 +1734,6 @@ public class DataNetwork extends StateMachine { */ private void onDisplayInfoChanged() { updateBandwidthFromDataConfig(); updateTcpBufferSizes(); updateMeteredAndCongested(); } Loading @@ -1779,21 +1751,6 @@ public class DataNetwork extends StateMachine { updateNetworkCapabilities(); } /** * Update the TCP buffer sizes from carrier configs. */ private void updateTcpBufferSizes() { log("updateTcpBufferSizes"); mTcpBufferSizes = getTcpConfig(); LinkProperties linkProperties = new LinkProperties(mLinkProperties); linkProperties.setTcpBufferSizes(mTcpBufferSizes); if (!linkProperties.equals(mLinkProperties)) { mLinkProperties = linkProperties; log("sendLinkProperties " + mLinkProperties); mNetworkAgent.sendLinkProperties(mLinkProperties); } } /** * Update the metered and congested values from carrier configs and subscription overrides */ Loading Loading @@ -2322,7 +2279,6 @@ public class DataNetwork extends StateMachine { pw.println("mLinkProperties=" + mLinkProperties); pw.println("mNetworkSliceInfo=" + mNetworkSliceInfo); pw.println("mNetworkBandwidth=" + mNetworkBandwidth); pw.println("mTcpBufferSizes=" + mTcpBufferSizes); pw.println("mTempNotMeteredSupported=" + mTempNotMeteredSupported); pw.println("mTempNotMetered=" + mTempNotMetered); pw.println("mCongested=" + mCongested); Loading Loading
src/java/com/android/internal/telephony/data/DataConfigManager.java +10 −45 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.internal.telephony.data; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.StringDef; import android.content.BroadcastReceiver; import android.content.Context; Loading @@ -43,7 +42,6 @@ import android.telephony.data.ApnSetting; import android.text.TextUtils; import android.util.IndentingPrintWriter; import com.android.internal.R; import com.android.internal.telephony.Phone; import com.android.internal.telephony.data.DataNetworkController.HandoverRule; import com.android.internal.telephony.data.DataRetryManager.DataHandoverRetryRule; Loading Loading @@ -219,9 +217,6 @@ public class DataConfigManager extends Handler { /** A map of network types to the downlink and uplink bandwidth values for that network type */ private @NonNull final @DataConfigNetworkType Map<String, DataNetwork.NetworkBandwidth> mBandwidthMap = new ConcurrentHashMap<>(); /** A map of network types to the TCP buffer sizes for that network type */ private @NonNull final @DataConfigNetworkType Map<String, String> mTcpBufferSizeMap = new ConcurrentHashMap<>(); /** Rules for handover between IWLAN and cellular network. */ private @NonNull final List<HandoverRule> mHandoverRuleList = new ArrayList<>(); Loading Loading @@ -298,7 +293,6 @@ public class DataConfigManager extends Handler { updateSingleDataNetworkTypeList(); updateUnmeteredNetworkTypes(); updateBandwidths(); updateTcpBuffers(); updateHandoverRules(); log("Data config updated. Config is " + (isConfigCarrierSpecific() ? "" : "not ") Loading Loading @@ -605,46 +599,19 @@ public class DataConfigManager extends Handler { return mCarrierConfig.getInt(CarrierConfigManager.KEY_DEFAULT_MTU_INT); } /** * Update the TCP buffer sizes from the carrier config. */ private void updateTcpBuffers() { synchronized (this) { mTcpBufferSizeMap.clear(); String[] buffers = mCarrierConfig.getStringArray( CarrierConfigManager.KEY_TCP_BUFFERS_STRING_ARRAY); if (buffers != null) { for (String buffer : buffers) { // split[0] = network type as string // split[1] = rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max String[] split = buffer.split(":"); if (split.length != 2) { loge("Invalid TCP buffer sizes: " + buffer); continue; } if (split[1].split(",").length != 6) { loge("Invalid TCP buffer sizes for " + split[0] + ": " + split[1]); continue; } mTcpBufferSizeMap.put(split[0], split[1]); } } } } /** * Get the TCP config string, used by {@link LinkProperties#setTcpBufferSizes(String)}. * The config string will have the following form, with values in bytes: * "read_min,read_default,read_max,write_min,write_default,write_max" * * @param networkType The network type. Note that {@link TelephonyManager#NETWORK_TYPE_LTE_CA} * can be used for LTE CA even though it's not a radio access technology. * @param serviceState The service state, used to determine NR state. * @return The TCP configuration string for the given network type or null if unavailable. * Note that starting from Android 13, the TCP buffer size is fixed after boot up, and should * never be changed based on carriers or the network types. The value should be configured * appropriately based on the device's memory and performance. * * @return The TCP configuration string. */ public @Nullable String getTcpConfigString(@NetworkType int networkType, @NonNull ServiceState serviceState) { return mTcpBufferSizeMap.get(getDataConfigNetworkType(networkType, serviceState)); public @NonNull String getTcpConfigString() { return mResources.getString(com.android.internal.R.string.config_tcp_buffers); } /** Loading @@ -652,7 +619,8 @@ public class DataConfigManager extends Handler { * does not complete within the window, the data network will be torn down after timeout. */ public long getImsDeregistrationDelay() { return mResources.getInteger(R.integer.config_delay_for_ims_dereg_millis); return mResources.getInteger( com.android.internal.R.integer.config_delay_for_ims_dereg_millis); } /** Loading Loading @@ -903,10 +871,7 @@ public class DataConfigManager extends Handler { + shouldResetDataThrottlingWhenTacChanges()); pw.println("Data service package name=" + getDataServicePackageName()); pw.println("Default MTU=" + getDefaultMtu()); pw.println("TCP buffer sizes:"); pw.increaseIndent(); mTcpBufferSizeMap.forEach((key, value) -> pw.println(key + ":" + value)); pw.decreaseIndent(); pw.println("TCP buffer sizes:" + getTcpConfigString()); pw.println("getImsDeregistrationDelay=" + getImsDeregistrationDelay()); pw.println("shouldPersistIwlanDataNetworksWhenDataServiceRestarted=" + shouldPersistIwlanDataNetworksWhenDataServiceRestarted()); Loading
src/java/com/android/internal/telephony/data/DataNetwork.java +1 −45 Original line number Diff line number Diff line Loading @@ -404,9 +404,6 @@ public class DataNetwork extends StateMachine { /** The network bandwidth. */ private @NonNull NetworkBandwidth mNetworkBandwidth = new NetworkBandwidth(14, 14); /** The TCP buffer sizes config. */ private @Nullable String mTcpBufferSizes = ""; /** Whether {@link NetworkCapabilities#NET_CAPABILITY_TEMPORARILY_NOT_METERED} is supported. */ private boolean mTempNotMeteredSupported = false; Loading Loading @@ -756,7 +753,6 @@ public class DataNetwork extends StateMachine { // TODO: Should update suspend state when CSS indicator changes. // TODO: Should update suspend state when call started/ended. updateSuspendState(); updateTcpBufferSizes(); updateBandwidthFromDataConfig(); break; } Loading Loading @@ -1489,7 +1485,7 @@ public class DataNetwork extends StateMachine { linkProperties.setHttpProxy(proxy); } linkProperties.setTcpBufferSizes(mTcpBufferSizes); linkProperties.setTcpBufferSizes(mDataConfigManager.getTcpConfigString()); mNetworkSliceInfo = response.getSliceInfo(); Loading @@ -1515,28 +1511,6 @@ public class DataNetwork extends StateMachine { mCid.get(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)); } /** * Get the TCP config string. * * @return The TCP config string used in {@link LinkProperties#setTcpBufferSizes(String)}. */ private @Nullable String getTcpConfig() { ServiceState ss = mPhone.getServiceState(); NetworkRegistrationInfo nrs = ss.getNetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, mTransport); int networkType = TelephonyManager.NETWORK_TYPE_UNKNOWN; if (nrs != null) { networkType = nrs.getAccessNetworkTechnology(); if (networkType == TelephonyManager.NETWORK_TYPE_LTE && nrs.isUsingCarrierAggregation()) { // Although LTE_CA is not a real RAT, but since LTE CA generally has higher speed // we use LTE_CA to get a different TCP config for LTE CA. networkType = TelephonyManager.NETWORK_TYPE_LTE_CA; } } return mDataConfigManager.getTcpConfigString(networkType, ss); } /** * Called when receiving setup data network response from the data service. * Loading Loading @@ -1695,7 +1669,6 @@ public class DataNetwork extends StateMachine { log("onDataConfigUpdated"); updateBandwidthFromDataConfig(); updateTcpBufferSizes(); updateMeteredAndCongested(); } Loading Loading @@ -1761,7 +1734,6 @@ public class DataNetwork extends StateMachine { */ private void onDisplayInfoChanged() { updateBandwidthFromDataConfig(); updateTcpBufferSizes(); updateMeteredAndCongested(); } Loading @@ -1779,21 +1751,6 @@ public class DataNetwork extends StateMachine { updateNetworkCapabilities(); } /** * Update the TCP buffer sizes from carrier configs. */ private void updateTcpBufferSizes() { log("updateTcpBufferSizes"); mTcpBufferSizes = getTcpConfig(); LinkProperties linkProperties = new LinkProperties(mLinkProperties); linkProperties.setTcpBufferSizes(mTcpBufferSizes); if (!linkProperties.equals(mLinkProperties)) { mLinkProperties = linkProperties; log("sendLinkProperties " + mLinkProperties); mNetworkAgent.sendLinkProperties(mLinkProperties); } } /** * Update the metered and congested values from carrier configs and subscription overrides */ Loading Loading @@ -2322,7 +2279,6 @@ public class DataNetwork extends StateMachine { pw.println("mLinkProperties=" + mLinkProperties); pw.println("mNetworkSliceInfo=" + mNetworkSliceInfo); pw.println("mNetworkBandwidth=" + mNetworkBandwidth); pw.println("mTcpBufferSizes=" + mTcpBufferSizes); pw.println("mTempNotMeteredSupported=" + mTempNotMeteredSupported); pw.println("mTempNotMetered=" + mTempNotMetered); pw.println("mCongested=" + mCongested); Loading