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

Commit 3abddc47 authored by Jack Yu's avatar Jack Yu Committed by Sarah Chin
Browse files

Added multi-band support

One cell could have multiple bands assigned.
One frequency could be shared by multiple bands
because they have overlapping.

Test: Telephony sanity tests.
Bug: 131061889

Change-Id: I96ab23c304a07264fdd61b43722b997456a13e2c
parent ce1b8d51
Loading
Loading
Loading
Loading
+17 −13
Original line number Diff line number Diff line
@@ -26,7 +26,10 @@ import android.test.AndroidTestCase;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class CellIdentityNrTest extends AndroidTestCase {
    private static final String MCC = "310";
@@ -39,13 +42,14 @@ public class CellIdentityNrTest extends AndroidTestCase {
    private static final int PCI = 123;
    private static final int TAC = 32767;
    private static final int NCI = 8675309;
    private static final int BAND = AccessNetworkConstants.NgranBands.BAND_1;
    private static final List<Integer> BANDS = new ArrayList<>(Arrays.asList(
            AccessNetworkConstants.NgranBands.BAND_1, AccessNetworkConstants.NgranBands.BAND_1));

    @Test
    public void testGetMethod() {
        // GIVEN an instance of CellIdentityNr
        CellIdentityNr cellIdentityNr =
                new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
                new CellIdentityNr(PCI, TAC, NRARFCN, BANDS, MCC, MNC, NCI, ALPHAL, ALPHAS,
                        Collections.emptyList());

        // THEN the get method should return correct value
@@ -65,11 +69,11 @@ public class CellIdentityNrTest extends AndroidTestCase {
    public void testEquals_sameParameters() {
        // GIVEN an instance of CellIdentityNr, and create another object with the same parameters
        CellIdentityNr cellIdentityNr =
                new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
                        Collections.emptyList());
                new CellIdentityNr(PCI, TAC, NRARFCN, BANDS, MCC, MNC, NCI,
                        ALPHAL, ALPHAS, Collections.emptyList());
        CellIdentityNr anotherCellIdentityNr =
                new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
                        Collections.emptyList());
                new CellIdentityNr(PCI, TAC, NRARFCN, BANDS, MCC, MNC, NCI,
                        ALPHAL, ALPHAS, Collections.emptyList());

        // THEN this two objects are equivalent
        assertThat(cellIdentityNr).isEqualTo(anotherCellIdentityNr);
@@ -79,11 +83,11 @@ public class CellIdentityNrTest extends AndroidTestCase {
    public void testEquals_differentParameters() {
        // GIVEN an instance of CellIdentityNr, and create another object with different parameters
        CellIdentityNr cellIdentityNr =
                new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
                        Collections.emptyList());
                new CellIdentityNr(PCI, TAC, NRARFCN, BANDS, MCC, MNC, NCI,
                        ALPHAL, ALPHAS, Collections.emptyList());
        CellIdentityNr anotherCellIdentityNr =
                new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI + 1, ALPHAL, ALPHAS,
                        Collections.emptyList());
                new CellIdentityNr(PCI, TAC, NRARFCN, BANDS, MCC, MNC, NCI + 1,
                        ALPHAL, ALPHAS, Collections.emptyList());

        // THEN this two objects are different
        assertThat(cellIdentityNr).isNotEqualTo(anotherCellIdentityNr);
@@ -93,8 +97,8 @@ public class CellIdentityNrTest extends AndroidTestCase {
    public void testParcel() {
        // GIVEN an instance of CellIdentityNr
        CellIdentityNr cellIdentityNr =
                new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
                        Collections.emptyList());
                new CellIdentityNr(PCI, TAC, NRARFCN, BANDS, MCC, MNC, NCI,
                        ALPHAL, ALPHAS, Collections.emptyList());

        // WHEN write the object to parcel and create another object with that parcel
        Parcel parcel = Parcel.obtain();
@@ -108,7 +112,7 @@ public class CellIdentityNrTest extends AndroidTestCase {
        assertThat(anotherCellIdentityNr.getNrarfcn()).isEqualTo(NRARFCN);
        assertThat(anotherCellIdentityNr.getPci()).isEqualTo(PCI);
        assertThat(anotherCellIdentityNr.getTac()).isEqualTo(TAC);
        assertThat(anotherCellIdentityNr.getBand()).isEqualTo(BAND);
        assertThat(anotherCellIdentityNr.getBands()).isEqualTo(BANDS);
        assertThat(anotherCellIdentityNr.getOperatorAlphaLong()).isEqualTo(ALPHAL);
        assertThat(anotherCellIdentityNr.getOperatorAlphaShort()).isEqualTo(ALPHAS);
        assertThat(anotherCellIdentityNr.getMccString()).isEqualTo(MCC);
+1 −1
Original line number Diff line number Diff line
@@ -1625,7 +1625,7 @@ public class RILTest extends TelephonyTest {
                (CellSignalStrengthNr) cellInfoNr.getCellSignalStrength();

        CellIdentityNr expectedCellIdentity = new CellIdentityNr(PCI, TAC, NRARFCN,
                CellInfo.UNAVAILABLE, MCC_STR, MNC_STR, CI, ALPHA_LONG, ALPHA_SHORT,
                Collections.emptyList(), MCC_STR, MNC_STR, CI, ALPHA_LONG, ALPHA_SHORT,
                Collections.emptyList());
        CellSignalStrengthNr expectedSignalStrength = new CellSignalStrengthNr(-RSRP, -RSRQ,
                SIGNAL_NOISE_RATIO, -RSRP, -RSRQ, SIGNAL_NOISE_RATIO);