Loading src/java/com/android/internal/telephony/RIL.java +229 −47 Original line number Diff line number Diff line Loading @@ -4816,11 +4816,79 @@ public class RIL extends BaseCommands implements CommandsInterface { return capacityResponse; } private static void writeToParcelForGsm( Parcel p, int lac, int cid, int arfcn, int bsic, String mcc, String mnc, String al, String as, int ss, int ber, int ta) { p.writeInt(lac); p.writeInt(cid); p.writeInt(arfcn); p.writeInt(bsic); p.writeString(mcc); p.writeString(mnc); p.writeString(al); p.writeString(as); p.writeInt(ss); p.writeInt(ber); p.writeInt(ta); } private static void writeToParcelForCdma( Parcel p, int ni, int si, int bsi, int lon, int lat, String al, String as, int dbm, int ecio, int eDbm, int eEcio, int eSnr) { p.writeInt(ni); p.writeInt(si); p.writeInt(bsi); p.writeInt(lon); p.writeInt(lat); p.writeString(al); p.writeString(as); p.writeInt(dbm); p.writeInt(ecio); p.writeInt(eDbm); p.writeInt(eEcio); p.writeInt(eSnr); } private static void writeToParcelForLte( Parcel p, int ci, int pci, int tac, int earfcn, String mcc, String mnc, String al, String as, int ss, int rsrp, int rsrq, int rssnr, int cqi, int ta) { p.writeInt(ci); p.writeInt(pci); p.writeInt(tac); p.writeInt(earfcn); p.writeString(mcc); p.writeString(mnc); p.writeString(al); p.writeString(as); p.writeInt(ss); p.writeInt(rsrp); p.writeInt(rsrq); p.writeInt(rssnr); p.writeInt(cqi); p.writeInt(ta); } private static void writeToParcelForWcdma( Parcel p, int lac, int cid, int psc, int uarfcn, String mcc, String mnc, String al, String as, int ss, int ber) { p.writeInt(lac); p.writeInt(cid); p.writeInt(psc); p.writeInt(uarfcn); p.writeString(mcc); p.writeString(mnc); p.writeString(al); p.writeString(as); p.writeInt(ss); p.writeInt(ber); } /** * Convert CellInfo defined in 1.0/types.hal to CellInfo type. * @param records List of CellInfo defined in 1.0/types.hal * @return List of converted CellInfo object */ @VisibleForTesting public static ArrayList<CellInfo> convertHalCellInfoList( ArrayList<android.hardware.radio.V1_0.CellInfo> records) { ArrayList<CellInfo> response = new ArrayList<CellInfo>(records.size()); Loading @@ -4835,68 +4903,182 @@ public class RIL extends BaseCommands implements CommandsInterface { switch (record.cellInfoType) { case CellInfoType.GSM: { CellInfoGsm cellInfoGsm = record.gsm.get(0); p.writeInt(cellInfoGsm.cellIdentityGsm.lac); p.writeInt(cellInfoGsm.cellIdentityGsm.cid); p.writeInt(cellInfoGsm.cellIdentityGsm.arfcn); p.writeInt(Byte.toUnsignedInt(cellInfoGsm.cellIdentityGsm.bsic)); p.writeString(cellInfoGsm.cellIdentityGsm.mcc); p.writeString(cellInfoGsm.cellIdentityGsm.mnc); p.writeString(EMPTY_ALPHA_LONG); p.writeString(EMPTY_ALPHA_SHORT); p.writeInt(cellInfoGsm.signalStrengthGsm.signalStrength); p.writeInt(cellInfoGsm.signalStrengthGsm.bitErrorRate); p.writeInt(cellInfoGsm.signalStrengthGsm.timingAdvance); writeToParcelForGsm( p, cellInfoGsm.cellIdentityGsm.lac, cellInfoGsm.cellIdentityGsm.cid, cellInfoGsm.cellIdentityGsm.arfcn, Byte.toUnsignedInt(cellInfoGsm.cellIdentityGsm.bsic), cellInfoGsm.cellIdentityGsm.mcc, cellInfoGsm.cellIdentityGsm.mnc, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT, cellInfoGsm.signalStrengthGsm.signalStrength, cellInfoGsm.signalStrengthGsm.bitErrorRate, cellInfoGsm.signalStrengthGsm.timingAdvance); break; } case CellInfoType.CDMA: { CellInfoCdma cellInfoCdma = record.cdma.get(0); p.writeInt(cellInfoCdma.cellIdentityCdma.networkId); p.writeInt(cellInfoCdma.cellIdentityCdma.systemId); p.writeInt(cellInfoCdma.cellIdentityCdma.baseStationId); p.writeInt(cellInfoCdma.cellIdentityCdma.longitude); p.writeInt(cellInfoCdma.cellIdentityCdma.latitude); p.writeString(EMPTY_ALPHA_LONG); p.writeString(EMPTY_ALPHA_SHORT); p.writeInt(cellInfoCdma.signalStrengthCdma.dbm); p.writeInt(cellInfoCdma.signalStrengthCdma.ecio); p.writeInt(cellInfoCdma.signalStrengthEvdo.dbm); p.writeInt(cellInfoCdma.signalStrengthEvdo.ecio); p.writeInt(cellInfoCdma.signalStrengthEvdo.signalNoiseRatio); writeToParcelForCdma( p, cellInfoCdma.cellIdentityCdma.networkId, cellInfoCdma.cellIdentityCdma.systemId, cellInfoCdma.cellIdentityCdma.baseStationId, cellInfoCdma.cellIdentityCdma.longitude, cellInfoCdma.cellIdentityCdma.latitude, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT, cellInfoCdma.signalStrengthCdma.dbm, cellInfoCdma.signalStrengthCdma.ecio, cellInfoCdma.signalStrengthEvdo.dbm, cellInfoCdma.signalStrengthEvdo.ecio, cellInfoCdma.signalStrengthEvdo.signalNoiseRatio); break; } case CellInfoType.LTE: { CellInfoLte cellInfoLte = record.lte.get(0); p.writeInt(cellInfoLte.cellIdentityLte.ci); p.writeInt(cellInfoLte.cellIdentityLte.pci); p.writeInt(cellInfoLte.cellIdentityLte.tac); p.writeInt(cellInfoLte.cellIdentityLte.earfcn); p.writeString(cellInfoLte.cellIdentityLte.mcc); p.writeString(cellInfoLte.cellIdentityLte.mnc); p.writeString(EMPTY_ALPHA_LONG); p.writeString(EMPTY_ALPHA_SHORT); p.writeInt(cellInfoLte.signalStrengthLte.signalStrength); p.writeInt(cellInfoLte.signalStrengthLte.rsrp); p.writeInt(cellInfoLte.signalStrengthLte.rsrq); p.writeInt(cellInfoLte.signalStrengthLte.rssnr); p.writeInt(cellInfoLte.signalStrengthLte.cqi); p.writeInt(cellInfoLte.signalStrengthLte.timingAdvance); writeToParcelForLte( p, cellInfoLte.cellIdentityLte.ci, cellInfoLte.cellIdentityLte.pci, cellInfoLte.cellIdentityLte.tac, cellInfoLte.cellIdentityLte.earfcn, cellInfoLte.cellIdentityLte.mcc, cellInfoLte.cellIdentityLte.mnc, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT, cellInfoLte.signalStrengthLte.signalStrength, cellInfoLte.signalStrengthLte.rsrp, cellInfoLte.signalStrengthLte.rsrq, cellInfoLte.signalStrengthLte.rssnr, cellInfoLte.signalStrengthLte.cqi, cellInfoLte.signalStrengthLte.timingAdvance); break; } case CellInfoType.WCDMA: { CellInfoWcdma cellInfoWcdma = record.wcdma.get(0); p.writeInt(cellInfoWcdma.cellIdentityWcdma.lac); p.writeInt(cellInfoWcdma.cellIdentityWcdma.cid); p.writeInt(cellInfoWcdma.cellIdentityWcdma.psc); p.writeInt(cellInfoWcdma.cellIdentityWcdma.uarfcn); p.writeString(cellInfoWcdma.cellIdentityWcdma.mcc); p.writeString(cellInfoWcdma.cellIdentityWcdma.mnc); p.writeString(EMPTY_ALPHA_LONG); p.writeString(EMPTY_ALPHA_SHORT); p.writeInt(cellInfoWcdma.signalStrengthWcdma.signalStrength); p.writeInt(cellInfoWcdma.signalStrengthWcdma.bitErrorRate); writeToParcelForWcdma( p, cellInfoWcdma.cellIdentityWcdma.lac, cellInfoWcdma.cellIdentityWcdma.cid, cellInfoWcdma.cellIdentityWcdma.psc, cellInfoWcdma.cellIdentityWcdma.uarfcn, cellInfoWcdma.cellIdentityWcdma.mcc, cellInfoWcdma.cellIdentityWcdma.mnc, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT, cellInfoWcdma.signalStrengthWcdma.signalStrength, cellInfoWcdma.signalStrengthWcdma.bitErrorRate); break; } default: throw new RuntimeException("unexpected cellinfotype: " + record.cellInfoType); } p.setDataPosition(0); CellInfo InfoRec = CellInfo.CREATOR.createFromParcel(p); p.recycle(); response.add(InfoRec); } return response; } /** * Convert CellInfo defined in 1.2/types.hal to CellInfo type. * @param records List of CellInfo defined in 1.2/types.hal * @return List of converted CellInfo object */ @VisibleForTesting public static ArrayList<CellInfo> convertHalCellInfoList_1_2( ArrayList<android.hardware.radio.V1_2.CellInfo> records) { ArrayList<CellInfo> response = new ArrayList<CellInfo>(records.size()); for (android.hardware.radio.V1_2.CellInfo record : records) { // first convert RIL CellInfo to Parcel Parcel p = Parcel.obtain(); p.writeInt(record.cellInfoType); p.writeInt(record.registered ? 1 : 0); p.writeInt(record.timeStampType); p.writeLong(record.timeStamp); switch (record.cellInfoType) { case CellInfoType.GSM: { android.hardware.radio.V1_2.CellInfoGsm cellInfoGsm = record.gsm.get(0); writeToParcelForGsm( p, cellInfoGsm.cellIdentityGsm.base.lac, cellInfoGsm.cellIdentityGsm.base.cid, cellInfoGsm.cellIdentityGsm.base.arfcn, Byte.toUnsignedInt(cellInfoGsm.cellIdentityGsm.base.bsic), cellInfoGsm.cellIdentityGsm.base.mcc, cellInfoGsm.cellIdentityGsm.base.mnc, cellInfoGsm.cellIdentityGsm.operatorNames.alphaLong, cellInfoGsm.cellIdentityGsm.operatorNames.alphaShort, cellInfoGsm.signalStrengthGsm.signalStrength, cellInfoGsm.signalStrengthGsm.bitErrorRate, cellInfoGsm.signalStrengthGsm.timingAdvance); break; } case CellInfoType.CDMA: { android.hardware.radio.V1_2.CellInfoCdma cellInfoCdma = record.cdma.get(0); writeToParcelForCdma( p, cellInfoCdma.cellIdentityCdma.base.networkId, cellInfoCdma.cellIdentityCdma.base.systemId, cellInfoCdma.cellIdentityCdma.base.baseStationId, cellInfoCdma.cellIdentityCdma.base.longitude, cellInfoCdma.cellIdentityCdma.base.latitude, cellInfoCdma.cellIdentityCdma.operatorNames.alphaLong, cellInfoCdma.cellIdentityCdma.operatorNames.alphaShort, cellInfoCdma.signalStrengthCdma.dbm, cellInfoCdma.signalStrengthCdma.ecio, cellInfoCdma.signalStrengthEvdo.dbm, cellInfoCdma.signalStrengthEvdo.ecio, cellInfoCdma.signalStrengthEvdo.signalNoiseRatio); break; } case CellInfoType.LTE: { android.hardware.radio.V1_2.CellInfoLte cellInfoLte = record.lte.get(0); writeToParcelForLte( p, cellInfoLte.cellIdentityLte.base.ci, cellInfoLte.cellIdentityLte.base.pci, cellInfoLte.cellIdentityLte.base.tac, cellInfoLte.cellIdentityLte.base.earfcn, cellInfoLte.cellIdentityLte.base.mcc, cellInfoLte.cellIdentityLte.base.mnc, cellInfoLte.cellIdentityLte.operatorNames.alphaLong, cellInfoLte.cellIdentityLte.operatorNames.alphaShort, cellInfoLte.signalStrengthLte.signalStrength, cellInfoLte.signalStrengthLte.rsrp, cellInfoLte.signalStrengthLte.rsrq, cellInfoLte.signalStrengthLte.rssnr, cellInfoLte.signalStrengthLte.cqi, cellInfoLte.signalStrengthLte.timingAdvance); break; } case CellInfoType.WCDMA: { android.hardware.radio.V1_2.CellInfoWcdma cellInfoWcdma = record.wcdma.get(0); writeToParcelForWcdma( p, cellInfoWcdma.cellIdentityWcdma.base.lac, cellInfoWcdma.cellIdentityWcdma.base.cid, cellInfoWcdma.cellIdentityWcdma.base.psc, cellInfoWcdma.cellIdentityWcdma.base.uarfcn, cellInfoWcdma.cellIdentityWcdma.base.mcc, cellInfoWcdma.cellIdentityWcdma.base.mnc, cellInfoWcdma.cellIdentityWcdma.operatorNames.alphaLong, cellInfoWcdma.cellIdentityWcdma.operatorNames.alphaShort, cellInfoWcdma.signalStrengthWcdma.signalStrength, cellInfoWcdma.signalStrengthWcdma.bitErrorRate); break; } Loading src/java/com/android/internal/telephony/RadioIndication.java +17 −0 Original line number Diff line number Diff line Loading @@ -640,6 +640,12 @@ public class RadioIndication extends IRadioIndication.Stub { responseCellInfos(indicationType, result); } /** Incremental network scan results with HAL V1_2 */ public void networkScanResult_1_2(int indicationType, android.hardware.radio.V1_2.NetworkScanResult result) { responseCellInfos_1_2(indicationType, result); } public void imsNetworkStateChanged(int indicationType) { mRil.processIndication(indicationType); Loading Loading @@ -842,4 +848,15 @@ public class RadioIndication extends IRadioIndication.Stub { if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_NETWORK_SCAN_RESULT, nsr); mRil.mRilNetworkScanResultRegistrants.notifyRegistrants(new AsyncResult(null, nsr, null)); } private void responseCellInfos_1_2(int indicationType, android.hardware.radio.V1_2.NetworkScanResult result) { mRil.processIndication(indicationType); NetworkScanResult nsr = null; ArrayList<CellInfo> infos = RIL.convertHalCellInfoList_1_2(result.networkInfos); nsr = new NetworkScanResult(result.status, result.error, infos); if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_NETWORK_SCAN_RESULT, nsr); mRil.mRilNetworkScanResultRegistrants.notifyRegistrants(new AsyncResult(null, nsr, null)); } } src/java/com/android/internal/telephony/RadioResponse.java +24 −0 Original line number Diff line number Diff line Loading @@ -944,6 +944,16 @@ public class RadioResponse extends IRadioResponse.Stub { responseCellInfoList(responseInfo, cellInfo); } /** * @param responseInfo Response info struct containing response type, serial no. and error * @param cellInfo List of current cell information known to radio */ public void getCellInfoListResponse_1_2( RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_2.CellInfo> cellInfo) { responseCellInfoList_1_2(responseInfo, cellInfo); } /** * @param responseInfo Response info struct containing response type, serial no. and error */ Loading Loading @@ -1681,6 +1691,20 @@ public class RadioResponse extends IRadioResponse.Stub { } } private void responseCellInfoList_1_2( RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_2.CellInfo> cellInfo) { RILRequest rr = mRil.processResponse(responseInfo); if (rr != null) { ArrayList<CellInfo> ret = RIL.convertHalCellInfoList_1_2(cellInfo); if (responseInfo.error == RadioError.NONE) { sendMessageResponse(rr.mResult, ret); } mRil.processResponseDone(rr, responseInfo, ret); } } private void responseActivityData(RadioResponseInfo responseInfo, ActivityStatsInfo activityInfo) { RILRequest rr = mRil.processResponse(responseInfo); Loading tests/telephonytests/src/com/android/internal/telephony/RILTest.java +333 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
src/java/com/android/internal/telephony/RIL.java +229 −47 Original line number Diff line number Diff line Loading @@ -4816,11 +4816,79 @@ public class RIL extends BaseCommands implements CommandsInterface { return capacityResponse; } private static void writeToParcelForGsm( Parcel p, int lac, int cid, int arfcn, int bsic, String mcc, String mnc, String al, String as, int ss, int ber, int ta) { p.writeInt(lac); p.writeInt(cid); p.writeInt(arfcn); p.writeInt(bsic); p.writeString(mcc); p.writeString(mnc); p.writeString(al); p.writeString(as); p.writeInt(ss); p.writeInt(ber); p.writeInt(ta); } private static void writeToParcelForCdma( Parcel p, int ni, int si, int bsi, int lon, int lat, String al, String as, int dbm, int ecio, int eDbm, int eEcio, int eSnr) { p.writeInt(ni); p.writeInt(si); p.writeInt(bsi); p.writeInt(lon); p.writeInt(lat); p.writeString(al); p.writeString(as); p.writeInt(dbm); p.writeInt(ecio); p.writeInt(eDbm); p.writeInt(eEcio); p.writeInt(eSnr); } private static void writeToParcelForLte( Parcel p, int ci, int pci, int tac, int earfcn, String mcc, String mnc, String al, String as, int ss, int rsrp, int rsrq, int rssnr, int cqi, int ta) { p.writeInt(ci); p.writeInt(pci); p.writeInt(tac); p.writeInt(earfcn); p.writeString(mcc); p.writeString(mnc); p.writeString(al); p.writeString(as); p.writeInt(ss); p.writeInt(rsrp); p.writeInt(rsrq); p.writeInt(rssnr); p.writeInt(cqi); p.writeInt(ta); } private static void writeToParcelForWcdma( Parcel p, int lac, int cid, int psc, int uarfcn, String mcc, String mnc, String al, String as, int ss, int ber) { p.writeInt(lac); p.writeInt(cid); p.writeInt(psc); p.writeInt(uarfcn); p.writeString(mcc); p.writeString(mnc); p.writeString(al); p.writeString(as); p.writeInt(ss); p.writeInt(ber); } /** * Convert CellInfo defined in 1.0/types.hal to CellInfo type. * @param records List of CellInfo defined in 1.0/types.hal * @return List of converted CellInfo object */ @VisibleForTesting public static ArrayList<CellInfo> convertHalCellInfoList( ArrayList<android.hardware.radio.V1_0.CellInfo> records) { ArrayList<CellInfo> response = new ArrayList<CellInfo>(records.size()); Loading @@ -4835,68 +4903,182 @@ public class RIL extends BaseCommands implements CommandsInterface { switch (record.cellInfoType) { case CellInfoType.GSM: { CellInfoGsm cellInfoGsm = record.gsm.get(0); p.writeInt(cellInfoGsm.cellIdentityGsm.lac); p.writeInt(cellInfoGsm.cellIdentityGsm.cid); p.writeInt(cellInfoGsm.cellIdentityGsm.arfcn); p.writeInt(Byte.toUnsignedInt(cellInfoGsm.cellIdentityGsm.bsic)); p.writeString(cellInfoGsm.cellIdentityGsm.mcc); p.writeString(cellInfoGsm.cellIdentityGsm.mnc); p.writeString(EMPTY_ALPHA_LONG); p.writeString(EMPTY_ALPHA_SHORT); p.writeInt(cellInfoGsm.signalStrengthGsm.signalStrength); p.writeInt(cellInfoGsm.signalStrengthGsm.bitErrorRate); p.writeInt(cellInfoGsm.signalStrengthGsm.timingAdvance); writeToParcelForGsm( p, cellInfoGsm.cellIdentityGsm.lac, cellInfoGsm.cellIdentityGsm.cid, cellInfoGsm.cellIdentityGsm.arfcn, Byte.toUnsignedInt(cellInfoGsm.cellIdentityGsm.bsic), cellInfoGsm.cellIdentityGsm.mcc, cellInfoGsm.cellIdentityGsm.mnc, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT, cellInfoGsm.signalStrengthGsm.signalStrength, cellInfoGsm.signalStrengthGsm.bitErrorRate, cellInfoGsm.signalStrengthGsm.timingAdvance); break; } case CellInfoType.CDMA: { CellInfoCdma cellInfoCdma = record.cdma.get(0); p.writeInt(cellInfoCdma.cellIdentityCdma.networkId); p.writeInt(cellInfoCdma.cellIdentityCdma.systemId); p.writeInt(cellInfoCdma.cellIdentityCdma.baseStationId); p.writeInt(cellInfoCdma.cellIdentityCdma.longitude); p.writeInt(cellInfoCdma.cellIdentityCdma.latitude); p.writeString(EMPTY_ALPHA_LONG); p.writeString(EMPTY_ALPHA_SHORT); p.writeInt(cellInfoCdma.signalStrengthCdma.dbm); p.writeInt(cellInfoCdma.signalStrengthCdma.ecio); p.writeInt(cellInfoCdma.signalStrengthEvdo.dbm); p.writeInt(cellInfoCdma.signalStrengthEvdo.ecio); p.writeInt(cellInfoCdma.signalStrengthEvdo.signalNoiseRatio); writeToParcelForCdma( p, cellInfoCdma.cellIdentityCdma.networkId, cellInfoCdma.cellIdentityCdma.systemId, cellInfoCdma.cellIdentityCdma.baseStationId, cellInfoCdma.cellIdentityCdma.longitude, cellInfoCdma.cellIdentityCdma.latitude, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT, cellInfoCdma.signalStrengthCdma.dbm, cellInfoCdma.signalStrengthCdma.ecio, cellInfoCdma.signalStrengthEvdo.dbm, cellInfoCdma.signalStrengthEvdo.ecio, cellInfoCdma.signalStrengthEvdo.signalNoiseRatio); break; } case CellInfoType.LTE: { CellInfoLte cellInfoLte = record.lte.get(0); p.writeInt(cellInfoLte.cellIdentityLte.ci); p.writeInt(cellInfoLte.cellIdentityLte.pci); p.writeInt(cellInfoLte.cellIdentityLte.tac); p.writeInt(cellInfoLte.cellIdentityLte.earfcn); p.writeString(cellInfoLte.cellIdentityLte.mcc); p.writeString(cellInfoLte.cellIdentityLte.mnc); p.writeString(EMPTY_ALPHA_LONG); p.writeString(EMPTY_ALPHA_SHORT); p.writeInt(cellInfoLte.signalStrengthLte.signalStrength); p.writeInt(cellInfoLte.signalStrengthLte.rsrp); p.writeInt(cellInfoLte.signalStrengthLte.rsrq); p.writeInt(cellInfoLte.signalStrengthLte.rssnr); p.writeInt(cellInfoLte.signalStrengthLte.cqi); p.writeInt(cellInfoLte.signalStrengthLte.timingAdvance); writeToParcelForLte( p, cellInfoLte.cellIdentityLte.ci, cellInfoLte.cellIdentityLte.pci, cellInfoLte.cellIdentityLte.tac, cellInfoLte.cellIdentityLte.earfcn, cellInfoLte.cellIdentityLte.mcc, cellInfoLte.cellIdentityLte.mnc, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT, cellInfoLte.signalStrengthLte.signalStrength, cellInfoLte.signalStrengthLte.rsrp, cellInfoLte.signalStrengthLte.rsrq, cellInfoLte.signalStrengthLte.rssnr, cellInfoLte.signalStrengthLte.cqi, cellInfoLte.signalStrengthLte.timingAdvance); break; } case CellInfoType.WCDMA: { CellInfoWcdma cellInfoWcdma = record.wcdma.get(0); p.writeInt(cellInfoWcdma.cellIdentityWcdma.lac); p.writeInt(cellInfoWcdma.cellIdentityWcdma.cid); p.writeInt(cellInfoWcdma.cellIdentityWcdma.psc); p.writeInt(cellInfoWcdma.cellIdentityWcdma.uarfcn); p.writeString(cellInfoWcdma.cellIdentityWcdma.mcc); p.writeString(cellInfoWcdma.cellIdentityWcdma.mnc); p.writeString(EMPTY_ALPHA_LONG); p.writeString(EMPTY_ALPHA_SHORT); p.writeInt(cellInfoWcdma.signalStrengthWcdma.signalStrength); p.writeInt(cellInfoWcdma.signalStrengthWcdma.bitErrorRate); writeToParcelForWcdma( p, cellInfoWcdma.cellIdentityWcdma.lac, cellInfoWcdma.cellIdentityWcdma.cid, cellInfoWcdma.cellIdentityWcdma.psc, cellInfoWcdma.cellIdentityWcdma.uarfcn, cellInfoWcdma.cellIdentityWcdma.mcc, cellInfoWcdma.cellIdentityWcdma.mnc, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT, cellInfoWcdma.signalStrengthWcdma.signalStrength, cellInfoWcdma.signalStrengthWcdma.bitErrorRate); break; } default: throw new RuntimeException("unexpected cellinfotype: " + record.cellInfoType); } p.setDataPosition(0); CellInfo InfoRec = CellInfo.CREATOR.createFromParcel(p); p.recycle(); response.add(InfoRec); } return response; } /** * Convert CellInfo defined in 1.2/types.hal to CellInfo type. * @param records List of CellInfo defined in 1.2/types.hal * @return List of converted CellInfo object */ @VisibleForTesting public static ArrayList<CellInfo> convertHalCellInfoList_1_2( ArrayList<android.hardware.radio.V1_2.CellInfo> records) { ArrayList<CellInfo> response = new ArrayList<CellInfo>(records.size()); for (android.hardware.radio.V1_2.CellInfo record : records) { // first convert RIL CellInfo to Parcel Parcel p = Parcel.obtain(); p.writeInt(record.cellInfoType); p.writeInt(record.registered ? 1 : 0); p.writeInt(record.timeStampType); p.writeLong(record.timeStamp); switch (record.cellInfoType) { case CellInfoType.GSM: { android.hardware.radio.V1_2.CellInfoGsm cellInfoGsm = record.gsm.get(0); writeToParcelForGsm( p, cellInfoGsm.cellIdentityGsm.base.lac, cellInfoGsm.cellIdentityGsm.base.cid, cellInfoGsm.cellIdentityGsm.base.arfcn, Byte.toUnsignedInt(cellInfoGsm.cellIdentityGsm.base.bsic), cellInfoGsm.cellIdentityGsm.base.mcc, cellInfoGsm.cellIdentityGsm.base.mnc, cellInfoGsm.cellIdentityGsm.operatorNames.alphaLong, cellInfoGsm.cellIdentityGsm.operatorNames.alphaShort, cellInfoGsm.signalStrengthGsm.signalStrength, cellInfoGsm.signalStrengthGsm.bitErrorRate, cellInfoGsm.signalStrengthGsm.timingAdvance); break; } case CellInfoType.CDMA: { android.hardware.radio.V1_2.CellInfoCdma cellInfoCdma = record.cdma.get(0); writeToParcelForCdma( p, cellInfoCdma.cellIdentityCdma.base.networkId, cellInfoCdma.cellIdentityCdma.base.systemId, cellInfoCdma.cellIdentityCdma.base.baseStationId, cellInfoCdma.cellIdentityCdma.base.longitude, cellInfoCdma.cellIdentityCdma.base.latitude, cellInfoCdma.cellIdentityCdma.operatorNames.alphaLong, cellInfoCdma.cellIdentityCdma.operatorNames.alphaShort, cellInfoCdma.signalStrengthCdma.dbm, cellInfoCdma.signalStrengthCdma.ecio, cellInfoCdma.signalStrengthEvdo.dbm, cellInfoCdma.signalStrengthEvdo.ecio, cellInfoCdma.signalStrengthEvdo.signalNoiseRatio); break; } case CellInfoType.LTE: { android.hardware.radio.V1_2.CellInfoLte cellInfoLte = record.lte.get(0); writeToParcelForLte( p, cellInfoLte.cellIdentityLte.base.ci, cellInfoLte.cellIdentityLte.base.pci, cellInfoLte.cellIdentityLte.base.tac, cellInfoLte.cellIdentityLte.base.earfcn, cellInfoLte.cellIdentityLte.base.mcc, cellInfoLte.cellIdentityLte.base.mnc, cellInfoLte.cellIdentityLte.operatorNames.alphaLong, cellInfoLte.cellIdentityLte.operatorNames.alphaShort, cellInfoLte.signalStrengthLte.signalStrength, cellInfoLte.signalStrengthLte.rsrp, cellInfoLte.signalStrengthLte.rsrq, cellInfoLte.signalStrengthLte.rssnr, cellInfoLte.signalStrengthLte.cqi, cellInfoLte.signalStrengthLte.timingAdvance); break; } case CellInfoType.WCDMA: { android.hardware.radio.V1_2.CellInfoWcdma cellInfoWcdma = record.wcdma.get(0); writeToParcelForWcdma( p, cellInfoWcdma.cellIdentityWcdma.base.lac, cellInfoWcdma.cellIdentityWcdma.base.cid, cellInfoWcdma.cellIdentityWcdma.base.psc, cellInfoWcdma.cellIdentityWcdma.base.uarfcn, cellInfoWcdma.cellIdentityWcdma.base.mcc, cellInfoWcdma.cellIdentityWcdma.base.mnc, cellInfoWcdma.cellIdentityWcdma.operatorNames.alphaLong, cellInfoWcdma.cellIdentityWcdma.operatorNames.alphaShort, cellInfoWcdma.signalStrengthWcdma.signalStrength, cellInfoWcdma.signalStrengthWcdma.bitErrorRate); break; } Loading
src/java/com/android/internal/telephony/RadioIndication.java +17 −0 Original line number Diff line number Diff line Loading @@ -640,6 +640,12 @@ public class RadioIndication extends IRadioIndication.Stub { responseCellInfos(indicationType, result); } /** Incremental network scan results with HAL V1_2 */ public void networkScanResult_1_2(int indicationType, android.hardware.radio.V1_2.NetworkScanResult result) { responseCellInfos_1_2(indicationType, result); } public void imsNetworkStateChanged(int indicationType) { mRil.processIndication(indicationType); Loading Loading @@ -842,4 +848,15 @@ public class RadioIndication extends IRadioIndication.Stub { if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_NETWORK_SCAN_RESULT, nsr); mRil.mRilNetworkScanResultRegistrants.notifyRegistrants(new AsyncResult(null, nsr, null)); } private void responseCellInfos_1_2(int indicationType, android.hardware.radio.V1_2.NetworkScanResult result) { mRil.processIndication(indicationType); NetworkScanResult nsr = null; ArrayList<CellInfo> infos = RIL.convertHalCellInfoList_1_2(result.networkInfos); nsr = new NetworkScanResult(result.status, result.error, infos); if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_NETWORK_SCAN_RESULT, nsr); mRil.mRilNetworkScanResultRegistrants.notifyRegistrants(new AsyncResult(null, nsr, null)); } }
src/java/com/android/internal/telephony/RadioResponse.java +24 −0 Original line number Diff line number Diff line Loading @@ -944,6 +944,16 @@ public class RadioResponse extends IRadioResponse.Stub { responseCellInfoList(responseInfo, cellInfo); } /** * @param responseInfo Response info struct containing response type, serial no. and error * @param cellInfo List of current cell information known to radio */ public void getCellInfoListResponse_1_2( RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_2.CellInfo> cellInfo) { responseCellInfoList_1_2(responseInfo, cellInfo); } /** * @param responseInfo Response info struct containing response type, serial no. and error */ Loading Loading @@ -1681,6 +1691,20 @@ public class RadioResponse extends IRadioResponse.Stub { } } private void responseCellInfoList_1_2( RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_2.CellInfo> cellInfo) { RILRequest rr = mRil.processResponse(responseInfo); if (rr != null) { ArrayList<CellInfo> ret = RIL.convertHalCellInfoList_1_2(cellInfo); if (responseInfo.error == RadioError.NONE) { sendMessageResponse(rr.mResult, ret); } mRil.processResponseDone(rr, responseInfo, ret); } } private void responseActivityData(RadioResponseInfo responseInfo, ActivityStatsInfo activityInfo) { RILRequest rr = mRil.processResponse(responseInfo); Loading
tests/telephonytests/src/com/android/internal/telephony/RILTest.java +333 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes