Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
WIP: libril: Upgrade sources for Android 11 support
Browse files Browse the repository at this point in the history
Change-Id: If7c7e6587a2db8e9dc58ac8a9ad98e618495f379
Signed-off-by: Adrian DC <[email protected]>
  • Loading branch information
AdrianDC committed Jan 2, 2021
1 parent 75c5ffe commit 5da0cf6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
1 change: 1 addition & 0 deletions include/telephony/ril.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ extern "C" {
#define MAX_BANDS 8
#define MAX_CHANNELS 32
#define MAX_RADIO_ACCESS_NETWORKS 8
#define MAX_BROADCAST_SMS_CONFIG_INFO 25


typedef void * RIL_Token;
Expand Down
4 changes: 1 addition & 3 deletions libril/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ LOCAL_SHARED_LIBRARIES := \
[email protected] \
[email protected] \
[email protected] \
libhidlbase \
libhidltransport \
libhwbinder
libhidlbase \

LOCAL_STATIC_LIBRARIES := \
libprotobuf-c-nano-enable_malloc-32bit \
Expand Down
2 changes: 0 additions & 2 deletions libril/ril.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@
#include <telephony/ril.h>
#include <telephony/ril_cdma_sms.h>
#include <cutils/sockets.h>
#include <cutils/jstring.h>
#include <hwbinder/ProcessState.h>
#include <telephony/record_stream.h>
#include <utils/Log.h>
#include <utils/SystemClock.h>
#include <pthread.h>
#include <cutils/jstring.h>
#include <sys/types.h>
#include <sys/limits.h>
#include <sys/system_properties.h>
Expand Down
30 changes: 22 additions & 8 deletions libril/ril_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <hwbinder/ProcessState.h>
#include <telephony/ril.h>
#include <telephony/ril_mnc.h>
#include <telephony/ril_mcc.h>
#include <ril_service.h>
#include <hidl/HidlTransportSupport.h>
#include <utils/SystemClock.h>
Expand Down Expand Up @@ -1843,6 +1844,12 @@ Return<void> RadioImpl::setGsmBroadcastConfig(int32_t serial,
}

int num = configInfo.size();
if (num > MAX_BROADCAST_SMS_CONFIG_INFO) {
RLOGE("setGsmBroadcastConfig: Invalid configInfo length %s",
requestToString(pRI->pCI->requestNumber));
sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS);
return Void();
}
RIL_GSM_BroadcastSmsConfigInfo gsmBci[num];
RIL_GSM_BroadcastSmsConfigInfo *gsmBciPtrs[num];

Expand Down Expand Up @@ -1890,6 +1897,12 @@ Return<void> RadioImpl::setCdmaBroadcastConfig(int32_t serial,
}

int num = configInfo.size();
if (num > MAX_BROADCAST_SMS_CONFIG_INFO) {
RLOGE("setCdmaBroadcastConfig: Invalid configInfo length %s",
requestToString(pRI->pCI->requestNumber));
sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS);
return Void();
}
RIL_CDMA_BroadcastSmsConfigInfo cdmaBci[num];
RIL_CDMA_BroadcastSmsConfigInfo *cdmaBciPtrs[num];

Expand Down Expand Up @@ -3607,7 +3620,7 @@ void fillCellIdentityResponse(CellIdentity &cellIdentity, RIL_CellIdentity_v16 &
case RIL_CELL_INFO_TYPE_GSM: {
cellIdentity.cellIdentityGsm.resize(1);
cellIdentity.cellIdentityGsm[0].mcc =
std::to_string(rilCellIdentity.cellIdentityGsm.mcc);
ril::util::mcc::decode(rilCellIdentity.cellIdentityGsm.mcc);
cellIdentity.cellIdentityGsm[0].mnc =
ril::util::mnc::decode(rilCellIdentity.cellIdentityGsm.mnc);

Expand All @@ -3625,7 +3638,7 @@ void fillCellIdentityResponse(CellIdentity &cellIdentity, RIL_CellIdentity_v16 &
case RIL_CELL_INFO_TYPE_WCDMA: {
cellIdentity.cellIdentityWcdma.resize(1);
cellIdentity.cellIdentityWcdma[0].mcc =
std::to_string(rilCellIdentity.cellIdentityWcdma.mcc);
ril::util::mcc::decode(rilCellIdentity.cellIdentityWcdma.mcc);
cellIdentity.cellIdentityWcdma[0].mnc =
ril::util::mnc::decode(rilCellIdentity.cellIdentityWcdma.mnc);

Expand Down Expand Up @@ -3654,7 +3667,7 @@ void fillCellIdentityResponse(CellIdentity &cellIdentity, RIL_CellIdentity_v16 &
case RIL_CELL_INFO_TYPE_LTE: {
cellIdentity.cellIdentityLte.resize(1);
cellIdentity.cellIdentityLte[0].mcc =
std::to_string(rilCellIdentity.cellIdentityLte.mcc);
ril::util::mcc::decode(rilCellIdentity.cellIdentityLte.mcc);
cellIdentity.cellIdentityLte[0].mnc =
ril::util::mnc::decode(rilCellIdentity.cellIdentityLte.mnc);

Expand All @@ -3672,7 +3685,7 @@ void fillCellIdentityResponse(CellIdentity &cellIdentity, RIL_CellIdentity_v16 &
case RIL_CELL_INFO_TYPE_TD_SCDMA: {
cellIdentity.cellIdentityTdscdma.resize(1);
cellIdentity.cellIdentityTdscdma[0].mcc =
std::to_string(rilCellIdentity.cellIdentityTdscdma.mcc);
ril::util::mcc::decode(rilCellIdentity.cellIdentityTdscdma.mcc);
cellIdentity.cellIdentityTdscdma[0].mnc =
ril::util::mnc::decode(rilCellIdentity.cellIdentityTdscdma.mnc);

Expand Down Expand Up @@ -8100,7 +8113,7 @@ void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec<Ce
records[i].gsm.resize(1);
CellInfoGsm *cellInfoGsm = &records[i].gsm[0];
cellInfoGsm->cellIdentityGsm.mcc =
std::to_string(rillCellInfo->CellInfo.gsm.cellIdentityGsm.mcc);
ril::util::mcc::decode(rillCellInfo->CellInfo.gsm.cellIdentityGsm.mcc);
cellInfoGsm->cellIdentityGsm.mnc =
ril::util::mnc::decode(rillCellInfo->CellInfo.gsm.cellIdentityGsm.mnc);
cellInfoGsm->cellIdentityGsm.lac =
Expand All @@ -8124,7 +8137,7 @@ void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec<Ce
records[i].wcdma.resize(1);
CellInfoWcdma *cellInfoWcdma = &records[i].wcdma[0];
cellInfoWcdma->cellIdentityWcdma.mcc =
std::to_string(rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.mcc);
ril::util::mcc::decode(rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.mcc);
cellInfoWcdma->cellIdentityWcdma.mnc =
ril::util::mnc::decode(rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.mnc);
cellInfoWcdma->cellIdentityWcdma.lac =
Expand Down Expand Up @@ -8172,7 +8185,7 @@ void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec<Ce
records[i].lte.resize(1);
CellInfoLte *cellInfoLte = &records[i].lte[0];
cellInfoLte->cellIdentityLte.mcc =
std::to_string(rillCellInfo->CellInfo.lte.cellIdentityLte.mcc);
ril::util::mcc::decode(rillCellInfo->CellInfo.lte.cellIdentityLte.mcc);
cellInfoLte->cellIdentityLte.mnc =
ril::util::mnc::decode(rillCellInfo->CellInfo.lte.cellIdentityLte.mnc);
cellInfoLte->cellIdentityLte.ci =
Expand Down Expand Up @@ -8202,7 +8215,8 @@ void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec<Ce
records[i].tdscdma.resize(1);
CellInfoTdscdma *cellInfoTdscdma = &records[i].tdscdma[0];
cellInfoTdscdma->cellIdentityTdscdma.mcc =
std::to_string(rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.mcc);
ril::util::mcc::decode(
rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.mcc);
cellInfoTdscdma->cellIdentityTdscdma.mnc =
ril::util::mnc::decode(
rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.mnc);
Expand Down

0 comments on commit 5da0cf6

Please sign in to comment.