Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 393f876d authored by Sarah Kim's avatar Sarah Kim Committed by Android (Google) Code Review
Browse files

Merge "ServiceStateTracker consider config for combined bandwidth" into udc-dev

parents e8ca7f75 53d1bd0f
Loading
Loading
Loading
Loading
+11 −13
Original line number Diff line number Diff line
@@ -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) {
@@ -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);
@@ -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();
@@ -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);
@@ -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);
+6 −4
Original line number Diff line number Diff line
@@ -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());
@@ -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",
@@ -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());