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

Commit 64a86115 authored by Nagendra Prasad Nagarle Basavaraju's avatar Nagendra Prasad Nagarle Basavaraju Committed by Automerger Merge Worker
Browse files

Merge "[Telephony]Fix Service State Update notification" into udc-dev am: af702eca

parents 15e39cec af702eca
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1714,7 +1714,7 @@ public class ServiceStateTracker extends Handler {
                        log("Do not ratchet bandwidths since anchor NR cell is different ("
                                + mLastAnchorNrCellId + "->" + anchorNrCellId + ").");
                        mLastAnchorNrCellId = anchorNrCellId;
                        hasChanged = !Arrays.equals(mSS.getCellBandwidths(), bandwidths);
                        hasChanged |= !Arrays.equals(mSS.getCellBandwidths(), bandwidths);
                        mSS.setCellBandwidths(bandwidths);
                    }

+36 −0
Original line number Diff line number Diff line
@@ -2305,6 +2305,42 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        assertEquals(ServiceState.FREQUENCY_RANGE_MID, sst.mSS.getNrFrequencyRange());
    }

    @Test
    public void testNotifyServiceStateChangedOnPhysicalConfigUpdates() {
        mBundle.putBoolean(
                CarrierConfigManager.KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL,
                true);

        // LTE Cell with bandwidth = 10000
        CellIdentityLte cellIdentity11 =
                new CellIdentityLte(1, 1, 1, 1, new int[] {1, 2}, 10000, "1", "1", "test",
                        "tst", Collections.emptyList(), null);

        sendRegStateUpdateForLteCellId(cellIdentity11);

        // Notify Service State changed for BandWidth Change
        sendPhyChanConfigChange(new int[] {10000, 40000}, TelephonyManager.NETWORK_TYPE_LTE, 1);
        verify(mPhone, times(1)).notifyServiceStateChanged(any(ServiceState.class));

        // Notify Service State changed for NR Connection Status: LTE -> NR
        // with context id update
        when(mPhone.getDataNetworkController().isInternetNetwork(eq(3))).thenReturn(true);
        sendPhyChanConfigChange(new int[] {10000, 40000}, TelephonyManager.NETWORK_TYPE_NR, 1,
                new int[][]{{0, 1}, {2, 3}});
        verify(mPhone, times(2)).notifyServiceStateChanged(any(ServiceState.class));

        // Service State changed is not notified since no change
        when(mPhone.getDataNetworkController().isInternetNetwork(eq(3))).thenReturn(true);
        sendPhyChanConfigChange(new int[] {10000, 40000}, TelephonyManager.NETWORK_TYPE_NR, 1,
                new int[][]{{0, 1}, {2, 3}});
        verify(mPhone, times(2)).notifyServiceStateChanged(any(ServiceState.class));

        // Notify Service State changed for NR Connection Status: NR -> LTE
        when(mPhone.getDataNetworkController().isInternetNetwork(eq(3))).thenReturn(true);
        sendPhyChanConfigChange(new int[] {10000, 40000}, TelephonyManager.NETWORK_TYPE_LTE, 1);
        verify(mPhone, times(3)).notifyServiceStateChanged(any(ServiceState.class));
    }

    @Test
    public void testPhyChanBandwidthResetsOnOos() {
        testPhyChanBandwidthRatchetedOnPhyChanBandwidth();