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

Commit 37f0a0f3 authored by Nathan Harold's avatar Nathan Harold
Browse files

Stamp CellInfo with ElapsedRealtimeNanos at HAL

Stamp CellInfo results with the SystemClock nanos
when they are received from the vendor HAL, ensuring
that app users who read this field can interpret the
value against a well-defined reference clock.

Bug: 36971551
Test: atest FrameworksTelephonyTest
Change-Id: Ie1cf0ddc73f38e078022da0342d382ee017a276f
parent fd5797d1
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -5450,8 +5450,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            Parcel p = Parcel.obtain();
            p.writeInt(record.cellInfoType);
            p.writeInt(record.registered ? 1 : 0);
            p.writeInt(record.timeStampType);
            p.writeLong(record.timeStamp);
            p.writeLong(SystemClock.elapsedRealtimeNanos());
            p.writeInt(CellInfo.CONNECTION_UNKNOWN);
            switch (record.cellInfoType) {
                case CellInfoType.GSM: {
@@ -5577,8 +5576,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            Parcel p = Parcel.obtain();
            p.writeInt(record.cellInfoType);
            p.writeInt(record.registered ? 1 : 0);
            p.writeInt(record.timeStampType);
            p.writeLong(record.timeStamp);
            p.writeLong(SystemClock.elapsedRealtimeNanos());
            p.writeInt(record.connectionStatus);
            switch (record.cellInfoType) {
                case CellInfoType.GSM: {
+0 −2
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@ public class NetworkScanResultTest {
        CellSignalStrengthGsm cssg = new CellSignalStrengthGsm(5, 6, 7);
        CellInfoGsm gsm = new CellInfoGsm();
        gsm.setRegistered(true);
        gsm.setTimeStampType(8);
        gsm.setTimeStamp(9);
        gsm.setCellIdentity(cig);
        gsm.setCellSignalStrength(cssg);
@@ -55,7 +54,6 @@ public class NetworkScanResultTest {
        CellSignalStrengthLte cssl = new CellSignalStrengthLte(15, 16, 17, 18, 19, 20);
        CellInfoLte lte = new CellInfoLte();
        lte.setRegistered(false);
        lte.setTimeStampType(21);
        lte.setTimeStamp(22);
        lte.setCellIdentity(cil);
        lte.setCellSignalStrength(cssl);
+16 −16
Original line number Diff line number Diff line
@@ -1110,7 +1110,6 @@ public class RILTest extends TelephonyTest {
        CellInfoLte expected = new CellInfoLte();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityLte cil = new CellIdentityLte(CI, PCI, TAC, EARFCN, Integer.MAX_VALUE, MCC_STR,
                MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
        CellSignalStrengthLte css = new CellSignalStrengthLte(
@@ -1118,6 +1117,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(cil);
        expected.setCellSignalStrength(css);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_UNKNOWN);
        cellInfoLte.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoLte);
    }

@@ -1151,7 +1151,6 @@ public class RILTest extends TelephonyTest {
        CellInfoGsm expected = new CellInfoGsm();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityGsm ci = new CellIdentityGsm(
                LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
        CellSignalStrengthGsm cs = new CellSignalStrengthGsm(
@@ -1159,6 +1158,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(ci);
        expected.setCellSignalStrength(cs);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_UNKNOWN);
        cellInfoGsm.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoGsm);
    }

@@ -1191,7 +1191,6 @@ public class RILTest extends TelephonyTest {
        CellInfoWcdma expected = new CellInfoWcdma();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityWcdma ci = new CellIdentityWcdma(
                LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
        CellSignalStrengthWcdma cs = new CellSignalStrengthWcdma(
@@ -1199,6 +1198,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(ci);
        expected.setCellSignalStrength(cs);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_UNKNOWN);
        cellInfoWcdma.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoWcdma);
    }

@@ -1232,7 +1232,6 @@ public class RILTest extends TelephonyTest {
        CellInfoTdscdma expected = new CellInfoTdscdma();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
        CellIdentityTdscdma ci = new CellIdentityTdscdma(
                MCC_STR, MNC_STR, LAC, CID, PSC, UARFCN, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
@@ -1240,6 +1239,7 @@ public class RILTest extends TelephonyTest {
                SIGNAL_STRENGTH, BIT_ERROR_RATE, RSCP);
        expected.setCellIdentity(ci);
        expected.setCellSignalStrength(cs);
        cellInfoTdscdma.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoTdscdma);
    }

@@ -1274,7 +1274,6 @@ public class RILTest extends TelephonyTest {
        CellInfoCdma expected = new CellInfoCdma();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityCdma ci = new CellIdentityCdma(
                NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE,
                EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
@@ -1283,6 +1282,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(ci);
        expected.setCellSignalStrength(cs);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_UNKNOWN);
        cellInfoCdma.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoCdma);
    }

@@ -1295,7 +1295,6 @@ public class RILTest extends TelephonyTest {
        CellInfoLte expected = new CellInfoLte();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityLte cil = new CellIdentityLte(
                CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
        CellSignalStrengthLte css = new CellSignalStrengthLte(
@@ -1303,6 +1302,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(cil);
        expected.setCellSignalStrength(css);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
        cellInfoLte.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoLte);
    }

@@ -1316,7 +1316,6 @@ public class RILTest extends TelephonyTest {
        CellInfoLte expected = new CellInfoLte();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityLte cil = new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR,
                EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
        CellSignalStrengthLte css = new CellSignalStrengthLte(
@@ -1324,6 +1323,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(cil);
        expected.setCellSignalStrength(css);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
        cellInfoLte.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoLte);
    }

@@ -1339,7 +1339,6 @@ public class RILTest extends TelephonyTest {
        CellInfoLte expected = new CellInfoLte();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityLte cil = new CellIdentityLte(
                CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT);
        CellSignalStrengthLte css = new CellSignalStrengthLte(
@@ -1347,6 +1346,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(cil);
        expected.setCellSignalStrength(css);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
        cellInfoLte.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoLte);
    }

@@ -1359,7 +1359,6 @@ public class RILTest extends TelephonyTest {
        CellInfoGsm expected = new CellInfoGsm();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityGsm ci = new CellIdentityGsm(
                LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
        CellSignalStrengthGsm cs = new CellSignalStrengthGsm(
@@ -1367,6 +1366,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(ci);
        expected.setCellSignalStrength(cs);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
        cellInfoGsm.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoGsm);
    }

@@ -1380,7 +1380,6 @@ public class RILTest extends TelephonyTest {
        CellInfoGsm expected = new CellInfoGsm();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityGsm ci = new CellIdentityGsm(
                LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
        CellSignalStrengthGsm cs = new CellSignalStrengthGsm(
@@ -1388,6 +1387,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(ci);
        expected.setCellSignalStrength(cs);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
        cellInfoGsm.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoGsm);
    }

@@ -1403,7 +1403,6 @@ public class RILTest extends TelephonyTest {
        CellInfoGsm expected = new CellInfoGsm();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityGsm ci = new CellIdentityGsm(
                LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT);
        CellSignalStrengthGsm cs = new CellSignalStrengthGsm(
@@ -1411,6 +1410,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(ci);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
        expected.setCellSignalStrength(cs);
        cellInfoGsm.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoGsm);
    }

@@ -1424,7 +1424,6 @@ public class RILTest extends TelephonyTest {
        CellInfoWcdma expected = new CellInfoWcdma();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityWcdma ci = new CellIdentityWcdma(
                LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
        CellSignalStrengthWcdma cs =
@@ -1432,6 +1431,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(ci);
        expected.setCellSignalStrength(cs);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
        cellInfoWcdma.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoWcdma);
    }

@@ -1445,7 +1445,6 @@ public class RILTest extends TelephonyTest {
        CellInfoWcdma expected = new CellInfoWcdma();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityWcdma ci = new CellIdentityWcdma(
                LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
        CellSignalStrengthWcdma cs = new CellSignalStrengthWcdma(
@@ -1453,6 +1452,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(ci);
        expected.setCellSignalStrength(cs);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
        cellInfoWcdma.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoWcdma);
    }

@@ -1468,7 +1468,6 @@ public class RILTest extends TelephonyTest {
        CellInfoWcdma expected = new CellInfoWcdma();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityWcdma ci = new CellIdentityWcdma(
                LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT);
        CellSignalStrengthWcdma cs = new CellSignalStrengthWcdma(
@@ -1476,6 +1475,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(ci);
        expected.setCellSignalStrength(cs);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
        cellInfoWcdma.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoWcdma);
    }

@@ -1488,7 +1488,6 @@ public class RILTest extends TelephonyTest {
        CellInfoCdma expected = new CellInfoCdma();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityCdma ci = new CellIdentityCdma(
                NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE,
                ALPHA_LONG, ALPHA_SHORT);
@@ -1497,6 +1496,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(ci);
        expected.setCellSignalStrength(cs);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
        cellInfoCdma.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoCdma);
    }

@@ -1509,7 +1509,6 @@ public class RILTest extends TelephonyTest {
        CellInfoCdma expected = new CellInfoCdma();
        expected.setRegistered(false);
        expected.setTimeStamp(TIMESTAMP);
        expected.setTimeStampType(RIL_TIMESTAMP_TYPE_OEM_RIL);
        CellIdentityCdma ci = new CellIdentityCdma(
                NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE,
                EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
@@ -1518,6 +1517,7 @@ public class RILTest extends TelephonyTest {
        expected.setCellIdentity(ci);
        expected.setCellSignalStrength(cs);
        expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
        cellInfoCdma.setTimeStamp(TIMESTAMP); // override the timestamp
        assertEquals(expected, cellInfoCdma);
    }