goldfish: support 5g
BUG: 152887162
Change-Id: I498aa168ec45ec1ee123605e0b475e8a21bdac67
diff --git a/radio/libril/Android.mk b/radio/libril/Android.mk
index e0d8501..e435c09 100644
--- a/radio/libril/Android.mk
+++ b/radio/libril/Android.mk
@@ -20,6 +20,9 @@
librilutils \
android.hardware.radio@1.0 \
android.hardware.radio@1.1 \
+ android.hardware.radio@1.2 \
+ android.hardware.radio@1.3 \
+ android.hardware.radio@1.4 \
android.hardware.radio.deprecated@1.0 \
libhidlbase \
diff --git a/radio/libril/ril_service.cpp b/radio/libril/ril_service.cpp
index 24b0fb6..40ce26b 100755
--- a/radio/libril/ril_service.cpp
+++ b/radio/libril/ril_service.cpp
@@ -16,10 +16,10 @@
#define LOG_TAG "RILC"
-#include <android/hardware/radio/1.1/IRadio.h>
-#include <android/hardware/radio/1.1/IRadioResponse.h>
-#include <android/hardware/radio/1.1/IRadioIndication.h>
-#include <android/hardware/radio/1.1/types.h>
+#include <android/hardware/radio/1.4/IRadio.h>
+#include <android/hardware/radio/1.4/IRadioResponse.h>
+#include <android/hardware/radio/1.4/IRadioIndication.h>
+#include <android/hardware/radio/1.4/types.h>
#include <android/hardware/radio/deprecated/1.0/IOemHook.h>
@@ -38,6 +38,10 @@
using namespace android::hardware::radio;
using namespace android::hardware::radio::V1_0;
using namespace android::hardware::radio::deprecated::V1_0;
+using DataRegStateResultV1_4 = android::hardware::radio::V1_4::DataRegStateResult;
+using PhysicalChannelConfigV1_4 =
+ android::hardware::radio::V1_4::PhysicalChannelConfig;
+using RadioTechnologyV1_4 = android::hardware::radio::V1_4::RadioTechnology;
using ::android::hardware::configureRpcThreadpool;
using ::android::hardware::joinRpcThreadpool;
using ::android::hardware::Return;
@@ -127,6 +131,9 @@
sp<IRadioIndication> mRadioIndication;
sp<V1_1::IRadioResponse> mRadioResponseV1_1;
sp<V1_1::IRadioIndication> mRadioIndicationV1_1;
+ sp<V1_4::IRadioResponse> mRadioResponseV1_4;
+ sp<V1_4::IRadioIndication> mRadioIndicationV1_4;
+
Return<void> setResponseFunctions(
const ::android::sp<IRadioResponse>& radioResponse,
@@ -820,6 +827,13 @@
mRadioIndicationV1_1 = nullptr;
}
+ mRadioResponseV1_4 = V1_4::IRadioResponse::castFrom(mRadioResponse).withDefault(nullptr);
+ mRadioIndicationV1_4 = V1_4::IRadioIndication::castFrom(mRadioIndication).withDefault(nullptr);
+ if (mRadioResponseV1_4 == nullptr || mRadioIndicationV1_4 == nullptr) {
+ mRadioResponseV1_4 = nullptr;
+ mRadioIndicationV1_4 = nullptr;
+ }
+
mCounterRadio[mSlotId]++;
ret = pthread_rwlock_unlock(radioServiceRwlockPtr);
@@ -3940,8 +3954,38 @@
dataRegResponse.rat = ATOI_NULL_HANDLED_DEF(resp[3], 0);
dataRegResponse.reasonDataDenied = ATOI_NULL_HANDLED(resp[4]);
dataRegResponse.maxDataCalls = ATOI_NULL_HANDLED_DEF(resp[5], 1);
- fillCellIdentityFromDataRegStateResponseString(dataRegResponse.cellIdentity,
- numStrings, resp);
+ fillCellIdentityFromDataRegStateResponseString(dataRegResponse.cellIdentity, numStrings, resp);
+
+ if (radioService[slotId]->mRadioResponseV1_4 != NULL) {
+ DataRegStateResultV1_4 dataRegResponse14 = {};
+ dataRegResponse14.base.regState =
+ (RegState)ATOI_NULL_HANDLED_DEF(resp[0], 4);
+ dataRegResponse14.base.rat =
+ ATOI_NULL_HANDLED_DEF(resp[3], 0);
+ dataRegResponse14.base.reasonDataDenied =
+ ATOI_NULL_HANDLED(resp[4]);
+ dataRegResponse14.base.maxDataCalls =
+ ATOI_NULL_HANDLED_DEF(resp[5], 1);
+ dataRegResponse14.base.cellIdentity.cellInfoType = dataRegResponse.cellIdentity.cellInfoType;
+ //const bool enableNR = (dataRegResponse14.base.rat == (int)android::hardware::radio::V1_4::RadioTechnology::LTE);
+ const bool enableNR = (dataRegResponse14.base.rat == (int)android::hardware::radio::V1_4::RadioTechnology::NR);
+
+ dataRegResponse14.nrIndicators.isEndcAvailable = enableNR ? 1 : 0;
+ dataRegResponse14.nrIndicators.isDcNrRestricted = enableNR ? 0 : 1;
+ dataRegResponse14.nrIndicators.isNrAvailable = enableNR ? 1 : 0;
+ if (enableNR) {
+ RLOGD("getDataRegistrationStateResponse enabled 5g");
+ } else {
+ RLOGD("getDataRegistrationStateResponse disable 5g");
+ }
+ Return<void> retStatus =
+ radioService[slotId]
+ ->mRadioResponseV1_4
+ ->getDataRegistrationStateResponse_1_4(
+ responseInfo, dataRegResponse14);
+ radioService[slotId]->checkReturnStatus(retStatus);
+ return 0;
+ }
}
} else {
RIL_DataRegistrationStateResponse *dataRegState =
@@ -7084,6 +7128,34 @@
return 0;
}
+int radio::reportPhysicalChannelConfigs(int slotId,
+ int indicationType, int token, RIL_Errno e, void *response,
+ size_t responseLen) {
+
+ if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndicationV1_4 != NULL) {
+ int *configs = (int*)response;
+ ::android::hardware::hidl_vec<PhysicalChannelConfigV1_4> physChanConfig;
+ physChanConfig.resize(1);
+ physChanConfig[0].base.status = (::android::hardware::radio::V1_2::CellConnectionStatus)configs[0];
+ physChanConfig[0].base.cellBandwidthDownlink = configs[1];
+ physChanConfig[0].rat = (::android::hardware::radio::V1_4::RadioTechnology)configs[2];
+ physChanConfig[0].rfInfo.range((::android::hardware::radio::V1_4::FrequencyRange)configs[3]);
+ physChanConfig[0].contextIds.resize(1);
+ physChanConfig[0].contextIds[0] = configs[4];
+ RLOGD("reportPhysicalChannelConfigs: %d %d %d %d %d", configs[0],
+ configs[1], configs[2], configs[3], configs[4]);
+ radioService[slotId]
+ ->mRadioIndicationV1_4->currentPhysicalChannelConfigs_1_4(
+ RadioIndicationType::UNSOLICITED, physChanConfig);
+ } else {
+ RLOGE("reportPhysicalChannelConfigs: radioService[%d]->mRadioIndicationV1_4 == NULL", slotId);
+ return -1;
+ }
+
+ return 0;
+}
+
+
void convertRilSignalStrengthToHal(void *response, size_t responseLen,
SignalStrength& signalStrength) {
RIL_SignalStrength_v10 *rilSignalStrength = (RIL_SignalStrength_v10 *) response;
diff --git a/radio/libril/ril_service.h b/radio/libril/ril_service.h
index 870b644..ba4f0d2 100644
--- a/radio/libril/ril_service.h
+++ b/radio/libril/ril_service.h
@@ -576,6 +576,9 @@
int nitzTimeReceivedInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
+int reportPhysicalChannelConfigs(int slotId, int indicationType,
+ int token, RIL_Errno e, void *response, size_t responselen);
+
int currentSignalStrengthInd(int slotId,
int indicationType, int token, RIL_Errno e,
void *response, size_t responselen);
diff --git a/radio/libril/ril_unsol_commands.h b/radio/libril/ril_unsol_commands.h
index 831f5fb..5ec37ca 100644
--- a/radio/libril/ril_unsol_commands.h
+++ b/radio/libril/ril_unsol_commands.h
@@ -65,3 +65,4 @@
{RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION, radio::carrierInfoForImsiEncryption, WAKE_PARTIAL},
{RIL_UNSOL_NETWORK_SCAN_RESULT, radio::networkScanResultInd, WAKE_PARTIAL},
{RIL_UNSOL_KEEPALIVE_STATUS, radio::keepaliveStatusInd, WAKE_PARTIAL},
+ {RIL_UNSOL_PHYSICAL_CHANNEL_CONFIGS, radio::reportPhysicalChannelConfigs, WAKE_PARTIAL},
diff --git a/radio/ril/reference-ril.c b/radio/ril/reference-ril.c
index 030d410..75fad71 100644
--- a/radio/ril/reference-ril.c
+++ b/radio/ril/reference-ril.c
@@ -470,6 +470,10 @@
at_send_command("AT%CTZV=1", NULL);
#endif
+ /* Golfish specific -- enable physical channel config unsol notifs
+ for 5g support
+ */
+ at_send_command("AT%CGFPCCFG=1", NULL);
pollSIMState(NULL);
}
@@ -3807,7 +3811,32 @@
return;
}
- if (strStartsWith(s, "%CTZV:")) {
+#define CGFPCCFG "%CGFPCCFG:"
+ if (strStartsWith(s, CGFPCCFG)) {
+ /* goldfish specific TODO: send phys channel cfg unsol
+ */
+ char *response;
+ line = p = strdup(s);
+ RLOGD("got CGFPCCFG line %s and %s\n", s, p);
+ err = at_tok_start(&line);
+ if(err) {
+ RLOGE("invalid CGFPCCFG line %s and %s\n", s, p);
+ }
+#define kSize 5
+ int configs[kSize];
+ for (int i=0; i < kSize && !err; ++i) {
+ err = at_tok_nextint(&line, &(configs[i]));
+ RLOGD("got i %d, val = %d", i, configs[i]);
+ }
+ if(err) {
+ RLOGE("invalid CGFPCCFG line %s and %s\n", s, p);
+ } else {
+ RIL_onUnsolicitedResponse (
+ RIL_UNSOL_PHYSICAL_CHANNEL_CONFIGS,
+ configs, kSize);
+ }
+ free(p);
+ } else if (strStartsWith(s, "%CTZV:")) {
/* TI specific -- NITZ time */
char *response;
diff --git a/radio/ril/ril.h b/radio/ril/ril.h
index 7530146..53c6473 100644
--- a/radio/ril/ril.h
+++ b/radio/ril/ril.h
@@ -262,7 +262,8 @@
RADIO_TECH_GSM = 16, // Only supports voice
RADIO_TECH_TD_SCDMA = 17,
RADIO_TECH_IWLAN = 18,
- RADIO_TECH_LTE_CA = 19
+ RADIO_TECH_LTE_CA = 19,
+ RADIO_TECH_NR = 20
} RIL_RadioTechnology;
typedef enum {
@@ -7023,6 +7024,9 @@
*/
#define RIL_UNSOL_KEEPALIVE_STATUS 1050
+
+#define RIL_UNSOL_PHYSICAL_CHANNEL_CONFIGS 1051
+
/***********************************************************************/