Loading src/java/com/android/internal/telephony/RatRatcheter.java +21 −3 Original line number Diff line number Diff line Loading @@ -122,9 +122,6 @@ public class RatRatcheter { /** Ratchets RATs and cell bandwidths if oldSS and newSS have the same RAT family. */ public void ratchet(@NonNull ServiceState oldSS, @NonNull ServiceState newSS, boolean locationChange) { if (!locationChange && isSameRatFamily(oldSS, newSS)) { updateBandwidths(oldSS.getCellBandwidths(), newSS); } // temporarily disable rat ratchet on location change. if (locationChange) { mVoiceRatchetEnabled = false; Loading @@ -132,6 +129,13 @@ public class RatRatcheter { return; } // Different rat family, don't need rat ratchet and update cell bandwidths. if (!isSameRatFamily(oldSS, newSS)) { return; } updateBandwidths(oldSS.getCellBandwidths(), newSS); boolean newUsingCA = oldSS.isUsingCarrierAggregation() || newSS.isUsingCarrierAggregation() || newSS.getCellBandwidths().length > 1; Loading Loading @@ -179,6 +183,20 @@ public class RatRatcheter { AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .getAccessNetworkTechnology()); // The api getAccessNetworkTechnology@NetworkRegistrationInfo always returns LTE though // data rat is LTE CA. Because it uses mIsUsingCarrierAggregation to indicate whether // it is LTE CA or not. However, we need its actual data rat to check if they are the // same family. So convert it to LTE CA. if (dataRat1 == ServiceState.RIL_RADIO_TECHNOLOGY_LTE && ss1.isUsingCarrierAggregation()) { dataRat1 = ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA; } if (dataRat2 == ServiceState.RIL_RADIO_TECHNOLOGY_LTE && ss2.isUsingCarrierAggregation()) { dataRat2 = ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA; } if (dataRat1 == dataRat2) return true; if (mRatFamilyMap.get(dataRat1) == null) { return false; Loading src/java/com/android/internal/telephony/ServiceStateTracker.java +7 −1 Original line number Diff line number Diff line Loading @@ -3226,7 +3226,13 @@ public class ServiceStateTracker extends Handler { : TelephonyManager.NETWORK_TYPE_UNKNOWN; int newRAT = newNrs != null ? newNrs.getAccessNetworkTechnology() : TelephonyManager.NETWORK_TYPE_UNKNOWN; hasRilDataRadioTechnologyChanged.put(transport, oldRAT != newRAT); boolean isOldCA = oldNrs != null ? (oldNrs.getDataSpecificInfo() != null ? oldNrs.getDataSpecificInfo().isUsingCarrierAggregation() : false) : false; boolean isNewCA = newNrs != null ? (newNrs.getDataSpecificInfo() != null ? newNrs.getDataSpecificInfo().isUsingCarrierAggregation() : false) : false; hasRilDataRadioTechnologyChanged.put(transport, oldRAT != newRAT || isOldCA != isNewCA); if (oldRAT != newRAT) { anyDataRatChanged = true; } Loading src/java/com/android/internal/telephony/cat/CatService.java +4 −2 Original line number Diff line number Diff line Loading @@ -266,8 +266,10 @@ public class CatService extends Handler implements AppInterface { mUiccController.unregisterForIccChanged(this); mUiccController = null; } if (mMsgDecoder != null) { mMsgDecoder.dispose(); mMsgDecoder = null; } removeCallbacksAndMessages(null); if (sInstance != null) { if (mSlotId >= 0 && mSlotId < sInstance.length) { Loading src/java/com/android/internal/telephony/dataconnection/DataConnection.java +15 −6 Original line number Diff line number Diff line Loading @@ -1025,13 +1025,14 @@ public class DataConnection extends StateMachine { "122334,734003,2202010,32040,192239,576717"; private static final String TCP_BUFFER_SIZES_NR = "2097152,6291456,16777216,512000,2097152,8388608"; private static final String TCP_BUFFER_SIZES_LTE_CA = "4096,6291456,12582912,4096,1048576,2097152"; private void updateTcpBufferSizes(int rilRat) { String sizes = null; if (rilRat == ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA) { // for now treat CA as LTE. Plan to surface the extra bandwith in a more // precise manner which should affect buffer sizes rilRat = ServiceState.RIL_RADIO_TECHNOLOGY_LTE; ServiceState ss = mPhone.getServiceState(); if (rilRat == ServiceState.RIL_RADIO_TECHNOLOGY_LTE && ss.isUsingCarrierAggregation()) { rilRat = ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA; } String ratName = ServiceState.rilRadioTechnologyToString(rilRat).toLowerCase(Locale.ROOT); // ServiceState gives slightly different names for EVDO tech ("evdo-rev.0" for ex) Loading @@ -1045,7 +1046,8 @@ public class DataConnection extends StateMachine { // NR 5G Non-Standalone use LTE cell as the primary cell, the ril technology is LTE in this // case. We use NR 5G TCP buffer size when connected to NR 5G Non-Standalone network. if (mTransportType == AccessNetworkConstants.TRANSPORT_TYPE_WWAN && rilRat == ServiceState.RIL_RADIO_TECHNOLOGY_LTE && isNRConnected() && ((rilRat == ServiceState.RIL_RADIO_TECHNOLOGY_LTE || rilRat == ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA) && isNRConnected()) && mPhone.getServiceStateTracker().getNrContextIds().contains(mCid)) { ratName = RAT_NAME_5G; } Loading Loading @@ -1096,7 +1098,6 @@ public class DataConnection extends StateMachine { sizes = TCP_BUFFER_SIZES_HSPA; break; case ServiceState.RIL_RADIO_TECHNOLOGY_LTE: case ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA: // Use NR 5G TCP buffer size when connected to NR 5G Non-Standalone network. if (RAT_NAME_5G.equals(ratName)) { sizes = TCP_BUFFER_SIZES_NR; Loading @@ -1104,6 +1105,14 @@ public class DataConnection extends StateMachine { sizes = TCP_BUFFER_SIZES_LTE; } break; case ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA: // Use NR 5G TCP buffer size when connected to NR 5G Non-Standalone network. if (RAT_NAME_5G.equals(ratName)) { sizes = TCP_BUFFER_SIZES_NR; } else { sizes = TCP_BUFFER_SIZES_LTE_CA; } break; case ServiceState.RIL_RADIO_TECHNOLOGY_HSPAP: sizes = TCP_BUFFER_SIZES_HSPAP; break; Loading tests/telephonytests/src/com/android/internal/telephony/RatRatcheterTest.java +96 −2 Original line number Diff line number Diff line Loading @@ -18,23 +18,37 @@ package com.android.internal.telephony; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; import android.os.PersistableBundle; import android.telephony.AccessNetworkConstants; import android.telephony.CarrierConfigManager; import android.telephony.LteVopsSupportInfo; import android.telephony.NetworkRegistrationInfo; import android.telephony.ServiceState; import android.telephony.TelephonyManager; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.util.Arrays; /** Tests for RatRatcheter. */ public class RatRatcheterTest { public class RatRatcheterTest extends TelephonyTest { private ServiceState mServiceState; private PersistableBundle mBundle; @Before public void setUp() { public void setUp() throws Exception { super.setUp(getClass().getSimpleName()); mServiceState = new ServiceState(); } @After public void tearDown() throws Exception { super.tearDown(); } @Test public void testUpdateBandwidthsSuccess() { int[] bandwidths = new int[] {1400, 5000}; Loading Loading @@ -68,4 +82,84 @@ public class RatRatcheterTest { assertFalse(updated); assertTrue(Arrays.equals(mServiceState.getCellBandwidths(), originalBandwidths)); } private NetworkRegistrationInfo createNetworkRegistrationInfo( int domain, int accessNetworkTechnology, boolean isUsingCarrierAggregation) { LteVopsSupportInfo lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED, LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED); return new NetworkRegistrationInfo( domain, // domain AccessNetworkConstants.TRANSPORT_TYPE_WWAN, // transportType 0, // registrationState accessNetworkTechnology, // accessNetworkTechnology 0, // rejectCause false, // emergencyOnly null, // availableServices null, // cellIdentity null, // rplmn 0, // maxDataCalls false, // isDcNrRestricted false, // isNrAvailable false, // isEndcAvailable lteVopsSupportInfo, // lteVopsSupportInfo isUsingCarrierAggregation); // isUsingCarrierAggregation } private void setNetworkRegistrationInfo(ServiceState ss, int accessNetworkTechnology) { NetworkRegistrationInfo nri1; NetworkRegistrationInfo nri2; boolean isUsingCarrierAggregation = false; if (accessNetworkTechnology == TelephonyManager.NETWORK_TYPE_LTE_CA) { isUsingCarrierAggregation = true; } nri1 = createNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS, accessNetworkTechnology, isUsingCarrierAggregation); nri2 = createNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_CS, accessNetworkTechnology, isUsingCarrierAggregation); ss.addNetworkRegistrationInfo(nri1); ss.addNetworkRegistrationInfo(nri2); } @Test public void testRatchetIsFamily() { ServiceState oldSS = new ServiceState(); ServiceState newSS = new ServiceState(); mBundle = mContextFixture.getCarrierConfigBundle(); mBundle.putStringArray(CarrierConfigManager.KEY_RATCHET_RAT_FAMILIES, new String[]{"14,19"}); setNetworkRegistrationInfo(oldSS, TelephonyManager.NETWORK_TYPE_LTE_CA); setNetworkRegistrationInfo(newSS, TelephonyManager.NETWORK_TYPE_LTE); RatRatcheter ratRatcheter = new RatRatcheter(mPhone); ratRatcheter.ratchet(oldSS, newSS, false); assertTrue(newSS.isUsingCarrierAggregation()); } @Test public void testRatchetIsNotFamily() { ServiceState oldSS = new ServiceState(); ServiceState newSS = new ServiceState(); mBundle = mContextFixture.getCarrierConfigBundle(); mBundle.putStringArray(CarrierConfigManager.KEY_RATCHET_RAT_FAMILIES, new String[]{}); setNetworkRegistrationInfo(oldSS, TelephonyManager.NETWORK_TYPE_LTE_CA); setNetworkRegistrationInfo(newSS, TelephonyManager.NETWORK_TYPE_LTE); RatRatcheter ratRatcheter = new RatRatcheter(mPhone); ratRatcheter.ratchet(oldSS, newSS, false); assertFalse(newSS.isUsingCarrierAggregation()); } } Loading
src/java/com/android/internal/telephony/RatRatcheter.java +21 −3 Original line number Diff line number Diff line Loading @@ -122,9 +122,6 @@ public class RatRatcheter { /** Ratchets RATs and cell bandwidths if oldSS and newSS have the same RAT family. */ public void ratchet(@NonNull ServiceState oldSS, @NonNull ServiceState newSS, boolean locationChange) { if (!locationChange && isSameRatFamily(oldSS, newSS)) { updateBandwidths(oldSS.getCellBandwidths(), newSS); } // temporarily disable rat ratchet on location change. if (locationChange) { mVoiceRatchetEnabled = false; Loading @@ -132,6 +129,13 @@ public class RatRatcheter { return; } // Different rat family, don't need rat ratchet and update cell bandwidths. if (!isSameRatFamily(oldSS, newSS)) { return; } updateBandwidths(oldSS.getCellBandwidths(), newSS); boolean newUsingCA = oldSS.isUsingCarrierAggregation() || newSS.isUsingCarrierAggregation() || newSS.getCellBandwidths().length > 1; Loading Loading @@ -179,6 +183,20 @@ public class RatRatcheter { AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .getAccessNetworkTechnology()); // The api getAccessNetworkTechnology@NetworkRegistrationInfo always returns LTE though // data rat is LTE CA. Because it uses mIsUsingCarrierAggregation to indicate whether // it is LTE CA or not. However, we need its actual data rat to check if they are the // same family. So convert it to LTE CA. if (dataRat1 == ServiceState.RIL_RADIO_TECHNOLOGY_LTE && ss1.isUsingCarrierAggregation()) { dataRat1 = ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA; } if (dataRat2 == ServiceState.RIL_RADIO_TECHNOLOGY_LTE && ss2.isUsingCarrierAggregation()) { dataRat2 = ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA; } if (dataRat1 == dataRat2) return true; if (mRatFamilyMap.get(dataRat1) == null) { return false; Loading
src/java/com/android/internal/telephony/ServiceStateTracker.java +7 −1 Original line number Diff line number Diff line Loading @@ -3226,7 +3226,13 @@ public class ServiceStateTracker extends Handler { : TelephonyManager.NETWORK_TYPE_UNKNOWN; int newRAT = newNrs != null ? newNrs.getAccessNetworkTechnology() : TelephonyManager.NETWORK_TYPE_UNKNOWN; hasRilDataRadioTechnologyChanged.put(transport, oldRAT != newRAT); boolean isOldCA = oldNrs != null ? (oldNrs.getDataSpecificInfo() != null ? oldNrs.getDataSpecificInfo().isUsingCarrierAggregation() : false) : false; boolean isNewCA = newNrs != null ? (newNrs.getDataSpecificInfo() != null ? newNrs.getDataSpecificInfo().isUsingCarrierAggregation() : false) : false; hasRilDataRadioTechnologyChanged.put(transport, oldRAT != newRAT || isOldCA != isNewCA); if (oldRAT != newRAT) { anyDataRatChanged = true; } Loading
src/java/com/android/internal/telephony/cat/CatService.java +4 −2 Original line number Diff line number Diff line Loading @@ -266,8 +266,10 @@ public class CatService extends Handler implements AppInterface { mUiccController.unregisterForIccChanged(this); mUiccController = null; } if (mMsgDecoder != null) { mMsgDecoder.dispose(); mMsgDecoder = null; } removeCallbacksAndMessages(null); if (sInstance != null) { if (mSlotId >= 0 && mSlotId < sInstance.length) { Loading
src/java/com/android/internal/telephony/dataconnection/DataConnection.java +15 −6 Original line number Diff line number Diff line Loading @@ -1025,13 +1025,14 @@ public class DataConnection extends StateMachine { "122334,734003,2202010,32040,192239,576717"; private static final String TCP_BUFFER_SIZES_NR = "2097152,6291456,16777216,512000,2097152,8388608"; private static final String TCP_BUFFER_SIZES_LTE_CA = "4096,6291456,12582912,4096,1048576,2097152"; private void updateTcpBufferSizes(int rilRat) { String sizes = null; if (rilRat == ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA) { // for now treat CA as LTE. Plan to surface the extra bandwith in a more // precise manner which should affect buffer sizes rilRat = ServiceState.RIL_RADIO_TECHNOLOGY_LTE; ServiceState ss = mPhone.getServiceState(); if (rilRat == ServiceState.RIL_RADIO_TECHNOLOGY_LTE && ss.isUsingCarrierAggregation()) { rilRat = ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA; } String ratName = ServiceState.rilRadioTechnologyToString(rilRat).toLowerCase(Locale.ROOT); // ServiceState gives slightly different names for EVDO tech ("evdo-rev.0" for ex) Loading @@ -1045,7 +1046,8 @@ public class DataConnection extends StateMachine { // NR 5G Non-Standalone use LTE cell as the primary cell, the ril technology is LTE in this // case. We use NR 5G TCP buffer size when connected to NR 5G Non-Standalone network. if (mTransportType == AccessNetworkConstants.TRANSPORT_TYPE_WWAN && rilRat == ServiceState.RIL_RADIO_TECHNOLOGY_LTE && isNRConnected() && ((rilRat == ServiceState.RIL_RADIO_TECHNOLOGY_LTE || rilRat == ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA) && isNRConnected()) && mPhone.getServiceStateTracker().getNrContextIds().contains(mCid)) { ratName = RAT_NAME_5G; } Loading Loading @@ -1096,7 +1098,6 @@ public class DataConnection extends StateMachine { sizes = TCP_BUFFER_SIZES_HSPA; break; case ServiceState.RIL_RADIO_TECHNOLOGY_LTE: case ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA: // Use NR 5G TCP buffer size when connected to NR 5G Non-Standalone network. if (RAT_NAME_5G.equals(ratName)) { sizes = TCP_BUFFER_SIZES_NR; Loading @@ -1104,6 +1105,14 @@ public class DataConnection extends StateMachine { sizes = TCP_BUFFER_SIZES_LTE; } break; case ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA: // Use NR 5G TCP buffer size when connected to NR 5G Non-Standalone network. if (RAT_NAME_5G.equals(ratName)) { sizes = TCP_BUFFER_SIZES_NR; } else { sizes = TCP_BUFFER_SIZES_LTE_CA; } break; case ServiceState.RIL_RADIO_TECHNOLOGY_HSPAP: sizes = TCP_BUFFER_SIZES_HSPAP; break; Loading
tests/telephonytests/src/com/android/internal/telephony/RatRatcheterTest.java +96 −2 Original line number Diff line number Diff line Loading @@ -18,23 +18,37 @@ package com.android.internal.telephony; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; import android.os.PersistableBundle; import android.telephony.AccessNetworkConstants; import android.telephony.CarrierConfigManager; import android.telephony.LteVopsSupportInfo; import android.telephony.NetworkRegistrationInfo; import android.telephony.ServiceState; import android.telephony.TelephonyManager; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.util.Arrays; /** Tests for RatRatcheter. */ public class RatRatcheterTest { public class RatRatcheterTest extends TelephonyTest { private ServiceState mServiceState; private PersistableBundle mBundle; @Before public void setUp() { public void setUp() throws Exception { super.setUp(getClass().getSimpleName()); mServiceState = new ServiceState(); } @After public void tearDown() throws Exception { super.tearDown(); } @Test public void testUpdateBandwidthsSuccess() { int[] bandwidths = new int[] {1400, 5000}; Loading Loading @@ -68,4 +82,84 @@ public class RatRatcheterTest { assertFalse(updated); assertTrue(Arrays.equals(mServiceState.getCellBandwidths(), originalBandwidths)); } private NetworkRegistrationInfo createNetworkRegistrationInfo( int domain, int accessNetworkTechnology, boolean isUsingCarrierAggregation) { LteVopsSupportInfo lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED, LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED); return new NetworkRegistrationInfo( domain, // domain AccessNetworkConstants.TRANSPORT_TYPE_WWAN, // transportType 0, // registrationState accessNetworkTechnology, // accessNetworkTechnology 0, // rejectCause false, // emergencyOnly null, // availableServices null, // cellIdentity null, // rplmn 0, // maxDataCalls false, // isDcNrRestricted false, // isNrAvailable false, // isEndcAvailable lteVopsSupportInfo, // lteVopsSupportInfo isUsingCarrierAggregation); // isUsingCarrierAggregation } private void setNetworkRegistrationInfo(ServiceState ss, int accessNetworkTechnology) { NetworkRegistrationInfo nri1; NetworkRegistrationInfo nri2; boolean isUsingCarrierAggregation = false; if (accessNetworkTechnology == TelephonyManager.NETWORK_TYPE_LTE_CA) { isUsingCarrierAggregation = true; } nri1 = createNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS, accessNetworkTechnology, isUsingCarrierAggregation); nri2 = createNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_CS, accessNetworkTechnology, isUsingCarrierAggregation); ss.addNetworkRegistrationInfo(nri1); ss.addNetworkRegistrationInfo(nri2); } @Test public void testRatchetIsFamily() { ServiceState oldSS = new ServiceState(); ServiceState newSS = new ServiceState(); mBundle = mContextFixture.getCarrierConfigBundle(); mBundle.putStringArray(CarrierConfigManager.KEY_RATCHET_RAT_FAMILIES, new String[]{"14,19"}); setNetworkRegistrationInfo(oldSS, TelephonyManager.NETWORK_TYPE_LTE_CA); setNetworkRegistrationInfo(newSS, TelephonyManager.NETWORK_TYPE_LTE); RatRatcheter ratRatcheter = new RatRatcheter(mPhone); ratRatcheter.ratchet(oldSS, newSS, false); assertTrue(newSS.isUsingCarrierAggregation()); } @Test public void testRatchetIsNotFamily() { ServiceState oldSS = new ServiceState(); ServiceState newSS = new ServiceState(); mBundle = mContextFixture.getCarrierConfigBundle(); mBundle.putStringArray(CarrierConfigManager.KEY_RATCHET_RAT_FAMILIES, new String[]{}); setNetworkRegistrationInfo(oldSS, TelephonyManager.NETWORK_TYPE_LTE_CA); setNetworkRegistrationInfo(newSS, TelephonyManager.NETWORK_TYPE_LTE); RatRatcheter ratRatcheter = new RatRatcheter(mPhone); ratRatcheter.ratchet(oldSS, newSS, false); assertFalse(newSS.isUsingCarrierAggregation()); } }