aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarah Kim <sarahchin@google.com>2023-06-21 21:59:11 +0000
committerSarah Kim <sarahchin@google.com>2023-06-22 20:32:30 +0000
commit542f8e399ce10bd6d34c724b00f6f1a5b8f5daae (patch)
treea4a1d70ba56746679c20c2e2288e6b299bb64cf0
parentfde282c9dca22c2d9bb9ec60002a5ac991a53fed (diff)
downloadtelephony-542f8e399ce10bd6d34c724b00f6f1a5b8f5daae.tar.gz
Revert "Ratchet PCC bandwidths only if anchor cell is the same and ignore empty"
This reverts commit b6a79f5bf395ee1839d0107ee0b0ebe476fc07b7. Reason for revert: b/286594668 Change-Id: I67d9a186cd67e495cc64f60cc0fdf838335ceeeb
-rw-r--r--src/java/com/android/internal/telephony/NetworkTypeController.java18
-rw-r--r--src/java/com/android/internal/telephony/ServiceStateTracker.java49
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java34
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java24
4 files changed, 53 insertions, 72 deletions
diff --git a/src/java/com/android/internal/telephony/NetworkTypeController.java b/src/java/com/android/internal/telephony/NetworkTypeController.java
index f94ff26bb8..beebf2206e 100644
--- a/src/java/com/android/internal/telephony/NetworkTypeController.java
+++ b/src/java/com/android/internal/telephony/NetworkTypeController.java
@@ -162,6 +162,7 @@ public class NetworkTypeController extends StateMachine {
private boolean mIsTimerResetEnabledForLegacyStateRrcIdle;
private int mLtePlusThresholdBandwidth;
private int mNrAdvancedThresholdBandwidth;
+ private boolean mIncludeLteForNrAdvancedThresholdBandwidth;
private @NonNull int[] mAdditionalNrAdvancedBandsList;
private @NonNull String mPrimaryTimerState;
private @NonNull String mSecondaryTimerState;
@@ -290,6 +291,8 @@ public class NetworkTypeController extends StateMachine {
CarrierConfigManager.KEY_LTE_PLUS_THRESHOLD_BANDWIDTH_KHZ_INT);
mNrAdvancedThresholdBandwidth = config.getInt(
CarrierConfigManager.KEY_NR_ADVANCED_THRESHOLD_BANDWIDTH_KHZ_INT);
+ mIncludeLteForNrAdvancedThresholdBandwidth = config.getBoolean(
+ CarrierConfigManager.KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL);
mEnableNrAdvancedWhileRoaming = config.getBoolean(
CarrierConfigManager.KEY_ENABLE_NR_ADVANCED_WHILE_ROAMING_BOOL);
mAdditionalNrAdvancedBandsList = config.getIntArray(
@@ -1281,11 +1284,20 @@ public class NetworkTypeController extends StateMachine {
return false;
}
+ int bandwidths = 0;
+ if (mPhone.getServiceStateTracker().getPhysicalChannelConfigList() != null) {
+ bandwidths = mPhone.getServiceStateTracker().getPhysicalChannelConfigList()
+ .stream()
+ .filter(config -> mIncludeLteForNrAdvancedThresholdBandwidth
+ || config.getNetworkType() == TelephonyManager.NETWORK_TYPE_NR)
+ .map(PhysicalChannelConfig::getCellBandwidthDownlinkKhz)
+ .mapToInt(Integer::intValue)
+ .sum();
+ }
+
// Check if meeting minimum bandwidth requirement. For most carriers, there is no minimum
// bandwidth requirement and mNrAdvancedThresholdBandwidth is 0.
- if (mNrAdvancedThresholdBandwidth > 0
- && IntStream.of(mPhone.getServiceState().getCellBandwidths()).sum()
- < mNrAdvancedThresholdBandwidth) {
+ if (mNrAdvancedThresholdBandwidth > 0 && bandwidths < mNrAdvancedThresholdBandwidth) {
return false;
}
diff --git a/src/java/com/android/internal/telephony/ServiceStateTracker.java b/src/java/com/android/internal/telephony/ServiceStateTracker.java
index 9fb7d439eb..50eea7f695 100644
--- a/src/java/com/android/internal/telephony/ServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/ServiceStateTracker.java
@@ -180,7 +180,6 @@ public class ServiceStateTracker extends Handler {
private long mLastCellInfoReqTime;
private List<CellInfo> mLastCellInfoList = null;
private List<PhysicalChannelConfig> mLastPhysicalChannelConfigList = null;
- private int mLastAnchorNrCellId = PhysicalChannelConfig.PHYSICAL_CELL_ID_UNKNOWN;
private final Set<Integer> mRadioPowerOffReasons = new HashSet();
@@ -1661,18 +1660,6 @@ public class ServiceStateTracker extends Handler {
log("EVENT_PHYSICAL_CHANNEL_CONFIG: list=" + list
+ (list == null ? "" : ", list.size()=" + list.size()));
}
- if ((list == null || list.isEmpty())
- && mLastAnchorNrCellId != PhysicalChannelConfig.PHYSICAL_CELL_ID_UNKNOWN
- && mPhone.getContext().getSystemService(TelephonyManager.class)
- .isRadioInterfaceCapabilitySupported(TelephonyManager
- .CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED)
- && !mCarrierConfig.getBoolean(CarrierConfigManager
- .KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL)
- && mCarrierConfig.getBoolean(CarrierConfigManager
- .KEY_RATCHET_NR_ADVANCED_BANDWIDTH_IF_RRC_IDLE_BOOL)) {
- log("Ignore empty PCC list when RRC idle.");
- break;
- }
mLastPhysicalChannelConfigList = list;
boolean hasChanged = false;
if (updateNrStateFromPhysicalChannelConfigs(list, mSS)) {
@@ -1683,40 +1670,8 @@ public class ServiceStateTracker extends Handler {
mNrFrequencyChangedRegistrants.notifyRegistrants();
hasChanged = true;
}
- int anchorNrCellId = PhysicalChannelConfig.PHYSICAL_CELL_ID_UNKNOWN;
- if (list != null) {
- anchorNrCellId = list
- .stream()
- .filter(config -> config.getNetworkType()
- == TelephonyManager.NETWORK_TYPE_NR
- && config.getConnectionStatus()
- == PhysicalChannelConfig.CONNECTION_PRIMARY_SERVING)
- .map(PhysicalChannelConfig::getPhysicalCellId)
- .findFirst()
- .orElse(PhysicalChannelConfig.PHYSICAL_CELL_ID_UNKNOWN);
- }
- boolean includeLte = mCarrierConfig.getBoolean(CarrierConfigManager
- .KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL);
- int[] bandwidths = new int[0];
- if (list != null) {
- bandwidths = list.stream()
- .filter(config -> includeLte || config.getNetworkType()
- == TelephonyManager.NETWORK_TYPE_NR)
- .map(PhysicalChannelConfig::getCellBandwidthDownlinkKhz)
- .mapToInt(Integer::intValue)
- .toArray();
- }
- if (anchorNrCellId == mLastAnchorNrCellId
- && anchorNrCellId != PhysicalChannelConfig.PHYSICAL_CELL_ID_UNKNOWN) {
- log("Ratchet bandwidths since anchor NR cell is the same.");
- hasChanged |= RatRatcheter.updateBandwidths(bandwidths, mSS);
- } else {
- log("Do not ratchet bandwidths since anchor NR cell is different ("
- + mLastAnchorNrCellId + "->" + anchorNrCellId + ").");
- mLastAnchorNrCellId = anchorNrCellId;
- hasChanged |= !Arrays.equals(mSS.getCellBandwidths(), bandwidths);
- mSS.setCellBandwidths(bandwidths);
- }
+ hasChanged |= RatRatcheter
+ .updateBandwidths(getBandwidthsFromConfigs(list), mSS);
mPhone.notifyPhysicalChannelConfig(list);
// Notify NR frequency, NR connection status or bandwidths changed.
diff --git a/tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java
index ff696fc0a3..0c57e829df 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/NetworkTypeControllerTest.java
@@ -1274,7 +1274,12 @@ public class NetworkTypeControllerTest extends TelephonyTest {
assertEquals("DefaultState", getCurrentState().getName());
doReturn(NetworkRegistrationInfo.NR_STATE_CONNECTED).when(mServiceState).getNrState();
doReturn(ServiceState.FREQUENCY_RANGE_MMWAVE).when(mServiceState).getNrFrequencyRange();
- doReturn(new int[] {20001}).when(mServiceState).getCellBandwidths();
+ List<PhysicalChannelConfig> lastPhysicalChannelConfigList = new ArrayList<>();
+ lastPhysicalChannelConfigList.add(new PhysicalChannelConfig.Builder()
+ .setNetworkType(TelephonyManager.NETWORK_TYPE_NR)
+ .setCellBandwidthDownlinkKhz(20001)
+ .build());
+ doReturn(lastPhysicalChannelConfigList).when(mSST).getPhysicalChannelConfigList();
mBundle.putInt(CarrierConfigManager.KEY_NR_ADVANCED_THRESHOLD_BANDWIDTH_KHZ_INT, 20000);
sendCarrierConfigChanged();
@@ -1284,6 +1289,33 @@ public class NetworkTypeControllerTest extends TelephonyTest {
}
@Test
+ public void testTransitionToCurrentStateNrConnectedWithHighBandwidthIncludingLte()
+ throws Exception {
+ assertEquals("DefaultState", getCurrentState().getName());
+ doReturn(NetworkRegistrationInfo.NR_STATE_CONNECTED).when(mServiceState).getNrState();
+ doReturn(ServiceState.FREQUENCY_RANGE_MMWAVE).when(mServiceState).getNrFrequencyRange();
+ List<PhysicalChannelConfig> lastPhysicalChannelConfigList = new ArrayList<>();
+ lastPhysicalChannelConfigList.add(new PhysicalChannelConfig.Builder()
+ .setNetworkType(TelephonyManager.NETWORK_TYPE_NR)
+ .setCellBandwidthDownlinkKhz(20000)
+ .build());
+ lastPhysicalChannelConfigList.add(new PhysicalChannelConfig.Builder()
+ .setNetworkType(TelephonyManager.NETWORK_TYPE_LTE)
+ .setCellBandwidthDownlinkKhz(10000)
+ .build());
+ doReturn(lastPhysicalChannelConfigList).when(mSST).getPhysicalChannelConfigList();
+ mBundle.putInt(CarrierConfigManager.KEY_NR_ADVANCED_THRESHOLD_BANDWIDTH_KHZ_INT, 20000);
+ mBundle.putBoolean(
+ CarrierConfigManager.KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL,
+ true);
+ sendCarrierConfigChanged();
+
+ mNetworkTypeController.sendMessage(NetworkTypeController.EVENT_UPDATE);
+ processAllMessages();
+ assertEquals("connected_mmwave", getCurrentState().getName());
+ }
+
+ @Test
public void testNrAdvancedDisabledWhileRoaming() throws Exception {
assertEquals("DefaultState", getCurrentState().getName());
doReturn(true).when(mServiceState).getDataRoaming();
diff --git a/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java b/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java
index 280fbcc177..846b48e3f7 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java
@@ -278,15 +278,6 @@ public class ServiceStateTrackerTest extends TelephonyTest {
// UMTS < GPRS < EDGE
new String[]{"3,1,2"});
- mBundle.putBoolean(CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL,
- false);
-
- mBundle.putBoolean(CarrierConfigManager.KEY_RATCHET_NR_ADVANCED_BANDWIDTH_IF_RRC_IDLE_BOOL,
- true);
-
- doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported(
- TelephonyManager.CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED);
-
mSimulatedCommands.setVoiceRegState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME);
mSimulatedCommands.setVoiceRadioTech(ServiceState.RIL_RADIO_TECHNOLOGY_HSPA);
mSimulatedCommands.setDataRegState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME);
@@ -2282,10 +2273,6 @@ public class ServiceStateTrackerTest extends TelephonyTest {
@Test
public void testPhyChanBandwidthRatchetedOnPhyChanBandwidth() {
- mBundle.putBoolean(
- CarrierConfigManager.KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL,
- true);
-
// LTE Cell with bandwidth = 10000
CellIdentityLte cellIdentity10 =
new CellIdentityLte(1, 1, 1, 1, new int[] {1, 2}, 10000, "1", "1", "test",
@@ -2372,16 +2359,11 @@ public class ServiceStateTrackerTest extends TelephonyTest {
public void testPhyChanBandwidthForNr() {
// NR Cell with bandwidth = 10000
CellIdentityNr nrCi = new CellIdentityNr(
- 0, 0, 0, new int[]{10000}, "", "", 5, "", "", Collections.emptyList());
+ 0, 0, 0, new int[] {}, "", "", 5, "", "", Collections.emptyList());
- sendRegStateUpdateForNrCellId(nrCi);
- // should ratchet for NR
sendPhyChanConfigChange(new int[] {10000, 5000}, TelephonyManager.NETWORK_TYPE_NR, 0);
- assertArrayEquals(new int[]{10000, 5000}, sst.mSS.getCellBandwidths());
-
- // should not ratchet for LTE
- sendPhyChanConfigChange(new int[] {100}, TelephonyManager.NETWORK_TYPE_LTE, 0);
- assertArrayEquals(new int[]{}, sst.mSS.getCellBandwidths());
+ sendRegStateUpdateForNrCellId(nrCi);
+ assertArrayEquals(new int[] {10000, 5000}, sst.mSS.getCellBandwidths());
}
/**