Merge "update getStaticPhoneCapability to use HAL instead of default value"
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
index 03cb8b1..e18e3c1 100644
--- a/src/java/com/android/internal/telephony/RIL.java
+++ b/src/java/com/android/internal/telephony/RIL.java
@@ -5658,7 +5658,9 @@
ArrayList<android.hardware.radio.V1_0.CellInfo> records) {
ArrayList<CellInfo> response = new ArrayList<CellInfo>(records.size());
+ final long nanotime = SystemClock.elapsedRealtimeNanos();
for (android.hardware.radio.V1_0.CellInfo record : records) {
+ record.timeStamp = nanotime;
response.add(CellInfo.create(record));
}
@@ -5675,7 +5677,9 @@
ArrayList<android.hardware.radio.V1_2.CellInfo> records) {
ArrayList<CellInfo> response = new ArrayList<CellInfo>(records.size());
+ final long nanotime = SystemClock.elapsedRealtimeNanos();
for (android.hardware.radio.V1_2.CellInfo record : records) {
+ record.timeStamp = nanotime;
response.add(CellInfo.create(record));
}
return response;
@@ -5691,8 +5695,9 @@
ArrayList<android.hardware.radio.V1_4.CellInfo> records) {
ArrayList<CellInfo> response = new ArrayList<CellInfo>(records.size());
+ final long nanotime = SystemClock.elapsedRealtimeNanos();
for (android.hardware.radio.V1_4.CellInfo record : records) {
- response.add(CellInfo.create(record));
+ response.add(CellInfo.create(record, nanotime));
}
return response;
}
diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java
index 12e5845..87de18f 100644
--- a/src/java/com/android/internal/telephony/SubscriptionController.java
+++ b/src/java/com/android/internal/telephony/SubscriptionController.java
@@ -2771,6 +2771,8 @@
refreshCachedActiveSubscriptionInfoList();
+ notifySubscriptionInfoChanged();
+
return groupUUID;
} finally {
Binder.restoreCallingIdentity(identity);
@@ -2818,6 +2820,8 @@
refreshCachedActiveSubscriptionInfoList();
+ notifySubscriptionInfoChanged();
+
return result != 0;
} finally {
Binder.restoreCallingIdentity(identity);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/RILTest.java b/tests/telephonytests/src/com/android/internal/telephony/RILTest.java
index dfc2a0b..206ebea 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/RILTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/RILTest.java
@@ -151,6 +151,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
public class RILTest extends TelephonyTest {
@@ -212,7 +213,7 @@
private static final int RSSI_ASU = 24;
private static final int SYSTEM_ID = 65533;
private static final int TAC = 65535;
- private static final int TIME_ADVANCE = 4;
+ private static final int TIMING_ADVANCE = 4;
private static final long TIMESTAMP = 215924934;
private static final int UARFCN = 690;
private static final int TYPE_CDMA = 2;
@@ -1099,7 +1100,7 @@
lte.signalStrengthLte.rsrq = -RSRQ;
lte.signalStrengthLte.rssnr = RSSNR;
lte.signalStrengthLte.cqi = CQI;
- lte.signalStrengthLte.timingAdvance = TIME_ADVANCE;
+ lte.signalStrengthLte.timingAdvance = TIMING_ADVANCE;
android.hardware.radio.V1_0.CellInfo record = new android.hardware.radio.V1_0.CellInfo();
record.cellInfoType = TYPE_LTE;
record.registered = false;
@@ -1120,7 +1121,7 @@
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(
- RSSI, RSRP, RSRQ, RSSNR, CQI, TIME_ADVANCE);
+ RSSI, RSRP, RSRQ, RSSNR, CQI, TIMING_ADVANCE);
expected.setCellIdentity(cil);
expected.setCellSignalStrength(css);
expected.setCellConnectionStatus(CellInfo.CONNECTION_UNKNOWN);
@@ -1140,7 +1141,7 @@
cellinfo.cellIdentityGsm.mnc = MNC_STR;
cellinfo.signalStrengthGsm.signalStrength = RSSI_ASU;
cellinfo.signalStrengthGsm.bitErrorRate = BIT_ERROR_RATE;
- cellinfo.signalStrengthGsm.timingAdvance = TIME_ADVANCE;
+ cellinfo.signalStrengthGsm.timingAdvance = TIMING_ADVANCE;
android.hardware.radio.V1_0.CellInfo record = new android.hardware.radio.V1_0.CellInfo();
record.cellInfoType = TYPE_GSM;
record.registered = false;
@@ -1161,7 +1162,7 @@
CellIdentityGsm ci = new CellIdentityGsm(
LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
CellSignalStrengthGsm cs = new CellSignalStrengthGsm(
- RSSI, BIT_ERROR_RATE, TIME_ADVANCE);
+ RSSI, BIT_ERROR_RATE, TIMING_ADVANCE);
expected.setCellIdentity(ci);
expected.setCellSignalStrength(cs);
expected.setCellConnectionStatus(CellInfo.CONNECTION_UNKNOWN);
@@ -1305,7 +1306,7 @@
CellIdentityLte cil = new CellIdentityLte(
CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
CellSignalStrengthLte css = new CellSignalStrengthLte(
- RSSI, RSRP, RSRQ, RSSNR, CQI, TIME_ADVANCE);
+ RSSI, RSRP, RSRQ, RSSNR, CQI, TIMING_ADVANCE);
expected.setCellIdentity(cil);
expected.setCellSignalStrength(css);
expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
@@ -1326,7 +1327,7 @@
CellIdentityLte cil = new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR,
EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
CellSignalStrengthLte css = new CellSignalStrengthLte(
- RSSI, RSRP, RSRQ, RSSNR, CQI, TIME_ADVANCE);
+ RSSI, RSRP, RSRQ, RSSNR, CQI, TIMING_ADVANCE);
expected.setCellIdentity(cil);
expected.setCellSignalStrength(css);
expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
@@ -1349,7 +1350,7 @@
CellIdentityLte cil = new CellIdentityLte(
CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT);
CellSignalStrengthLte css = new CellSignalStrengthLte(
- RSSI, RSRP, RSRQ, RSSNR, CQI, TIME_ADVANCE);
+ RSSI, RSRP, RSRQ, RSSNR, CQI, TIMING_ADVANCE);
expected.setCellIdentity(cil);
expected.setCellSignalStrength(css);
expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
@@ -1369,7 +1370,7 @@
CellIdentityGsm ci = new CellIdentityGsm(
LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
CellSignalStrengthGsm cs = new CellSignalStrengthGsm(
- RSSI, BIT_ERROR_RATE, TIME_ADVANCE);
+ RSSI, BIT_ERROR_RATE, TIMING_ADVANCE);
expected.setCellIdentity(ci);
expected.setCellSignalStrength(cs);
expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
@@ -1390,7 +1391,7 @@
CellIdentityGsm ci = new CellIdentityGsm(
LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
CellSignalStrengthGsm cs = new CellSignalStrengthGsm(
- RSSI, BIT_ERROR_RATE, TIME_ADVANCE);
+ RSSI, BIT_ERROR_RATE, TIMING_ADVANCE);
expected.setCellIdentity(ci);
expected.setCellSignalStrength(cs);
expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
@@ -1413,7 +1414,7 @@
CellIdentityGsm ci = new CellIdentityGsm(
LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT);
CellSignalStrengthGsm cs = new CellSignalStrengthGsm(
- RSSI, BIT_ERROR_RATE, TIME_ADVANCE);
+ RSSI, BIT_ERROR_RATE, TIMING_ADVANCE);
expected.setCellIdentity(ci);
expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
expected.setCellSignalStrength(cs);
@@ -1603,24 +1604,89 @@
assertEquals("100:foo", request.getWorkSourceClientId());
}
- private ArrayList<CellInfo> getCellInfoListForLTE(
- String mcc, String mnc, String alphaLong, String alphaShort) {
- android.hardware.radio.V1_2.CellInfoLte lte = new android.hardware.radio.V1_2.CellInfoLte();
+ @Test
+ public void testCellInfoTimestamp_1_4() {
+ ArrayList<android.hardware.radio.V1_4.CellInfo> records =
+ new ArrayList<android.hardware.radio.V1_4.CellInfo>();
+
+ for (int i = 0; i < 5 /* arbitrary */; i++) {
+ android.hardware.radio.V1_4.CellInfo record =
+ new android.hardware.radio.V1_4.CellInfo();
+ record.info = new android.hardware.radio.V1_4.CellInfo.Info();
+ record.info.lte(new android.hardware.radio.V1_4.CellInfoLte());
+ initializeCellInfoLte_1_2(record.info.lte().base);
+ record.info.lte().base.cellIdentityLte.base.ci += i; // make them marginally unique
+
+ records.add(record);
+ }
+ List<CellInfo> cil = RIL.convertHalCellInfoList_1_4(records);
+
+ // Check that all timestamps are set to a valid number and are equal
+ final long ts = cil.get(0).getTimeStamp();
+ for (CellInfo ci : cil) {
+ assertTrue(ci.getTimeStamp() > 0 && ci.getTimeStamp() != Long.MAX_VALUE);
+ assertEquals(ci.getTimeStamp(), ts);
+ }
+ }
+
+ @Test
+ public void testCellInfoTimestamp_1_2() {
+ ArrayList<android.hardware.radio.V1_2.CellInfo> records =
+ new ArrayList<android.hardware.radio.V1_2.CellInfo>();
+
+ for (int i = 0; i < 5 /* arbitrary */; i++) {
+ android.hardware.radio.V1_2.CellInfo record =
+ new android.hardware.radio.V1_2.CellInfo();
+ record.cellInfoType = TYPE_LTE;
+ record.timeStamp = Long.MAX_VALUE;
+ record.registered = false;
+ record.timeStampType = RIL_TIMESTAMP_TYPE_OEM_RIL;
+ record.lte.add(new android.hardware.radio.V1_2.CellInfoLte());
+ initializeCellInfoLte_1_2(record.lte.get(0));
+ record.lte.get(0).cellIdentityLte.base.ci += i; // make them marginally unique
+
+ records.add(record);
+ }
+ List<CellInfo> cil = RIL.convertHalCellInfoList_1_2(records);
+
+ // Check that all timestamps are set to a valid number and are equal
+ final long ts = cil.get(0).getTimeStamp();
+ for (CellInfo ci : cil) {
+ assertTrue(ci.getTimeStamp() > 0 && ci.getTimeStamp() != Long.MAX_VALUE);
+ assertEquals(ci.getTimeStamp(), ts);
+ }
+ }
+
+ private static void initializeCellInfoLte_1_2(android.hardware.radio.V1_2.CellInfoLte lte) {
lte.cellIdentityLte.base.ci = CI;
lte.cellIdentityLte.base.pci = PCI;
lte.cellIdentityLte.base.tac = TAC;
lte.cellIdentityLte.base.earfcn = EARFCN;
lte.cellIdentityLte.bandwidth = BANDWIDTH;
- lte.cellIdentityLte.base.mcc = mcc;
- lte.cellIdentityLte.base.mnc = mnc;
- lte.cellIdentityLte.operatorNames.alphaLong = alphaLong;
- lte.cellIdentityLte.operatorNames.alphaShort = alphaShort;
lte.signalStrengthLte.signalStrength = RSSI_ASU;
lte.signalStrengthLte.rsrp = -RSRP;
lte.signalStrengthLte.rsrq = -RSRQ;
lte.signalStrengthLte.rssnr = RSSNR;
lte.signalStrengthLte.cqi = CQI;
- lte.signalStrengthLte.timingAdvance = TIME_ADVANCE;
+ lte.signalStrengthLte.timingAdvance = TIMING_ADVANCE;
+
+ lte.cellIdentityLte.operatorNames.alphaLong = ALPHA_LONG;
+ lte.cellIdentityLte.operatorNames.alphaShort = ALPHA_SHORT;
+ lte.cellIdentityLte.base.mcc = MCC_STR;
+ lte.cellIdentityLte.base.mnc = MNC_STR;
+ }
+
+ private ArrayList<CellInfo> getCellInfoListForLTE(
+ String mcc, String mnc, String alphaLong, String alphaShort) {
+ android.hardware.radio.V1_2.CellInfoLte lte = new android.hardware.radio.V1_2.CellInfoLte();
+
+ initializeCellInfoLte_1_2(lte);
+ // Override the defaults for test-specific purposes
+ lte.cellIdentityLte.operatorNames.alphaLong = alphaLong;
+ lte.cellIdentityLte.operatorNames.alphaShort = alphaShort;
+ lte.cellIdentityLte.base.mcc = mcc;
+ lte.cellIdentityLte.base.mnc = mnc;
+
android.hardware.radio.V1_2.CellInfo record = new android.hardware.radio.V1_2.CellInfo();
record.cellInfoType = TYPE_LTE;
record.registered = false;
@@ -1648,7 +1714,7 @@
cellinfo.cellIdentityGsm.operatorNames.alphaShort = alphaShort;
cellinfo.signalStrengthGsm.signalStrength = RSSI_ASU;
cellinfo.signalStrengthGsm.bitErrorRate = BIT_ERROR_RATE;
- cellinfo.signalStrengthGsm.timingAdvance = TIME_ADVANCE;
+ cellinfo.signalStrengthGsm.timingAdvance = TIMING_ADVANCE;
android.hardware.radio.V1_2.CellInfo record = new android.hardware.radio.V1_2.CellInfo();
record.cellInfoType = TYPE_GSM;
record.registered = false;