summaryrefslogtreecommitdiffstats
path: root/libril/ril_service.cpp
diff options
context:
space:
mode:
authorNathan Harold <nharold@google.com>2018-08-20 11:38:27 -0700
committerMichael Bestas <mkbestas@lineageos.org>2019-02-12 17:59:18 +0100
commitb475875975d1b576511df391f75125593b3353ac (patch)
tree455c53b1d66d6e4192b8d9bc90af6af0ab2d06af /libril/ril_service.cpp
parente3d006fa722c02fc26acdfcaa43a3f3a1378eba9 (diff)
downloadandroid_hardware_ril-lineage-16.0-caf.tar.gz
android_hardware_ril-lineage-16.0-caf.tar.bz2
android_hardware_ril-lineage-16.0-caf.zip
Encode the Number of MNC Digits in CellIdentitylineage-16.0-caf
Legacy RIL uses an integer to encode the number of MNC digits. Because the size is not fixed, leading zeroes result in ambiguity in the length of the mnc. This change adds support for passing the number of encoded digits in the most-significant nibble of the mnc integer (which is only 10 bits). Thus, on any implementation that is 16-bits or wider, the mnc info will be properly encoded and decoded with the correctly-sized string. Bug: 111971808 Test: ril::util::mnc::test Change-Id: I24aeba5328a63f80b0d6b25b068bd19160191dff Merged-In: I24aeba5328a63f80b0d6b25b068bd19160191dff (cherry picked from commit 98cfceefdf06d5e4ec3bfff3d1cd425baefb155e)
Diffstat (limited to 'libril/ril_service.cpp')
-rw-r--r--libril/ril_service.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/libril/ril_service.cpp b/libril/ril_service.cpp
index 5fe4153..2e57bb5 100644
--- a/libril/ril_service.cpp
+++ b/libril/ril_service.cpp
@@ -25,6 +25,8 @@
#include <hwbinder/IPCThreadState.h>
#include <hwbinder/ProcessState.h>
+#include <telephony/ril.h>
+#include <telephony/ril_mnc.h>
#include <ril_service.h>
#include <hidl/HidlTransportSupport.h>
#include <utils/SystemClock.h>
@@ -3572,7 +3574,7 @@ void fillCellIdentityResponse(CellIdentity &cellIdentity, RIL_CellIdentity_v16 &
cellIdentity.cellIdentityGsm[0].mcc =
std::to_string(rilCellIdentity.cellIdentityGsm.mcc);
cellIdentity.cellIdentityGsm[0].mnc =
- std::to_string(rilCellIdentity.cellIdentityGsm.mnc);
+ ril::util::mnc::decode(rilCellIdentity.cellIdentityGsm.mnc);
cellIdentity.cellIdentityGsm[0].lac = rilCellIdentity.cellIdentityGsm.lac;
cellIdentity.cellIdentityGsm[0].cid = rilCellIdentity.cellIdentityGsm.cid;
cellIdentity.cellIdentityGsm[0].arfcn = rilCellIdentity.cellIdentityGsm.arfcn;
@@ -3585,7 +3587,7 @@ void fillCellIdentityResponse(CellIdentity &cellIdentity, RIL_CellIdentity_v16 &
cellIdentity.cellIdentityWcdma[0].mcc =
std::to_string(rilCellIdentity.cellIdentityWcdma.mcc);
cellIdentity.cellIdentityWcdma[0].mnc =
- std::to_string(rilCellIdentity.cellIdentityWcdma.mnc);
+ ril::util::mnc::decode(rilCellIdentity.cellIdentityWcdma.mnc);
cellIdentity.cellIdentityWcdma[0].lac = rilCellIdentity.cellIdentityWcdma.lac;
cellIdentity.cellIdentityWcdma[0].cid = rilCellIdentity.cellIdentityWcdma.cid;
cellIdentity.cellIdentityWcdma[0].psc = rilCellIdentity.cellIdentityWcdma.psc;
@@ -3609,7 +3611,7 @@ void fillCellIdentityResponse(CellIdentity &cellIdentity, RIL_CellIdentity_v16 &
cellIdentity.cellIdentityLte[0].mcc =
std::to_string(rilCellIdentity.cellIdentityLte.mcc);
cellIdentity.cellIdentityLte[0].mnc =
- std::to_string(rilCellIdentity.cellIdentityLte.mnc);
+ ril::util::mnc::decode(rilCellIdentity.cellIdentityLte.mnc);
cellIdentity.cellIdentityLte[0].ci = rilCellIdentity.cellIdentityLte.ci;
cellIdentity.cellIdentityLte[0].pci = rilCellIdentity.cellIdentityLte.pci;
cellIdentity.cellIdentityLte[0].tac = rilCellIdentity.cellIdentityLte.tac;
@@ -3622,7 +3624,7 @@ void fillCellIdentityResponse(CellIdentity &cellIdentity, RIL_CellIdentity_v16 &
cellIdentity.cellIdentityTdscdma[0].mcc =
std::to_string(rilCellIdentity.cellIdentityTdscdma.mcc);
cellIdentity.cellIdentityTdscdma[0].mnc =
- std::to_string(rilCellIdentity.cellIdentityTdscdma.mnc);
+ ril::util::mnc::decode(rilCellIdentity.cellIdentityTdscdma.mnc);
cellIdentity.cellIdentityTdscdma[0].lac = rilCellIdentity.cellIdentityTdscdma.lac;
cellIdentity.cellIdentityTdscdma[0].cid = rilCellIdentity.cellIdentityTdscdma.cid;
cellIdentity.cellIdentityTdscdma[0].cpid = rilCellIdentity.cellIdentityTdscdma.cpid;
@@ -8002,7 +8004,7 @@ void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec<Ce
cellInfoGsm->cellIdentityGsm.mcc =
std::to_string(rillCellInfo->CellInfo.gsm.cellIdentityGsm.mcc);
cellInfoGsm->cellIdentityGsm.mnc =
- std::to_string(rillCellInfo->CellInfo.gsm.cellIdentityGsm.mnc);
+ ril::util::mnc::decode(rillCellInfo->CellInfo.gsm.cellIdentityGsm.mnc);
cellInfoGsm->cellIdentityGsm.lac =
rillCellInfo->CellInfo.gsm.cellIdentityGsm.lac;
cellInfoGsm->cellIdentityGsm.cid =
@@ -8026,7 +8028,7 @@ void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec<Ce
cellInfoWcdma->cellIdentityWcdma.mcc =
std::to_string(rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.mcc);
cellInfoWcdma->cellIdentityWcdma.mnc =
- std::to_string(rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.mnc);
+ ril::util::mnc::decode(rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.mnc);
cellInfoWcdma->cellIdentityWcdma.lac =
rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.lac;
cellInfoWcdma->cellIdentityWcdma.cid =
@@ -8074,7 +8076,7 @@ void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec<Ce
cellInfoLte->cellIdentityLte.mcc =
std::to_string(rillCellInfo->CellInfo.lte.cellIdentityLte.mcc);
cellInfoLte->cellIdentityLte.mnc =
- std::to_string(rillCellInfo->CellInfo.lte.cellIdentityLte.mnc);
+ ril::util::mnc::decode(rillCellInfo->CellInfo.lte.cellIdentityLte.mnc);
cellInfoLte->cellIdentityLte.ci =
rillCellInfo->CellInfo.lte.cellIdentityLte.ci;
cellInfoLte->cellIdentityLte.pci =
@@ -8104,7 +8106,8 @@ void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec<Ce
cellInfoTdscdma->cellIdentityTdscdma.mcc =
std::to_string(rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.mcc);
cellInfoTdscdma->cellIdentityTdscdma.mnc =
- std::to_string(rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.mnc);
+ ril::util::mnc::decode(
+ rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.mnc);
cellInfoTdscdma->cellIdentityTdscdma.lac =
rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.lac;
cellInfoTdscdma->cellIdentityTdscdma.cid =