Loading src/java/com/android/internal/telephony/ServiceStateTracker.java +11 −13 Original line number Diff line number Diff line Loading @@ -1695,16 +1695,9 @@ public class ServiceStateTracker extends Handler { .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(); bandwidths = getBandwidthsFromLastPhysicalChannelConfigs(); } if (anchorNrCellId == mLastAnchorNrCellId && anchorNrCellId != PhysicalChannelConfig.PHYSICAL_CELL_ID_UNKNOWN) { Loading @@ -1712,7 +1705,8 @@ public class ServiceStateTracker extends Handler { hasChanged |= RatRatcheter.updateBandwidths(bandwidths, mSS); } else { log("Do not ratchet bandwidths since anchor NR cell is different (" + mLastAnchorNrCellId + "->" + anchorNrCellId + ")."); + mLastAnchorNrCellId + " -> " + anchorNrCellId + "). New bandwidths are " + Arrays.toString(bandwidths)); mLastAnchorNrCellId = anchorNrCellId; hasChanged |= !Arrays.equals(mSS.getCellBandwidths(), bandwidths); mSS.setCellBandwidths(bandwidths); Loading Loading @@ -1796,8 +1790,12 @@ public class ServiceStateTracker extends Handler { return simAbsent; } private static int[] getBandwidthsFromConfigs(List<PhysicalChannelConfig> list) { return list.stream() private int[] getBandwidthsFromLastPhysicalChannelConfigs() { boolean includeLte = mCarrierConfig.getBoolean( CarrierConfigManager.KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL); return mLastPhysicalChannelConfigList.stream() .filter(config -> includeLte || config.getNetworkType() == TelephonyManager.NETWORK_TYPE_NR) .map(PhysicalChannelConfig::getCellBandwidthDownlinkKhz) .mapToInt(Integer::intValue) .toArray(); Loading Loading @@ -2557,7 +2555,7 @@ public class ServiceStateTracker extends Handler { // Prioritize the PhysicalChannelConfig list because we might already be in carrier // aggregation by the time poll state is performed. if (primaryPcc != null) { bandwidths = getBandwidthsFromConfigs(mLastPhysicalChannelConfigList); bandwidths = getBandwidthsFromLastPhysicalChannelConfigs(); for (int bw : bandwidths) { if (!isValidLteBandwidthKhz(bw)) { loge("Invalid LTE Bandwidth in RegistrationState, " + bw); Loading Loading @@ -2593,7 +2591,7 @@ public class ServiceStateTracker extends Handler { // Prioritize the PhysicalChannelConfig list because we might already be in carrier // aggregation by the time poll state is performed. if (primaryPcc != null) { bandwidths = getBandwidthsFromConfigs(mLastPhysicalChannelConfigList); bandwidths = getBandwidthsFromLastPhysicalChannelConfigs(); for (int bw : bandwidths) { if (!isValidNrBandwidthKhz(bw)) { loge("Invalid NR Bandwidth in RegistrationState, " + bw); Loading tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +6 −4 Original line number Diff line number Diff line Loading @@ -374,6 +374,9 @@ public class ServiceStateTrackerTest extends TelephonyTest { 15, /* SIGNAL_STRENGTH_GOOD */ 30 /* SIGNAL_STRENGTH_GREAT */ }); mBundle.putBoolean( CarrierConfigManager.KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL, true); sendCarrierConfigUpdate(PHONE_ID); waitForLastHandlerAction(mSSTTestHandler.getThreadHandler()); Loading Loading @@ -2282,10 +2285,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", Loading Loading @@ -2370,6 +2369,9 @@ public class ServiceStateTrackerTest extends TelephonyTest { @Test public void testPhyChanBandwidthForNr() { mBundle.putBoolean( CarrierConfigManager.KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL, false); // NR Cell with bandwidth = 10000 CellIdentityNr nrCi = new CellIdentityNr( 0, 0, 0, new int[]{10000}, "", "", 5, "", "", Collections.emptyList()); Loading Loading
src/java/com/android/internal/telephony/ServiceStateTracker.java +11 −13 Original line number Diff line number Diff line Loading @@ -1695,16 +1695,9 @@ public class ServiceStateTracker extends Handler { .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(); bandwidths = getBandwidthsFromLastPhysicalChannelConfigs(); } if (anchorNrCellId == mLastAnchorNrCellId && anchorNrCellId != PhysicalChannelConfig.PHYSICAL_CELL_ID_UNKNOWN) { Loading @@ -1712,7 +1705,8 @@ public class ServiceStateTracker extends Handler { hasChanged |= RatRatcheter.updateBandwidths(bandwidths, mSS); } else { log("Do not ratchet bandwidths since anchor NR cell is different (" + mLastAnchorNrCellId + "->" + anchorNrCellId + ")."); + mLastAnchorNrCellId + " -> " + anchorNrCellId + "). New bandwidths are " + Arrays.toString(bandwidths)); mLastAnchorNrCellId = anchorNrCellId; hasChanged |= !Arrays.equals(mSS.getCellBandwidths(), bandwidths); mSS.setCellBandwidths(bandwidths); Loading Loading @@ -1796,8 +1790,12 @@ public class ServiceStateTracker extends Handler { return simAbsent; } private static int[] getBandwidthsFromConfigs(List<PhysicalChannelConfig> list) { return list.stream() private int[] getBandwidthsFromLastPhysicalChannelConfigs() { boolean includeLte = mCarrierConfig.getBoolean( CarrierConfigManager.KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL); return mLastPhysicalChannelConfigList.stream() .filter(config -> includeLte || config.getNetworkType() == TelephonyManager.NETWORK_TYPE_NR) .map(PhysicalChannelConfig::getCellBandwidthDownlinkKhz) .mapToInt(Integer::intValue) .toArray(); Loading Loading @@ -2557,7 +2555,7 @@ public class ServiceStateTracker extends Handler { // Prioritize the PhysicalChannelConfig list because we might already be in carrier // aggregation by the time poll state is performed. if (primaryPcc != null) { bandwidths = getBandwidthsFromConfigs(mLastPhysicalChannelConfigList); bandwidths = getBandwidthsFromLastPhysicalChannelConfigs(); for (int bw : bandwidths) { if (!isValidLteBandwidthKhz(bw)) { loge("Invalid LTE Bandwidth in RegistrationState, " + bw); Loading Loading @@ -2593,7 +2591,7 @@ public class ServiceStateTracker extends Handler { // Prioritize the PhysicalChannelConfig list because we might already be in carrier // aggregation by the time poll state is performed. if (primaryPcc != null) { bandwidths = getBandwidthsFromConfigs(mLastPhysicalChannelConfigList); bandwidths = getBandwidthsFromLastPhysicalChannelConfigs(); for (int bw : bandwidths) { if (!isValidNrBandwidthKhz(bw)) { loge("Invalid NR Bandwidth in RegistrationState, " + bw); Loading
tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +6 −4 Original line number Diff line number Diff line Loading @@ -374,6 +374,9 @@ public class ServiceStateTrackerTest extends TelephonyTest { 15, /* SIGNAL_STRENGTH_GOOD */ 30 /* SIGNAL_STRENGTH_GREAT */ }); mBundle.putBoolean( CarrierConfigManager.KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL, true); sendCarrierConfigUpdate(PHONE_ID); waitForLastHandlerAction(mSSTTestHandler.getThreadHandler()); Loading Loading @@ -2282,10 +2285,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", Loading Loading @@ -2370,6 +2369,9 @@ public class ServiceStateTrackerTest extends TelephonyTest { @Test public void testPhyChanBandwidthForNr() { mBundle.putBoolean( CarrierConfigManager.KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL, false); // NR Cell with bandwidth = 10000 CellIdentityNr nrCi = new CellIdentityNr( 0, 0, 0, new int[]{10000}, "", "", 5, "", "", Collections.emptyList()); Loading